commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Essl <christiane...@yahoo.de>
Subject Re: [HiveMind] Question about DAO creation
Date Fri, 03 Oct 2003 15:10:40 GMT
The reason is that the connection-pool may to have to be informed when it 
can close its connections. You can do this yourself or let HiveMind do it 
for you. Just a few days ago Howard has commited code so that all service- 
implementations which implement org.hivemind.RegistryShutdownListener are 
informed when the registry ends. This information happens exactly when you 
call Registry.shutdown(). A connection-pool implementation (and other 
services) may relay now on this and therefore you should do it. (Note: the 
registry can not be used anymore after this).

On Fri, 3 Oct 2003 09:53:29 -0500, Bill Lear <rael@zopyra.com> wrote:

> On Friday, October 3, 2003 at 16:45:42 (+0200) Christian Essl writes:
>> Sorry I wrote my answer send it and than just saw that Harish was faster 
>> (and better). Maybe the only thing you should keep from my anser that 
>> you should shutdown the registry (the pool may need it, because HiveMind 
>> now supports a shut-down event).
>
> No reason to apologize --- very helpful stuff, except I'm not sure
> I understand the need to shut down the registry.
>
> I've refactored a bit, now my Global is simpler:
>
> public class Global {
> private DAO dao;
>
> public Global() throws DAOException {
> Services services = new Services();
> DAOFactory factory =
> (DAOFactory) services.getService(DAOFactory.class);
> dao = factory.createDAO();
> }
>
> public DAO getDAO() {
> return dao;
> }
> }
>
> as is my Services class:
>
> public class Services {
> private Registry registry;
>
> public Services() {
> ClassResolver resolver = new DefaultClassResolver();
> RegistryBuilder builder = new RegistryBuilder();
>
> builder.processModules(resolver);
>
> Registry registry = builder.constructRegistry(Locale.getDefault());
> }
>
> public Object getService(Class theClass) {
> return registry.getService(theClass.getName(), theClass);
> }
> }
>
> Now I need to see about incorporating the other ideas about
> connections, shutting down the registry (again, is this really
> needed?)  etc.
>
>
> Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

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


Mime
View raw message