[jboss-cvs] JBossCache/src/org/jboss/cache/rpc ...
Manik Surtani
msurtani at belmont.prod.atl2.jboss.com
Wed Aug 30 13:08:18 EDT 2006
User: msurtani
Date: 06/08/30 13:08:18
Modified: src/org/jboss/cache/rpc RpcTreeCache.java
Log:
Java5 optimisations
Revision Changes Path
1.11 +164 -164 JBossCache/src/org/jboss/cache/rpc/RpcTreeCache.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RpcTreeCache.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/rpc/RpcTreeCache.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- RpcTreeCache.java 25 Aug 2006 14:10:08 -0000 1.10
+++ RpcTreeCache.java 30 Aug 2006 17:08:18 -0000 1.11
@@ -2,10 +2,10 @@
import org.jboss.cache.TreeCache;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jgroups.Address;
import org.jgroups.JChannel;
-import org.jboss.cache.marshall.MethodCall;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -18,53 +18,58 @@
* {@link TreeCache} extension that adds a general purpose RPC functionality
* to allow clients to make/receive RPC calls over the same JGroups Channel
* used by the cache.
- * <p>
+ * <p/>
* Services wishing to receive remote calls should register a unique service
* name and an object on which the remote calls for that service can be invoked.
* </p>
- * <p>
+ * <p/>
* Clients wishing to make RPC calls need to know the unique service name, which
* they can pass to one of the flavors of <code>callRemoteMethods</code>.
* </p>
- *
+ * <p/>
* <strong>NOTE: </strong> The purpose of this class is to allow services that
* want to use a TreeCache to avoid also having to use a HAPartition (and thus
* potentially requiring a duplicate JGroups Channel).
*
- * @deprecated This class will be removed when JGroups adds a multiplexing
- * capability.
- *
* @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
* @version $Revision$
+ * @deprecated This class will be removed when JGroups adds a multiplexing
+ * capability.
*/
public class RpcTreeCache extends TreeCache //implements RpcTreeCacheMBean // TODO; Sort out proper JMX interfaces
{
- /** The {@link #_dispatchRpcCall(String, MethodCall)} method */
+ /**
+ * The {@link #_dispatchRpcCall(String, MethodCall)} method
+ */
public static final Method dispatchRpcCallMethod;
static
{
try
{
- dispatchRpcCallMethod=RpcTreeCache.class.getDeclaredMethod("_dispatchRpcCall",
+ dispatchRpcCallMethod = RpcTreeCache.class.getDeclaredMethod("_dispatchRpcCall",
new Class[]{String.class,
MethodCall.class});
}
- catch(NoSuchMethodException ex) {
+ catch (NoSuchMethodException ex)
+ {
ex.printStackTrace();
throw new ExceptionInInitializerError(ex.toString());
}
}
- /** <code>Map</code> of registered RPC handlers */
+ /**
+ * <code>Map</code> of registered RPC handlers
+ */
protected Map rpcHandlers = new HashMap();
/**
* Creates a channel with the given properties. Connects to the channel, then creates a PullPushAdapter
* and starts it
*/
- public RpcTreeCache(String cluster_name, String props, long state_fetch_timeout) throws Exception {
+ public RpcTreeCache(String cluster_name, String props, long state_fetch_timeout) throws Exception
+ {
//super(cluster_name, props, state_fetch_timeout);
// TODO; Use factory to create cache
}
@@ -74,14 +79,16 @@
*
* @throws Exception
*/
- public RpcTreeCache() throws Exception {
+ public RpcTreeCache() throws Exception
+ {
super();
}
/**
* Expects an already connected channel. Creates a PullPushAdapter and starts it
*/
- public RpcTreeCache(JChannel channel) throws Exception {
+ public RpcTreeCache(JChannel channel) throws Exception
+ {
super(channel);
}
@@ -89,7 +96,6 @@
* Calls a remote method on nodes in the cluster, targeted at
* objects registered under a given <code>serviceName</code>.
*
- *
* @param serviceName name of a callback handler that will have been
* registered on the remote end via
* {@link #registerRPCHandler(String, Object)}.
@@ -111,7 +117,6 @@
* Elements of the list will either be a returned value
* or an exception if one was returned. Any
* NoHandlerForRPCException returned will be removed.
- *
* @throws Exception
*/
public List callRemoteMethods(String serviceName, Vector members, Method method, Object[] args, boolean synchronous, boolean exclude_self, long timeout) throws Exception
@@ -120,10 +125,10 @@
return callRemoteMethods(serviceName, members, MethodCallFactory.create(method, args), synchronous, exclude_self, timeout);
}
-/**
+ /**
* Calls a remote method on nodes in the cluster, targeted at
* objects registered under a given <code>serviceName</code>.
- * <p>
+ * <p/>
* If the cache's <code>cache mode</code> is <code>TreeCache.LOCAL</code>
* and parameter <code>exclude_self</code> is <code>false</code>
* this request will be made directly to
@@ -144,7 +149,6 @@
* Elements of the list will either be a returned value
* or an exception if one was returned. Any
* NoHandlerForRPCException returned will be removed.
- *
* @throws Exception
*/
public List callRemoteMethods(String serviceName, Vector mbrs,
@@ -181,14 +185,15 @@
_dispatchRpcCall(serviceName, method_call);
}
}
- else {
+ else
+ {
// Cache mode is not LOCAL
// Need to make a call on the cluster
// Wrap the ultimate target in a MethodCall pointing at
// the _dispatchRpcCall method
MethodCall wrapper = MethodCallFactory.create(dispatchRpcCallMethod,
- new Object[] { serviceName, method_call});
+ serviceName, method_call);
responses = callRemoteMethods(mbrs, wrapper, synchronous,
exclude_self, timeout);
@@ -217,7 +222,6 @@
* Calls a remote method on nodes in the cluster, targeted at
* objects registered under a given <code>serviceName</code>.
*
- *
* @param serviceName name of a callback handler that will have been
* registered on the remote end via
* {@link #registerRPCHandler(String, Object)}.
@@ -239,10 +243,8 @@
* Elements of the list will either be a returned value
* or an exception if one was returned. Any
* NoHandlerForRPCException returned will be removed.
- *
* @throws NoHandlerForRPCException if no handler is registered on this node
* under <code>serviceName</code>.
- *
* @throws Exception
*/
public List callRemoteMethods(String serviceName, Vector members,
@@ -259,7 +261,7 @@
throw new NoHandlerForRPCException(msg);
}
- Method method= handler.getClass().getDeclaredMethod(method_name, types);
+ Method method = handler.getClass().getDeclaredMethod(method_name, types);
return callRemoteMethods(serviceName, members, method, args,
synchronous, exclude_self, timeout);
}
@@ -272,7 +274,6 @@
* @param serviceName name of a service that will be receiving RPC calls
* @param handler object on which RPC calls for
* <code>serviceName</code> can be invoked.
- *
* @see #_dispatchRpcCall
*/
public void registerRPCHandler(String serviceName, Object handler)
@@ -336,5 +337,4 @@
}
-
}
More information about the jboss-cvs-commits
mailing list