[jboss-remoting-commits] JBoss Remoting SVN: r3654 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Mon Mar 17 03:35:18 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-03-17 03:35:18 -0400 (Mon, 17 Mar 2008)
New Revision: 3654

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java
Log:
JBREM-933: Added removeLocalConfiguration() and clear().

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java	2008-03-17 07:33:27 UTC (rev 3653)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java	2008-03-17 07:35:18 UTC (rev 3654)
@@ -28,6 +28,7 @@
 import java.net.Socket;
 import java.net.UnknownHostException;
 import java.rmi.server.RMIClientSocketFactory;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -77,8 +78,8 @@
    static final long serialVersionUID;
 
    protected static Logger log = Logger.getLogger(RemotingRMIClientSocketFactory.class);
-   protected static HashMap configMaps = new HashMap();
-   protected static Map socketFactories = new HashMap();
+   protected static Map configMaps = Collections.synchronizedMap(new HashMap());
+   protected static Map socketFactories = Collections.synchronizedMap(new HashMap());
 
    protected Map configuration;
    protected InvokerLocator invokerLocator;
@@ -120,6 +121,16 @@
       configMaps.put(new ComparableHolder(invokerLocator), localConfig);
    }
 
+   
+   public static void removeLocalConfiguration(InvokerLocator invokerLocator)
+   {
+      log.debug("removing local configuration for: " + invokerLocator);
+      Object o = configMaps.remove(new ComparableHolder(invokerLocator));
+      if (o == null) log.warn("trying to delete unknown key: " + invokerLocator);
+      ComparableHolder holder = new ComparableHolder(invokerLocator);
+      socketFactories.remove(holder);
+   }
+   
 
    /**
     * @param locator
@@ -207,7 +218,7 @@
    public SocketFactory retrieveSocketFactory(ComparableHolder holder)
       throws IOException
    {
-      SocketFactory sf = (SocketFactory) socketFactories.get(this);
+      SocketFactory sf = (SocketFactory) socketFactories.get(holder);
       if (sf == null)
       {
          // We want to keep the local configuration map, which might contain a
@@ -229,12 +240,20 @@
             sf = AbstractInvoker.wrapSocketFactory(sf, tempConfig);
          }
          
-         socketFactories.put(this, sf);
+         socketFactories.put(holder, sf);
       }
 
       return sf;
    }
    
+   
+   public void clear()
+   {
+      configuration = null;
+      invokerLocator = null;
+      socketFactory = null;
+   }
+   
 
    protected static class ComparableHolder
    {




More information about the jboss-remoting-commits mailing list