[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting ...
Ron Sigal
ron_sigal at yahoo.com
Tue Jan 16 03:02:32 EST 2007
User: rsigal
Date: 07/01/16 03:02:32
Modified: src/main/org/jboss/remoting AbstractInvoker.java
Log:
JBREM-298, JBREM-622: (1) Stripped sessionId from unique listenerid; (2) Added ability to wrap SocketFactory with CreationListenerSocketFactory.
Revision Changes Path
1.17 +49 -20 JBossRemoting/src/main/org/jboss/remoting/AbstractInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/AbstractInvoker.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- AbstractInvoker.java 12 Jan 2007 18:56:22 -0000 1.16
+++ AbstractInvoker.java 16 Jan 2007 08:02:32 -0000 1.17
@@ -27,8 +27,11 @@
import org.jboss.remoting.loading.ClassByteClassLoader;
import org.jboss.remoting.marshal.MarshallLoaderFactory;
import org.jboss.remoting.security.SSLSocketBuilder;
-import org.jboss.remoting.serialization.ClassLoaderUtility;
import org.jboss.remoting.serialization.SerializationStreamFactory;
+import org.jboss.remoting.socketfactory.CreationListenerSocketFactory;
+import org.jboss.remoting.socketfactory.SocketCreationListener;
+import org.jboss.remoting.socketfactory.SocketFactoryWrapper;
+import org.jboss.remoting.serialization.ClassLoaderUtility;
import org.jboss.util.id.GUID;
import javax.net.SocketFactory;
@@ -48,7 +51,7 @@
*
* @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
* @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
- * @version $Revision: 1.16 $
+ * @version $Revision: 1.17 $
*/
public abstract class AbstractInvoker implements Invoker
{
@@ -104,8 +107,6 @@
/**
* return the locator this Invoker represents
- *
- * @return
*/
public InvokerLocator getLocator()
{
@@ -137,9 +138,10 @@
// if got this far, the entry does not exist, so need to add it and create a listener id
CallbackHandlerHolder holder = new CallbackHandlerHolder(callbackhandler, locator);
listenerId = new GUID().toString();
+ String key = listenerId;
if (sessionId != null)
- listenerId = sessionId + "+" + listenerId;
- localServerLocators.put(listenerId, holder);
+ key = sessionId + "+" + listenerId;
+ localServerLocators.put(key, holder);
}
return listenerId;
@@ -148,8 +150,6 @@
/**
* Gets the client locator. This locator will be used by the server side
* to make callbacks to the handler for this locator.
- *
- * @return
*/
public InvokerLocator getClientLocator(String listenerId)
{
@@ -178,9 +178,12 @@
{
Map.Entry entry = (Map.Entry) itr.next();
String listenerId = (String) entry.getKey();
- String prefix = listenerId.substring(0, listenerId.indexOf('+'));
+ int index = listenerId.indexOf('+');
+ String prefix = listenerId.substring(0, index);
if (!sessionId.equals(prefix))
continue;
+ if (index >= 0)
+ listenerId = listenerId.substring(index + 1);
CallbackHandlerHolder holder = (CallbackHandlerHolder) entry.getValue();
InvokerCallbackHandler holderHandler = holder.getHandler();
if (holderHandler.equals(handler))
@@ -194,7 +197,9 @@
{
for (int x = 0; x < holderList.size(); x++)
{
- localServerLocators.remove(((CallbackLocatorHolder) holderList.get(x)).getListenerId());
+ String listenerId = ((CallbackLocatorHolder)holderList.get(x)).getListenerId();
+ String key = sessionId + "+" + listenerId;
+ localServerLocators.remove(key);
}
}
}
@@ -243,11 +248,7 @@
}
/**
- * If any configuration parameters relate to the construction of a SSLSocketBuilder,
- * create one.
- *
- * @param configuration
- * @return
+ * If any configuration parameters relate to the construction of a SSLSocketBuilder, create one.
*/
protected SocketFactory createSocketFactory(Map configuration)
{
@@ -308,7 +309,35 @@
}
}
- return factory;
+ return wrapSocketFactory(factory, configuration);
+ }
+
+
+ static public SocketFactory wrapSocketFactory(SocketFactory socketFactory, Map config)
+ {
+ if (config == null)
+ return socketFactory;
+
+ Object o = config.get(Remoting.SOCKET_CREATION_LISTENER);
+ if (o != null && o instanceof SocketCreationListener)
+ {
+ SocketCreationListener listener = (SocketCreationListener) o;
+ return new CreationListenerSocketFactory(socketFactory, listener);
+ }
+
+ return socketFactory;
+ }
+
+
+ static public boolean isCompleteSocketFactory(SocketFactory sf)
+ {
+ if (sf != null)
+ {
+ if (!(sf instanceof SocketFactoryWrapper) ||
+ ((SocketFactoryWrapper)sf).getSocketFactory() != null)
+ return true;
+ }
+ return false;
}
@@ -345,7 +374,7 @@
{
this.handler = handler;
this.locator = locator;
-}
+ }
public InvokerCallbackHandler getHandler()
{
More information about the jboss-cvs-commits
mailing list