We hava a small farm of servers running JBoss 4.0.1.  On a certain webpage we 
can see how many active sessions are running on each server.  Since we upgraded 
from JBoss 3.0.8 to 4.0.1  all servers report the same amount of sessions.

If I run the following code from the command line all works perfectly. But if I 
run (roughly) the same code in a servlet or strutsaction all servers  report 
the same amount of sessions. Does JBoss cache the RMIAdaptor? What am I doing 
wrong?

public class JMXBrowser
  | {
  | 
  |     public static InitialContext getContext(String serverUrl)throws 
NamingException
  |     {
  |         Properties props = new Properties();
  |         
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
  |         
props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces"); 
  |         props.put(Context.PROVIDER_URL, serverUrl);
  |         InitialContext ic = new InitialContext(props);
  |         return ic;
  |     }
  |     
  |     /**
  |      * @param args the command line arguments
  |      */
  |     public static void main(String[] args) throws Exception
  |     {
  |         String[] servers = new String[2];
  |         servers[0] = "10.241.13.72:1099";
  |         servers[1] = "10.241.13.69:1099";
  | 
  |         for (int i=0; i < servers.length; i++)
  |         {
  |             InitialContext ctx = getContext(servers[ i ]);
  |             RMIAdaptor adaptor = (RMIAdaptor) 
ctx.lookup("jmx/invoker/RMIAdaptor");
  |             Integer count = (Integer) adaptor.getAttribute(new 
ObjectName("plato:service=WebAppService"), "ActiveHttpSessionCount");
  |             System.out.println("Server " + servers[ i ] + ": #sessions: " + 
count);
  |         }
  |     }
  | }

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867236#3867236

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3867236


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to