if the DataSource being used is the same by different clients can i create a
DataSource factory..
public class DataSourceFactory {
private static DataSourceFactory instance;
private static DataSource dataSource;
private DataSourceFactory() {
dataSource = new DataSource (i:e create InitialContext & do
lookup);
}
// singleton class..
public static DataSourceFactory getInstance() {
if (dataSourceFactory == null) {
instance = new DataSourceFactory();
}
return instance;
}
//return reference of the DataSource...
public DataSource getDataSource() {
return dataSource;
}
}
synchronization is not required here i guess, just one datasource type ??
the client...
public class Client {
private Connection getConnection() {
DataSourceFactory instance = DataSourceFactory.getReference();
return instance.getDataSource().getConnection();
}
}
Thanks in Advance,
Rishi Shehrawat
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".