[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
manik at jboss.org
Fri Mar 16 13:48:17 EDT 2007
User: msurtani
Date: 07/03/16 13:48:17
Modified: src/org/jboss/cache CacheImpl.java RPCManager.java
Added: src/org/jboss/cache RPCManagerImpl.java
Log:
Added tests for putForExternalRead()
Revision Changes Path
1.53 +11 -1 JBossCache/src/org/jboss/cache/CacheImpl.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheImpl.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheImpl.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- CacheImpl.java 12 Mar 2007 18:13:46 -0000 1.52
+++ CacheImpl.java 16 Mar 2007 17:48:17 -0000 1.53
@@ -4026,7 +4026,17 @@
public RPCManager getRPCManager()
{
- return RPCManager.getInstance(this);
+ if (rpcManager == null)
+ {
+ synchronized (this)
+ {
+ if (rpcManager == null)
+ {
+ rpcManager = RPCManagerImpl.getInstance(this);
+ }
+ }
+ }
+ return rpcManager;
}
public String getClusterName()
1.9 +10 -60 JBossCache/src/org/jboss/cache/RPCManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RPCManager.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/RPCManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- RPCManager.java 7 Feb 2007 22:06:44 -0000 1.8
+++ RPCManager.java 16 Mar 2007 17:48:17 -0000 1.9
@@ -1,9 +1,3 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
package org.jboss.cache;
import org.jboss.cache.marshall.MethodCall;
@@ -12,64 +6,20 @@
import java.lang.reflect.Method;
import java.util.List;
-/**
- * Manager that handles all RPC calls between JBoss Cache instances
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- */
-public class RPCManager
+public interface RPCManager
{
- private CacheImpl c;
+ public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception;
+
+ public boolean isCoordinator();
+
+ public Address getCoordinator();
+
+ public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, boolean synchronous, boolean excludeSelf, int timeout) throws Exception;
- private RPCManager(CacheImpl c)
- {
- this.c = c;
- }
-
- public static RPCManager getInstance(CacheImpl c)
- {
- RPCManager rpcManager = c.getRpcManager();
- if (rpcManager == null)
- {
- rpcManager = new RPCManager(c);
- c.setRpcManager(rpcManager);
- }
-
- return rpcManager;
- }
-
- // for now, we delegate RPC calls to deprecated methods in CacheImpl.
-
- public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception
- {
- return c.callRemoteMethods(recipients, methodCall, mode, excludeSelf, timeout);
- }
-
- public boolean isCoordinator()
- {
- return c.isCoordinator();
- }
-
- public Address getCoordinator()
- {
- return c.getCoordinator();
- }
-
- public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, boolean synchronous, boolean excludeSelf, int timeout) throws Exception
- {
- return c.callRemoteMethods(recipients, methodCall, synchronous, excludeSelf, timeout);
- }
-
- public List callRemoteMethods(List<Address> recipients, Method method, Object[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception
- {
- return c.callRemoteMethods(recipients, method, arguments, synchronous, excludeSelf, timeout);
- }
+ public List callRemoteMethods(List<Address> recipients, Method method, Object[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception;
/**
* @return Returns the replication queue (if one is used), null otherwise.
*/
- public ReplicationQueue getReplicationQueue()
- {
- return c.getReplicationQueue();
- }
+ public ReplicationQueue getReplicationQueue();
}
1.1 date: 2007/03/16 17:48:17; author: msurtani; state: Exp;JBossCache/src/org/jboss/cache/RPCManagerImpl.java
Index: RPCManagerImpl.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.cache;
import org.jboss.cache.marshall.MethodCall;
import org.jgroups.Address;
import java.lang.reflect.Method;
import java.util.List;
/**
* Manager that handles all RPC calls between JBoss Cache instances
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
*/
public class RPCManagerImpl implements RPCManager
{
private CacheImpl c;
/**
* Empty ctor for mock object creation/unit testing
*/
public RPCManagerImpl()
{
}
private RPCManagerImpl(CacheImpl c)
{
this.c = c;
}
public static RPCManager getInstance(CacheImpl c)
{
RPCManager rpcManager = c.getRpcManager();
if (rpcManager == null)
{
rpcManager = new RPCManagerImpl(c);
c.setRpcManager(rpcManager);
}
return rpcManager;
}
// for now, we delegate RPC calls to deprecated methods in CacheImpl.
public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception
{
return c.callRemoteMethods(recipients, methodCall, mode, excludeSelf, timeout);
}
public boolean isCoordinator()
{
return c.isCoordinator();
}
public Address getCoordinator()
{
return c.getCoordinator();
}
public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, boolean synchronous, boolean excludeSelf, int timeout) throws Exception
{
return c.callRemoteMethods(recipients, methodCall, synchronous, excludeSelf, timeout);
}
public List callRemoteMethods(List<Address> recipients, Method method, Object[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception
{
return c.callRemoteMethods(recipients, method, arguments, synchronous, excludeSelf, timeout);
}
/**
* @return Returns the replication queue (if one is used), null otherwise.
*/
public ReplicationQueue getReplicationQueue()
{
return c.getReplicationQueue();
}
}
More information about the jboss-cvs-commits
mailing list