You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Dmitry Kozakov <di...@java.crimea.com> on 2005/07/28 08:45:17 UTC

Hivemind+Tomcat

Hi
Hivemind has filter which can be set for web application
and can be used for working with registry.
But I want to setup Registry for all application which will be started
under Tomcat. It is possible to write LifecycleListener for Tomcat
and init/shutdown Registry there. But how to access that registry
in the web applications.  I did not find any solutions. May be somebody
confront with this problem?

Best Regards,
	Dmitry





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


Re: Hivemind+Tomcat

Posted by Dmitry Kozakov <di...@java.crimea.com>.
I tried to put registry to the JNDI int the LifecycleListener

Context initCtx = new InitialContext();
initCtx.bind(HIVEMIND_REGISTRY_KEY,registry);

but I can not access to it at any web aaplication.

Code generate unboun exception
Context initCtx = new InitialContext();
initCtx.lookup(HIVEMIND_REGISTRY_KEY);

Best Regards,
	Dmitry



Heiko Braun wrote:

> Hi Dmitry,
>
> the registry itself is threadsafe. you only need to take care when 
> constructing it.
> that means you can either run it as a singleton or add it to a jndi 
> context.
> these are probably the simpliest solutions, i think.
>
> btw. does someone know about any performance issues
> when running a single registry in a heavily mutlithreaded environment?
>
> hth, heiko
>
> Dmitry Kozakov schrieb:
>
>> Hi
>> Hivemind has filter which can be set for web application
>> and can be used for working with registry.
>> But I want to setup Registry for all application which will be started
>> under Tomcat. It is possible to write LifecycleListener for Tomcat
>> and init/shutdown Registry there. But how to access that registry
>> in the web applications.  I did not find any solutions. May be somebody
>> confront with this problem?
>>
>> Best Regards,
>>     Dmitry
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>>
>
>

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


Re: Hivemind+Tomcat

Posted by Heiko Braun <he...@openj.net>.
Hi Dmitry,

the registry itself is threadsafe. you only need to take care when 
constructing it.
that means you can either run it as a singleton or add it to a jndi context.
these are probably the simpliest solutions, i think.

btw. does someone know about any performance issues
when running a single registry in a heavily mutlithreaded environment?

hth, heiko

Dmitry Kozakov schrieb:

> Hi
> Hivemind has filter which can be set for web application
> and can be used for working with registry.
> But I want to setup Registry for all application which will be started
> under Tomcat. It is possible to write LifecycleListener for Tomcat
> and init/shutdown Registry there. But how to access that registry
> in the web applications.  I did not find any solutions. May be somebody
> confront with this problem?
>
> Best Regards,
>     Dmitry
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>


-- 

Heiko Braun

Mobil: +49 177 60 29 100
Skype: heiko_braun


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


Re: Hivemind+Tomcat

Posted by Dmitry Kozakov <di...@java.crimea.com>.
Yes. I undestand this.
But all services in my registry are global.
It means that they give common functionality - all parameters
and return types are primitive. And by the way I 'll use code of
the HivemindFilter for accessing the registry in the web app.

Best Regards,
	Dmitry



Catalin Grigoroscuta wrote:

> Hello,
>
> Note that with your approach, you need to be very careful about a 
> special kind of memory leak: If the registry is global across all 
> applications, it means it will hold strong references to the classes 
> of the application, which might hold references to classes loaded by 
> application class loaders.
> If this happends, when you will stop an application, tomcat lets the 
> application class loader to be garbage collected, in order to collect 
> all objects (and classes) of the application. But in your case, the 
> application class loader will never be garbage collected because of 
> references from Hivemind registry. This means that all web application 
> you ever started (and stopped) in Tomcat will remain in memory, and 
> will never be garbage collected.
>
> Regards,
> Catalin
>
> Dmitry Kozakov wrote:
>
>> Hi
>> Hivemind has filter which can be set for web application
>> and can be used for working with registry.
>> But I want to setup Registry for all application which will be started
>> under Tomcat. It is possible to write LifecycleListener for Tomcat
>> and init/shutdown Registry there. But how to access that registry
>> in the web applications.  I did not find any solutions. May be somebody
>> confront with this problem?
>>
>> Best Regards,
>>     Dmitry
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>

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


Re: Hivemind+Tomcat

Posted by Catalin Grigoroscuta <c....@moodmedia.ro>.
Hello,

Note that with your approach, you need to be very careful about a 
special kind of memory leak: If the registry is global across all 
applications, it means it will hold strong references to the classes of 
the application, which might hold references to classes loaded by 
application class loaders.
If this happends, when you will stop an application, tomcat lets the 
application class loader to be garbage collected, in order to collect 
all objects (and classes) of the application. But in your case, the 
application class loader will never be garbage collected because of 
references from Hivemind registry. This means that all web application 
you ever started (and stopped) in Tomcat will remain in memory, and will 
never be garbage collected.

Regards,
Catalin

Dmitry Kozakov wrote:

> Hi
> Hivemind has filter which can be set for web application
> and can be used for working with registry.
> But I want to setup Registry for all application which will be started
> under Tomcat. It is possible to write LifecycleListener for Tomcat
> and init/shutdown Registry there. But how to access that registry
> in the web applications.  I did not find any solutions. May be somebody
> confront with this problem?
>
> Best Regards,
>     Dmitry
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>


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