You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Enke, Dr., Michael" <mi...@wincor-nixdorf.com> on 2015/03/04 19:15:34 UTC

embedded tomcat: Call ChatAnnotation.broadcast(String) from application?

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!?
What is the correct way to achieve the call of broadcast() method?

Thank you,
Michael

WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Dr. Jürgen Wunram (stellv. Vors.), Jens Bohlen, Olaf Heyden
Vorsitzender des Aufsichtsrats: Dr. Alexander Dibelius
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

RE: embedded tomcat: Call ChatAnnotation.broadcast(String) from application?

Posted by "Enke, Dr., Michael" <mi...@wincor-nixdorf.com>.
>> ... 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

Many thanks Mark, for this fundamental insight. That did the trick!
Michael


WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Dr. Jürgen Wunram (stellv. Vors.), Jens Bohlen, Olaf Heyden
Vorsitzender des Aufsichtsrats: Dr. Alexander Dibelius
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

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


Re: embedded tomcat: Call ChatAnnotation.broadcast(String) from application?

Posted by Mark Thomas <ma...@apache.org>.
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