geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/security GeronimoLoginConfiguration.java
Date Sun, 23 Nov 2003 17:26:44 GMT
adc         2003/11/23 09:26:44

  Modified:    modules/core/src/java/org/apache/geronimo/security
                        GeronimoLoginConfiguration.java
  Log:
  Use ThreadLocals instead of a single static instance.  I'm still not happy
  w/ the way this works.  I would welcome suggestions.
  
  Revision  Changes    Path
  1.2       +7 -6      incubator-geronimo/modules/core/src/java/org/apache/geronimo/security/GeronimoLoginConfiguration.java
  
  Index: GeronimoLoginConfiguration.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/security/GeronimoLoginConfiguration.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GeronimoLoginConfiguration.java	18 Nov 2003 05:17:17 -0000	1.1
  +++ GeronimoLoginConfiguration.java	23 Nov 2003 17:26:43 -0000	1.2
  @@ -73,14 +73,15 @@
    * @version $Revision$ $Date$
    */
   public class GeronimoLoginConfiguration extends Configuration {
  -    private static MBeanServer mBeanServer;
  +    private static ThreadLocal mBeanServer = new ThreadLocal();
       SecurityServiceMBean securityServiceMBean;
   
       public AppConfigurationEntry[] getAppConfigurationEntry(String realm) {
  -        if (mBeanServer == null) throw new java.lang.IllegalStateException("MBean Server
not set");
  +        MBeanServer server = (MBeanServer)mBeanServer.get();
  +        if (server == null) throw new java.lang.IllegalStateException("MBean Server not
set");
   
           SecurityServiceMBean ss = (SecurityServiceMBean) MBeanProxyFactory.getProxy(SecurityServiceMBean.class,
  -                                                                                    mBeanServer,
  +                                                                                    server,
                                                                                       JMXUtil.getObjectName("geronimo.security:type=SecurityService"));
   
           ArrayList list = new ArrayList();
  @@ -88,7 +89,7 @@
           while (iter.hasNext()) {
               ObjectInstance instance = (ObjectInstance) iter.next();
   
  -            SecurityRealm sr = (SecurityRealm) MBeanProxyFactory.getProxy(SecurityRealm.class,
mBeanServer, instance.getObjectName());
  +            SecurityRealm sr = (SecurityRealm) MBeanProxyFactory.getProxy(SecurityRealm.class,
server, instance.getObjectName());
               if (realm.equals(sr.getRealmName())) {
                   AppConfigurationEntry[] ace = sr.getAppConfigurationEntry();
   
  @@ -125,6 +126,6 @@
           SecurityManager sm = System.getSecurityManager();
           if (sm != null) sm.checkPermission(new AuthPermission("setLoginConfiguration"));
   
  -        mBeanServer = server;
  +        mBeanServer.set(server);
       }
   }
  
  
  

Mime
View raw message