asmuts 02/01/21 14:38:53
Modified: src/conf cache.ccf cache.policy remote.cache.ccf
remote.cache2.ccf
src/java/org/apache/stratum/jcs/auxiliary/remote
RemoteCache.java RemoteCacheListener.java
src/java/org/apache/stratum/jcs/auxiliary/remote/behavior
IRemoteCacheConstants.java
src/java/org/apache/stratum/jcs/auxiliary/remote/server
RemoteCacheServer.java
RemoteCacheServerFactory.java
src/java/org/apache/stratum/jcs/auxiliary/remote/server/group
RemoteGroupCacheServer.java
RemoteGroupCacheServerFactory.java
Log:
Got simple clustering working. Will clean later.
Cluster puts to other clusters and is configurable to keep other local in synch.
Clusters do not get from other clusters.
Cluster servers communicate through the server and not the listener.
Group cache locks up in cluster mode. Will fix.
Revision Changes Path
1.8 +1 -1 jakarta-turbine-stratum/src/conf/cache.ccf
Index: cache.ccf
===================================================================
RCS file: /home/cvs/jakarta-turbine-stratum/src/conf/cache.ccf,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cache.ccf 21 Jan 2002 07:00:33 -0000 1.7
+++ cache.ccf 21 Jan 2002 22:38:53 -0000 1.8
@@ -22,7 +22,7 @@
jcs.region.testCache1.cacheattributes.MaxObjects=1000
jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
-jcs.region.testCache2=DC
+jcs.region.testCache2=DC,LTCP
jcs.region.testCache2.cacheattributes=org.apache.stratum.jcs.engine.CompositeCacheAttributes
jcs.region.testCache2.cacheattributes.MaxObjects=1000
jcs.region.testCache2.cacheattributes.MemoryCacheName=org.apache.stratum.jcs.engine.memory.lru.LRUMemoryCache
1.6 +4 -0 jakarta-turbine-stratum/src/conf/cache.policy
Index: cache.policy
===================================================================
RCS file: /home/cvs/jakarta-turbine-stratum/src/conf/cache.policy,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cache.policy 20 Jan 2002 01:47:56 -0000 1.5
+++ cache.policy 21 Jan 2002 22:38:53 -0000 1.6
@@ -9,3 +9,7 @@
grant codeBase "file:[EMAIL PROTECTED]@*" {
permission java.security.AllPermission;
};
+
+grant codeBase "file:/*" {
+ permission java.security.AllPermission;
+};
1.6 +6 -3 jakarta-turbine-stratum/src/conf/remote.cache.ccf
Index: remote.cache.ccf
===================================================================
RCS file: /home/cvs/jakarta-turbine-stratum/src/conf/remote.cache.ccf,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- remote.cache.ccf 21 Jan 2002 07:00:33 -0000 1.5
+++ remote.cache.ccf 21 Jan 2002 22:38:53 -0000 1.6
@@ -3,10 +3,13 @@
registry.host=localhost
registry.port=1102
# call back port to local caches.
-remote.cache.service.port=1101
+remote.cache.service.port=1102
# tomcat config
remote.tomcat.on=false
remote.tomcat.xml=@project_home_f@bin/conf/remote.tomcat.xml
+# cluster setting
+remote.cluster.LocalClusterConsistency=true
+#not allowed -- remote.cluster.AllowClusterGet=false
##############################################################
@@ -38,7 +41,7 @@
jcs.auxiliary.RCluster1.attributes.RemoveUponRemotePut=false
jcs.auxiliary.RCluster1.attributes.ClusterServers=localhost:1103
jcs.auxiliary.RCluster1.attributes.GetOnly=false
-jcs.auxiliary.RCluster1.attributes.LocalClusterConsistency=true
+#jcs.auxiliary.RCluster1.attributes.LocalClusterConsistency=true
# server to update for clustering
jcs.auxiliary.RCluster2=org.apache.stratum.jcs.auxiliary.remote.RemoteCacheFactory
@@ -47,7 +50,7 @@
jcs.auxiliary.RCluster2.attributes.RemoveUponRemotePut=false
jcs.auxiliary.RCluster2.attributes.ClusterServers=localhost:1104
jcs.auxiliary.RCluster2.attributes.GetOnly=false
-jcs.auxiliary.RCluster2.attributes.LocalClusterConsistency=true
+#jcs.auxiliary.RCluster2.attributes.LocalClusterConsistency=true
jcs.auxiliary.DC=org.apache.stratum.jcs.auxiliary.disk.DiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.stratum.jcs.auxiliary.disk.DiskCacheAttributes
1.5 +4 -1 jakarta-turbine-stratum/src/conf/remote.cache2.ccf
Index: remote.cache2.ccf
===================================================================
RCS file: /home/cvs/jakarta-turbine-stratum/src/conf/remote.cache2.ccf,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- remote.cache2.ccf 21 Jan 2002 07:00:33 -0000 1.4
+++ remote.cache2.ccf 21 Jan 2002 22:38:53 -0000 1.5
@@ -3,10 +3,13 @@
registry.host=localhost
registry.port=1103
# call back port to local caches.
-remote.cache.service.port=1101
+remote.cache.service.port=1103
# tomcat config
remote.tomcat.on=false
remote.tomcat.xml=@project_home_f@bin/conf/remote.tomcat.xml
+# cluster setting
+remote.cluster.LocalClusterConsistency=true
+#not allowed remote.cluster.AllowClusterGet=false
##############################################################
1.5 +6 -3
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/RemoteCache.java
Index: RemoteCache.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/RemoteCache.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RemoteCache.java 21 Jan 2002 07:00:33 -0000 1.4
+++ RemoteCache.java 21 Jan 2002 22:38:53 -0000 1.5
@@ -185,7 +185,8 @@
// Do not communicate with cluster except via server.
// separates the remote from the local. Must run a server to
// cluster, else it can be run inside a local.
- if ( this.irca.getRemoteType() != irca.CLUSTER )
+ //if ( this.irca.getRemoteType() != irca.CLUSTER )
+ if ( true )
{
if ( !this.irca.getGetOnly() )
@@ -281,7 +282,8 @@
// Do not communicate with cluster except via server.
// separates the remote from the local. Must run a server to
// cluster, else it can be run inside a local.
- if ( this.irca.getRemoteType() != irca.CLUSTER )
+ //if ( this.irca.getRemoteType() != irca.CLUSTER )
+ if ( true )
{
try
@@ -320,7 +322,8 @@
// Do not communicate with cluster except via server.
// separates the remote from the local. Must run a server to
// cluster, else it can be run inside a local.
- if ( this.irca.getRemoteType() != irca.CLUSTER )
+ //if ( this.irca.getRemoteType() != irca.CLUSTER )
+ if ( true )
{
if ( !this.irca.getGetOnly() )
1.6 +14 -14
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/RemoteCacheListener.java
Index: RemoteCacheListener.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/RemoteCacheListener.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RemoteCacheListener.java 21 Jan 2002 07:00:33 -0000 1.5
+++ RemoteCacheListener.java 21 Jan 2002 22:38:53 -0000 1.6
@@ -260,14 +260,14 @@
getCacheManager();
ICompositeCache cache = ( ICompositeCache ) cacheMgr.getCache(
cb.getCacheName() );
- if ( this.irca.getLocalClusterConsistency() &&
this.irca.getRemoteType() != irca.CLUSTER )
- {
+// if ( this.irca.getLocalClusterConsistency() &&
this.irca.getRemoteType() != irca.CLUSTER )
+// {
cache.update( cb, ICache.EXCLUDE_REMOTE_CACHE );
- }
- else
- {
- cache.update( cb, ICache.INCLUDE_REMOTE_CACHE );
- }
+// }
+// else
+// {
+// cache.update( cb, ICache.INCLUDE_REMOTE_CACHE );
+// }
}
return;
@@ -310,14 +310,14 @@
// Do not communicate with cluster except via server.
// separates the remote from the local. Must run a server to
// cluster, else it can be run inside a local.
- if ( this.irca.getLocalClusterConsistency() && this.irca.getRemoteType() !=
irca.CLUSTER )
- {
+// if ( this.irca.getLocalClusterConsistency() && this.irca.getRemoteType()
!= irca.CLUSTER )
+// {
cache.remove( key, cache.REMOTE_INVOKATION );
- }
- else
- {
- cache.remove( key, cache.LOCAL_INVOKATION );
- }
+// }
+// else
+// {
+// cache.remove( key, cache.LOCAL_INVOKATION );
+// }
}
1.5 +14 -5
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/behavior/IRemoteCacheConstants.java
Index: IRemoteCacheConstants.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/behavior/IRemoteCacheConstants.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- IRemoteCacheConstants.java 20 Jan 2002 01:47:56 -0000 1.4
+++ IRemoteCacheConstants.java 21 Jan 2002 22:38:53 -0000 1.5
@@ -10,24 +10,33 @@
{
/**
- * Description of the Field
+ * Mapping to props file value
*/
public final static String REMOTE_CACHE_SERVICE_NAME =
"remote.cache.service.name";
/**
- * Description of the Field
+ * Mapping to props file value
*/
public final static String REMOTE_CACHE_SERVICE_VAL =
IRemoteCacheService.class.getName();
/**
- * Description of the Field
+ * Mapping to props file value
*/
public final static String TOMCAT_XML = "remote.tomcat.xml";
/**
- * Description of the Field
+ * Mapping to props file value
*/
public final static String TOMCAT_ON = "remote.tomcat.on";
/**
- * Description of the Field
+ * Mapping to props file value
*/
public final static String REMOTE_CACHE_SERVICE_PORT =
"remote.cache.service.port";
+ /**
+ * Mapping to props file value
+ */
+ public final static String REMOTE_LOCAL_CLUSTER_CONSISTENCY =
"remote.cluster.LocalClusterConsistency";
+
+ /**
+ * Mapping to props file value
+ */
+ public final static String REMOTE_ALLOW_CLUSTER_GET =
"remote.cluster.AllowClusterGet";
}
1.5 +99 -117
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/server/RemoteCacheServer.java
Index: RemoteCacheServer.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/server/RemoteCacheServer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RemoteCacheServer.java 21 Jan 2002 07:00:33 -0000 1.4
+++ RemoteCacheServer.java 21 Jan 2002 22:38:53 -0000 1.5
@@ -23,6 +23,7 @@
import org.apache.stratum.jcs.auxiliary.remote.behavior.IRemoteCacheObserver;
import org.apache.stratum.jcs.auxiliary.remote.behavior.IRemoteCacheService;
import org.apache.stratum.jcs.auxiliary.remote.behavior.IRemoteCacheServiceAdmin;
+import
org.apache.stratum.jcs.auxiliary.remote.server.behavior.IRemoteCacheServerAttributes;
import org.apache.stratum.jcs.engine.CacheEventQueue;
import org.apache.stratum.jcs.engine.CacheListeners;
@@ -79,35 +80,26 @@
//private transient int listenerId = 0;
private int[] listenerId = new int[1];
-
- ///////////////////////////////////////////////////////////
/**
- * Constructor for the RemoteCacheServer object
- *
- *@param prop Description of the Parameter
- *@param port Description of the Parameter
- *@exception IOException Description of the Exception
- *@exception NotBoundException Description of the Exception
+ * Description of the Field
*/
- protected RemoteCacheServer( String prop, int port )
- throws IOException, NotBoundException
- {
- super( port );
- init( prop );
- }
+ protected IRemoteCacheServerAttributes rcsa;
+ ///////////////////////////////////////////////////////////
/**
* Constructor for the RemoteCacheServer object
*
- *@param prop Description of the Parameter
+ *@param rcsa Description of the Parameter
*@exception IOException Description of the Exception
*@exception NotBoundException Description of the Exception
*/
- protected RemoteCacheServer( String prop )
+ protected RemoteCacheServer( IRemoteCacheServerAttributes rcsa )
throws IOException, NotBoundException
{
- init( prop );
+ super( rcsa.getServicePort() );
+ this.rcsa = rcsa;
+ init( rcsa.getConfigFileName() );
}
@@ -139,34 +131,6 @@
//cacheListenersMap.put(name, new
CacheListeners(cacheManager.getCache(name)));
}
- /*
- * TOO UGLY
- * should register listeners with other clusters here.
- * CLUSTERLISTENERS
- * populate attr
- * RemoteCacheAttributes rca = new RemoteCacheAttributes();
- * Properties props = RemoteUtils.loadProps(prop);
- * rca.setClusterServers( props.getProperty("remote.clusterServers") );
- * RemoteCacheClusterFactory rccf = new RemoteCacheClusterFactory();
- * rca.setCacheName( "SYSTEM_CLUSTER" );
- * this creates managers for each on cluster list, so failur can be managed
- * individually
- * ICache ic = rccf.createCache( rca );
- * listenersMap is a local cache or cache service that has a group of
assoicated
- * listeners. When an element is put in the remote cache it looks at the
- * cache names, get the listenersMap entry for it and then sends a put to
all the
- * listeners in that queue
- * clusterListenersMap.put("SYSTEM_CLUSTER", new CacheListeners(ic) );
- */
- /*
- * int node = 0;
- * for (Iterator itr =
RemoteCacheClusterManager.instances.values().iterator(); itr.hasNext();) {
- * node++;
- * RemoteCacheClusterManager mgr = (RemoteCacheClusterManager)itr.next();
- * will repeat, ok
- * clusterListenersMap.put("SYSTEM_CLUSTER", new
CacheListeners(mgr.getCache("SYSTEM_CLUSTER")) );
- * }
- */
}
@@ -299,7 +263,6 @@
if ( debug )
{
- //p( "." );
if ( debug )
{
p( "in update, put " + item.getKey() + " in " + item.getCacheName()
);
@@ -319,91 +282,64 @@
Object val = item.getVal();
Integer remoteTypeL = ( Integer ) idTypeMap.get( new Byte( requesterId
) );
- boolean fromRemote = false;
+ boolean fromCluster = false;
if ( remoteTypeL.intValue() == IRemoteCacheAttributes.CLUSTER )
{
- fromRemote = true;
+ fromCluster = true;
}
// ordered cache item update and notification.
synchronized ( cacheDesc )
{
try
{
- //cacheDesc.cache.put(item.getKey(), item.getVal(),
item.getAttributes(), item.getGroupName() );
- //cacheDesc.cache.put(item.getKey(), item.getVal(),
item.getAttributes() );
- //Attributes attr = item.getAttributes();
-
- // need to break interface to signle not to update the remotes
- //Can go ICompositeCache
- //Cache c = (Cache)cacheDesc.cache;
ICompositeCache c = ( ICompositeCache ) cacheDesc.cache;
+
//TODO; make this a bit less of a hack
// If the source of this request was from a cluster, then
// update the remote caches. COnsider it a local update.
// This requires that two local caches not be connected to
// two clustered remote caches. The failover runner will
- // have to make sure of this. ALos,t he local cache needs
+ // have to make sure of this. ALos, the local cache needs
// avoid updating this source. Will need to pass the source
// id somehow. The remote cache should udate all local caches
// but not update the cluster source. Cluster remote caches
// should only be updated by the server and not the RemoteCache.
// PUT LOGIC IN REMOTE CACHE
// WILL TRY UPDATING REMOTES
- //c.update( item, ICache.REMOTE_INVOKATION );
- c.update( item, ICache.LOCAL_INVOKATION );
- }
- catch ( Exception oee )
- {
- }
-
- ICacheEventQueue[] qlist = getEventQList( cacheDesc, requesterId );
-
- for ( int i = 0; i < qlist.length; i++ )
- {
- qlist[i].addPutEvent( item );
- }
-
- // UPDATE THE CLUSTER
- // Since the cluster only updates via the listeners, we
- // don't even have to check it here
- // may be able to use the same listener code
-
- // make sure the requester isn't a CLUSTER
- // right now 0 is the what will be sent since the call back does not
- // identify the id of the observer. Clusters either need to be
put via the remote
- // or they should use 0 to signify that they are clusters
- if ( ( remoteTypeL != null ) && ( requesterId != 0 ) && (
!fromRemote ) )
- {
- //if ( false ) {
- if ( debug )
- {
- p( "updating clusters
**************************************" );
- }
- try
+ if ( fromCluster )
{
- CacheListeners cacheDescC = getClusterListeners(
item.getCacheName() );
- ICacheEventQueue[] qlistC = getEventQList( cacheDescC,
requesterId );
if ( debug )
{
- p( "cluster event queue length = " + qlistC.length );
- }
- for ( int i = 0; i < qlistC.length; i++ )
- {
- qlistC[i].addPutEvent( item );
+ p( "not updating clusters
**************************************" );
}
+ c.update( item, ICache.REMOTE_INVOKATION );
}
- catch ( Exception e )
+ else
{
- log.error( e );
+ if ( debug )
+ {
+ p( "updating clusters
**************************************" );
+ }
+ c.update( item, ICache.LOCAL_INVOKATION );
}
- // end if not a CLUSTER requester
}
- else
+ catch ( Exception oee )
{
- if ( debug )
+ }
+
+ // UPDATE LOCALS IF A REQUEST COMES FROM A CLUSTER
+ // IF LOCAL CLUSTER CONSISTENCY IS CONFIGURED
+ ICompositeCache cache = ( ICompositeCache ) cacheDesc.cache;
+ if ( !fromCluster || ( fromCluster &&
rcsa.getLocalClusterConsistency() ) )
+ {
+
+ ICacheEventQueue[] qlist = getEventQList( cacheDesc,
requesterId );
+
+ for ( int i = 0; i < qlist.length; i++ )
{
- p( "NOT updating clusters xxxxxxxxxxxxx" );
+ qlist[i].addPutEvent( item );
}
+
}
}
@@ -501,7 +437,14 @@
{
p( "get " + key + " from cache " + cacheName );
}
- //CacheListeners cacheDesc =
(CacheListeners)cacheListenersMap.get(cacheName);
+
+// Integer remoteTypeL = ( Integer ) idTypeMap.get( new Byte( requesterId )
);
+ boolean fromCluster = false;
+// if ( remoteTypeL.intValue() == IRemoteCacheAttributes.CLUSTER )
+// {
+// fromCluster = true;
+// }
+
CacheListeners cacheDesc = null;
try
{
@@ -511,7 +454,7 @@
{
log.error( e );
}
- //ICompositeCache c = (ICompositeCache)cacheDesc.cache;
+
if ( cacheDesc == null )
{
return null;
@@ -519,11 +462,22 @@
else
{
ICompositeCache c = ( ICompositeCache ) cacheDesc.cache;
- //return c.get( key, container, ICache.REMOTE_INVOKATION );
- return c.get( key, container, ICache.LOCAL_INVOKATION );
+// if ( fromCluster )
+// {
+ return c.get( key, container, ICache.REMOTE_INVOKATION );
+// }
+// else
+// {
+// if ( this.rcsa.getAllowClusterGet() )
+// {
+// return c.get( key, container, ICache.LOCAL_INVOKATION );
+// }
+// else
+// {
+// return c.get( key, container, ICache.REMOTE_INVOKATION );
+// }
+// }
}
- //return cacheDesc == null ? null : cacheDesc.cache.get(key, container);
- // could add some clustered get
}
@@ -558,30 +512,58 @@
}
CacheListeners cacheDesc = ( CacheListeners ) cacheListenersMap.get(
cacheName );
+ Integer remoteTypeL = ( Integer ) idTypeMap.get( new Byte( requesterId ) );
+ boolean fromCluster = false;
+ if ( remoteTypeL.intValue() == IRemoteCacheAttributes.CLUSTER )
+ {
+ fromCluster = true;
+ }
+
if ( cacheDesc != null )
{
// best attempt to achieve ordered cache item removal and notification.
synchronized ( cacheDesc )
{
+
+ boolean removeSuccess = false;
+
// No need to notify if it was not cached.
ICompositeCache c = ( ICompositeCache ) cacheDesc.cache;
- //if ( c.remove( key, ICache.REMOTE_INVOKATION ) )
- if ( c.remove( key, ICache.LOCAL_INVOKATION ) )
- {
- //p( "propogating remove, was cached" );
-
- ICacheEventQueue[] qlist = getEventQList( cacheDesc,
requesterId );
- //p( "propogating remove, was cached" );
- //p( "qlist.length = " + qlist.length );
- for ( int i = 0; i < qlist.length; i++ )
+ if ( fromCluster )
+ {
+ if ( debug )
{
- qlist[i].addRemoveEvent( key );
+ p( "not updating clusters
**************************************" );
}
+ removeSuccess = c.remove( key, ICache.REMOTE_INVOKATION );
}
else
{
- //p( "not propogating remove, not cached" );
+ if ( debug )
+ {
+ p( "updating clusters
**************************************" );
+ }
+ removeSuccess = c.remove( key, ICache.LOCAL_INVOKATION );
+ }
+
+ if ( removeSuccess )
+ {
+
+ // UPDATE LOCALS IF A REQUEST COMES FROM A CLUSTER
+ // IF LOCAL CLUSTER CONSISTENCY IS CONFIGURED
+ ICompositeCache cache = ( ICompositeCache ) cacheDesc.cache;
+ if ( !fromCluster || ( fromCluster &&
rcsa.getLocalClusterConsistency() ) )
+ {
+
+ ICacheEventQueue[] qlist = getEventQList( cacheDesc,
requesterId );
+
+ for ( int i = 0; i < qlist.length; i++ )
+ {
+ qlist[i].addRemoveEvent( key );
+ }
+ }
+
}
}
}
1.4 +30 -2
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
Index: RemoteCacheServerFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RemoteCacheServerFactory.java 15 Jan 2002 21:33:33 -0000 1.3
+++ RemoteCacheServerFactory.java 21 Jan 2002 22:38:53 -0000 1.4
@@ -14,6 +14,7 @@
import org.apache.stratum.jcs.auxiliary.remote.RemoteUtils;
import org.apache.stratum.jcs.auxiliary.remote.behavior.IRemoteCacheConstants;
import org.apache.stratum.jcs.auxiliary.remote.server.RemoteCacheServer;
+import org.apache.stratum.jcs.auxiliary.remote.server.RemoteCacheServerAttributes;
import org.apache.stratum.jcs.engine.behavior.ICacheServiceAdmin;
@@ -66,6 +67,11 @@
{
return;
}
+
+ // TODO: make automatic
+ RemoteCacheServerAttributes rcsa = new RemoteCacheServerAttributes();
+ rcsa.setConfigFileName( propFile );
+
Properties prop = RemoteUtils.loadProps( propFile );
String servicePortStr = prop.getProperty( REMOTE_CACHE_SERVICE_PORT );
@@ -73,13 +79,34 @@
try
{
servicePort = Integer.parseInt( servicePortStr );
+
+ rcsa.setServicePort( servicePort );
p( "Remote cache service uses port number " + servicePort + "." );
}
catch ( NumberFormatException ignore )
{
p( "Remote cache service port property " +
REMOTE_CACHE_SERVICE_PORT + " not specified. An anonymous port will be used." );
}
- instance = servicePort == -1 ? new RemoteCacheServer( propFile ) : new
RemoteCacheServer( propFile, servicePort );
+
+ String lccStr = prop.getProperty( REMOTE_LOCAL_CLUSTER_CONSISTENCY );
+ if ( lccStr == null )
+ {
+ lccStr = "true";
+ }
+ boolean lcc = Boolean.valueOf( lccStr ).booleanValue();
+ rcsa.setLocalClusterConsistency( lcc );
+
+
+ String acgStr = prop.getProperty( REMOTE_ALLOW_CLUSTER_GET );
+ if ( acgStr == null )
+ {
+ acgStr = "true";
+ }
+ boolean acg = Boolean.valueOf( acgStr ).booleanValue();
+ rcsa.setAllowClusterGet( acg );
+
+ // CREATE SERVER
+ instance = new RemoteCacheServer( rcsa );
if ( host == null )
{
@@ -146,7 +173,8 @@
Thread.currentThread().sleep( 2000 );
}
catch ( InterruptedException ex )
- {}
+ {
+ }
System.exit( 0 );
}
}
1.4 +7 -4
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/server/group/RemoteGroupCacheServer.java
Index: RemoteGroupCacheServer.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/server/group/RemoteGroupCacheServer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RemoteGroupCacheServer.java 15 Jan 2002 21:33:33 -0000 1.3
+++ RemoteGroupCacheServer.java 21 Jan 2002 22:38:53 -0000 1.4
@@ -10,6 +10,8 @@
import org.apache.stratum.jcs.engine.control.CompositeCacheManager;
import org.apache.stratum.jcs.engine.group.GroupCacheManager;
import org.apache.stratum.jcs.engine.group.GroupCacheManagerFactory;
+import org.apache.stratum.jcs.auxiliary.remote.behavior.IRemoteCacheServiceAdmin;
+import
org.apache.stratum.jcs.auxiliary.remote.server.behavior.IRemoteCacheServerAttributes;
/**
* Provides session remote cache services.
@@ -19,17 +21,18 @@
*/
public class RemoteGroupCacheServer extends RemoteCacheServer
{
+ ///////////////////////////////////////////////////////////
/**
- * Remote Cache Server.
+ * Constructor for the RemoteCacheServer object
*
- *@param prop Description of the Parameter
+ *@param rcsa Description of the Parameter
*@exception IOException Description of the Exception
*@exception NotBoundException Description of the Exception
*/
- protected RemoteGroupCacheServer( String prop )
+ protected RemoteGroupCacheServer( IRemoteCacheServerAttributes rcsa )
throws IOException, NotBoundException
{
- super( prop );
+ super( rcsa );
}
1.5 +38 -6
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/server/group/RemoteGroupCacheServerFactory.java
Index: RemoteGroupCacheServerFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/remote/server/group/RemoteGroupCacheServerFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RemoteGroupCacheServerFactory.java 20 Jan 2002 01:47:56 -0000 1.4
+++ RemoteGroupCacheServerFactory.java 21 Jan 2002 22:38:53 -0000 1.5
@@ -16,6 +16,7 @@
import org.apache.stratum.jcs.auxiliary.remote.RemoteUtils;
import org.apache.stratum.jcs.auxiliary.remote.behavior.IRemoteCacheConstants;
import org.apache.stratum.jcs.auxiliary.remote.behavior.IRemoteCacheServiceAdmin;
+import org.apache.stratum.jcs.auxiliary.remote.server.RemoteCacheServerAttributes;
import org.apache.stratum.jcs.utils.log.Logger;
import org.apache.stratum.jcs.utils.log.LoggerManager;
@@ -43,9 +44,7 @@
/**
* Constructor for the RemoteGroupCacheServerFactory object
*/
- private RemoteGroupCacheServerFactory()
- {
- }
+ private RemoteGroupCacheServerFactory() { }
/////////////////////// Statup/shutdown methods. //////////////////
@@ -70,19 +69,51 @@
Properties prop = null;
synchronized ( RemoteGroupCacheServer.class )
{
+
if ( instance != null )
{
return;
}
+
+ // TODO: make automatic
+ RemoteCacheServerAttributes rcsa = new RemoteCacheServerAttributes();
+
+ p( "Configuration file = " + propFile );
+ rcsa.setConfigFileName( propFile );
+
prop = RemoteUtils.loadProps( propFile );
- instance = new RemoteGroupCacheServer( propFile );
+
+ String servicePortStr = prop.getProperty( REMOTE_CACHE_SERVICE_PORT );
+ int servicePort = -1;
+ try
+ {
+ servicePort = Integer.parseInt( servicePortStr );
+
+ rcsa.setServicePort( servicePort );
+ p( "Remote cache service uses port number " + servicePort + "." );
+ }
+ catch ( NumberFormatException ignore )
+ {
+ p( "Remote cache service port property " +
REMOTE_CACHE_SERVICE_PORT + " not specified. An anonymous port will be used." );
+ }
+
+ String lccStr = prop.getProperty( REMOTE_LOCAL_CLUSTER_CONSISTENCY );
+ if ( lccStr == null )
+ {
+ lccStr = "true";
+ }
+ boolean lcc = Boolean.valueOf( lccStr ).booleanValue();
+ rcsa.setLocalClusterConsistency( lcc );
+
+ instance = new RemoteGroupCacheServer( rcsa );
+
if ( host == null )
{
host = "";
}
- // Register the RemoteGroupCacheServer remote object in the registry.
+ // Register the RemoteCacheServer remote object in the registry.
serviceName = prop.getProperty( REMOTE_CACHE_SERVICE_NAME,
REMOTE_CACHE_SERVICE_VAL ).trim();
- log.info( "main> binding server to " + host + ":" + port + " with the
name " +
+ p( "main> binding server to " + host + ":" + port + " with the name " +
serviceName );
try
{
@@ -94,6 +125,7 @@
throw new IllegalArgumentException( ex.getMessage() + "; host=" +
host
+ ", port=" + port );
}
+
}
// Start up tomcat inside remote cache, useful for monitoring
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>