sharing session across Hosts

2005-02-02 Thread Charles N. Harvey III
Hello.
I have two Hosts setup in the same Engine, and I would like to
be able to share session variables across them.  Is this possible?
And, if so, what do I have to configure?  Realm?  Listener?
Thanks a lot.
Charlie
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: sharing session across Hosts

2005-02-02 Thread Mark Winslow
I imagine creating a static variable would be global
to the JVM.  Something like:

public class MyClass
{

public static int nUsers;

};

would allow you to set and retrieve MyClass.nUsers in
a global maner.  I haven't tested this and its an
absurdly trivial example, but it seems like it should
work.


--- Charles N. Harvey III [EMAIL PROTECTED]
wrote:

 Hello.
 I have two Hosts setup in the same Engine, and I
 would like to
 be able to share session variables across them.  Is
 this possible?
 And, if so, what do I have to configure?  Realm? 
 Listener?
 
 Thanks a lot.
 
 
 Charlie
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 





__ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: sharing session across Hosts

2005-02-02 Thread Caldarale, Charles R
 From: Mark Winslow [mailto:[EMAIL PROTECTED]
 Subject: Re: sharing session across Hosts
 
 I imagine creating a static variable would be global
 to the JVM.

Not quite.  It's global to the classloader, not the JVM.  Since each web app 
has its own classloader, you would have to put such a class in a location 
serviced by a more global loader, such as shared/lib.  Now, of course, you've 
introduced dependency issues...

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: sharing session across Hosts

2005-02-02 Thread Charles N. Harvey III
So...
If I create some class, SessionHolder.java, compile it (SessionHolder.class)
and put it in shared/lib, I could then set variables and then retrieve them
from this class?
Charlie

Caldarale, Charles R said the following on 2/2/2005 5:00 PM:
From: Mark Winslow [mailto:[EMAIL PROTECTED]
Subject: Re: sharing session across Hosts
I imagine creating a static variable would be global
to the JVM.
   

Not quite.  It's global to the classloader, not the JVM.  Since each web 
app has its own classloader, you would have to put such a class in a location 
serviced by a more global loader, such as shared/lib.  Now, of course, you've 
introduced dependency issues...
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: sharing session across Hosts

2005-02-02 Thread Mario Winterer
Hi!
Do you want to share some kind of global variables or session 
information? Global variables should exist only once while session 
information is stored for each user (to be more correct: for each 
user-session).

I think you want to share session-information, but using a 
class-variable from a class that is loaded by the shared-classloader is 
nothing else but sharing a global variable. So if you really want to do 
that: Your solution might work, but it is not recommended. I think using 
a directory service is the better way! Tomcat has a built-in JNDI 
context where you can put such global things. (For more information have 
a look at 
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html).
But as I said: All you do is sharing global information that exists only 
once!

Best regards,
 Tex
So...
If I create some class, SessionHolder.java, compile it 
(SessionHolder.class)
and put it in shared/lib, I could then set variables and then retrieve 
them
from this class?

Charlie

Caldarale, Charles R said the following on 2/2/2005 5:00 PM:
From: Mark Winslow [mailto:[EMAIL PROTECTED]
Subject: Re: sharing session across Hosts
I imagine creating a static variable would be global
to the JVM.
  

Not quite.  It's global to the classloader, not the JVM.  Since each 
web app has its own classloader, you would have to put such a class 
in a location serviced by a more global loader, such as shared/lib.  
Now, of course, you've introduced dependency issues...

- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE 
PROPRIETARY MATERIAL and is thus for use only by the intended 
recipient. If you received this in error, please contact the sender 
and delete the e-mail and its attachments from all computers.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]