[jboss-cvs] JBoss Messaging SVN: r1478 - branches/Branch_HTTP_Experiment/src/main/org/jboss/jms/client/remoting
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 17 02:50:48 EDT 2006
Author: ron_sigal
Date: 2006-10-17 02:50:47 -0400 (Tue, 17 Oct 2006)
New Revision: 1478
Modified:
branches/Branch_HTTP_Experiment/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
Log:
JBMESSAGING-207: Uses CallbackManager as an InvokerCallbackHandler.
Modified: branches/Branch_HTTP_Experiment/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- branches/Branch_HTTP_Experiment/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2006-10-17 06:46:30 UTC (rev 1477)
+++ branches/Branch_HTTP_Experiment/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2006-10-17 06:50:47 UTC (rev 1478)
@@ -29,8 +29,7 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.callback.CallbackPoller;
/**
@@ -59,19 +58,15 @@
protected Client client;
protected boolean clientPing;
- protected Connector callbackServer;
protected InvokerLocator serverLocator;
protected CallbackManager callbackManager;
- private InvokerCallbackHandler dummyCallbackHandler;
-
// Constructors --------------------------------------------------
public JMSRemotingConnection(String serverLocatorURI, boolean clientPing) throws Throwable
{
serverLocator = new InvokerLocator(serverLocatorURI);
this.clientPing = clientPing;
- dummyCallbackHandler = new DummyCallbackHandler();
log.debug(this + " created");
}
@@ -93,24 +88,37 @@
// Get the callback server
- callbackServer = CallbackServerFactory.instance.getCallbackServer(serverLocator);
- callbackManager = (CallbackManager)callbackServer.getInvocationHandlers()[0];
-
+ log.info("getting new CallbackManager");
+ callbackManager = new CallbackManager();
client.connect();
// We explicitly set the Marshaller since otherwise remoting tries to resolve the marshaller
// every time which is very slow - see org.jboss.remoting.transport.socket.ProcessInvocation
// This can make a massive difference on performance. We also do this in
// ServerConnectionEndpoint.setCallbackClient.
-
+
client.setMarshaller(new JMSWireFormat());
client.setUnMarshaller(new JMSWireFormat());
- // We add a dummy callback handler only to trigger the addListener method on the
- // JMSServerInvocationHandler to be called, which allows the server to get hold of a reference
- // to the callback client so it can make callbacks
- client.addListener(dummyCallbackHandler, callbackServer.getLocator());
+ // For socket transport allow true push callbacks, with callback Connector.
+ // For http transport, simulate push callbacks.
+ boolean doPushCallbacks = "socket".equals(serverLocator.getProtocol());
+ if (doPushCallbacks)
+ {
+ if (log.isTraceEnabled()) log.trace("doing push callbacks");
+ HashMap metadata = new HashMap();
+ metadata.put(InvokerLocator.DATATYPE, "jms");
+ metadata.put(InvokerLocator.SERIALIZATIONTYPE, "jms");
+ client.addListener(callbackManager, metadata, null, true);
+ }
+ else
+ {
+ if (log.isTraceEnabled()) log.trace("simulating push callbacks");
+ HashMap metadata = new HashMap();
+ metadata.put(CallbackPoller.CALLBACK_POLL_PERIOD, "100");
+ client.addListener(callbackManager, metadata);
+ }
log.debug(this + " started");
}
@@ -122,11 +130,7 @@
// explicitly remove the callback listener, to avoid race conditions on server
// (http://jira.jboss.org/jira/browse/JBMESSAGING-535)
- client.removeListener(dummyCallbackHandler);
- dummyCallbackHandler = null;
-
- CallbackServerFactory.instance.stopCallbackServer(serverLocator.getProtocol());
-
+ client.removeListener(callbackManager);
client.disconnect();
log.debug(this + " closed");
More information about the jboss-cvs-commits
mailing list