tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Evans <dsev...@berndtgroup.net>
Subject RE: Accessing resource in WEB-INF outside servlet
Date Mon, 08 Nov 2004 15:24:54 GMT
Thanks again for the help, this approach is very clean, and i'll be
using it.

dave


On Mon, 2004-11-08 at 10:15, Shapira, Yoav wrote:
> Hi,
> >So the intialization of this sington datasource provider occurs the
> >first time the class is called? and from then on out there's only one
> >instance of the class, owing to its singleton nature? would that look
> >like this:
> >
> >public class AppDBConnector {
> >	private static final INSTANCE = new AppDBConector();
> >	private static DataSource ds;
> >
> >	private AppDBConnector() {
> >		// set static ds abov using JNDI lookup or resource
> bundle
> >	}
> >
> >	public AppDBConnector getInstance() {
> >		return INSTANCE;
> >	}
> >
> >	public Connection getConnection() {
> >		return ds.getConnection();
> >	}
> >}
> 
> Close enough.  There's no need for ds to be static.  And some people
> prefer to not construct INSTANCE until the first getInstance call.  But
> those are smaller details.
> 
> Yoav
> 
> 
> 
> This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged.  This e-mail
is intended only for the individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the sender.  Thank you.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message