Author: manik.surtani(a)jboss.com
Date: 2008-03-27 08:56:20 -0400 (Thu, 27 Mar 2008)
New Revision: 5465
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
Log:
JBCACHE-1311 - In LOCAL mode, getMembers() doesn't comply with javadoc. Fixed by
correcting behaviour as per Javadocs.
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-03-26 21:53:26 UTC
(rev 5464)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-03-27 12:56:20 UTC
(rev 5465)
@@ -89,6 +89,7 @@
private TransactionTable txTable;
private boolean isUsingBuddyReplication;
+ private boolean isInLocalMode;
@Inject
private void setupDependencies(CacheMessageListener messageListener, Configuration
configuration,
@@ -116,11 +117,13 @@
{
case LOCAL:
log.debug("cache mode is local, will not create the channel");
+ isInLocalMode = true;
break;
case REPL_SYNC:
case REPL_ASYNC:
case INVALIDATION_ASYNC:
case INVALIDATION_SYNC:
+ isInLocalMode = false;
if (log.isDebugEnabled()) log.debug("Cache mode is " +
configuration.getCacheMode());
initialiseChannelAndRpcDispatcher();
@@ -549,6 +552,8 @@
public List<Address> getMembers()
{
+ if (isInLocalMode) return null;
+
synchronized (members)
{
return new ArrayList<Address>(members);
Modified: core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-03-26 21:53:26 UTC
(rev 5464)
+++ core/trunk/src/test/java/org/jboss/cache/api/CacheAPITest.java 2008-03-27 12:56:20 UTC
(rev 5465)
@@ -80,6 +80,11 @@
c.setLockAcquisitionTimeout(100);
}
+ public void testGetMembersInLocalMode()
+ {
+ assert cache.getMembers() == null : "Cache members should be null if running
in LOCAL mode";
+ }
+
/**
* Basic usage of cache listeners
* <p/>
@@ -377,7 +382,7 @@
assert spi.peek(Fqn.fromString("/a/b"), true, true) == null;
assert spi.peek(Fqn.fromString("/a"), true, true) == null;
}
-
+
public void testRpcManagerElements()
{
assertEquals("CacheMode.LOCAL cache has no address", null,
cache.getLocalAddress());
Show replies by date