tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: embedded tomcat: Call ChatAnnotation.broadcast(String) from application?
Date Wed, 04 Mar 2015 18:53:56 GMT
On 04/03/2015 18:15, Enke, Dr., Michael wrote:
> Hello all, I start a tomcat from my application and call the static
> ChatAnnotation.broadcast(String) (from examples) out of my
> application. This is possible but anyhow my application seems to
> access a "different" broadcast(String) method: If there are
> connections to the chat (private static final Set connections), my
> application sees an empty Set. How this is possible for a static
> method / Set? There should be only one static function / static
> variable in the JVM!?

That statement is incorrect.

There is only one static function / variable per class instance.

A class is uniquely identified by its name AND class loader.

Hence in a multiple class-loader environment like a Servlet container
(each webapp has its own class loader) you can have multiple classes
with the same name but different class loaders.

Mark

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


Mime
View raw message