Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java Mon Aug 18 15:11:14 2008
@@ -35,10 +35,10 @@
import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheEventLogger;
import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
import org.apache.jcs.engine.stats.StatElement;
import org.apache.jcs.engine.stats.Stats;
import org.apache.jcs.engine.stats.behavior.IStatElement;
@@ -108,12 +108,12 @@
* @param noWaits
* @param rca
* @param cacheMgr
- * @param cacheEventLogger
- * @param elementSerializer
+ * @param cacheEventLogger
+ * @param elementSerializer
*/
public RemoteCacheNoWaitFacade( RemoteCacheNoWait[] noWaits, RemoteCacheAttributes rca,
- ICompositeCacheManager cacheMgr,
- ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
+ ICompositeCacheManager cacheMgr, ICacheEventLogger cacheEventLogger,
+ IElementSerializer elementSerializer )
{
if ( log.isDebugEnabled() )
{
@@ -159,8 +159,11 @@
if ( getCacheEventLogger() != null )
{
- getCacheEventLogger().logError( "RemoteCacheNoWaitFacade", ce.getCacheName(),
- ICacheEventLogger.UPDATE_EVENT, message + ":" + ex.getMessage(), ce );
+ getCacheEventLogger().logError(
+ "RemoteCacheNoWaitFacade",
+ ICacheEventLogger.UPDATE_EVENT,
+ message + ":" + ex.getMessage() + " REGION: " + ce.getCacheName()
+ + " ELEMENT: " + ce );
}
// can handle failover here? Is it safe to try the others?
@@ -386,7 +389,8 @@
if ( noWaits[i].getStatus() == CacheConstants.STATUS_ERROR )
{
// start failover, primary recovery process
- RemoteCacheFailoverRunner runner = new RemoteCacheFailoverRunner( this, cacheMgr, cacheEventLogger, elementSerializer );
+ RemoteCacheFailoverRunner runner = new RemoteCacheFailoverRunner( this, cacheMgr, cacheEventLogger,
+ elementSerializer );
// If the returned monitor is null, it means it's already
// started elsewhere.
if ( runner != null )
@@ -475,7 +479,7 @@
public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
{
this.cacheEventLogger = cacheEventLogger;
- }
+ }
/**
* Allows the failover runner to use this event logger.
@@ -486,7 +490,7 @@
{
return cacheEventLogger;
}
-
+
/**
* Allows you to inject a custom serializer. A good example would be a compressing standard
* serializer.
@@ -496,5 +500,5 @@
public void setElementSerializer( IElementSerializer elementSerializer )
{
this.elementSerializer = elementSerializer;
- }
+ }
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheConstants.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheConstants.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheConstants.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheConstants.java Mon Aug 18 15:11:14 2008
@@ -20,31 +20,31 @@
*/
/**
- * This holds contants that are used by the remote cache.
- *
+ * This holds constants that are used by the remote cache.
*/
public interface IRemoteCacheConstants
{
-
- /** Mapping to props file value */
- public final static String REMOTE_CACHE_SERVICE_NAME = "remote.cache.service.name";
-
/** Mapping to props file value */
public final static String REMOTE_CACHE_SERVICE_VAL = IRemoteCacheService.class.getName();
+ /** Property prefix, should be jcs.remote but this would break existing config. */
+ public final static String PROPERTY_PREFIX = "remote";
+
/** Mapping to props file value */
- public final static String TOMCAT_XML = "remote.tomcat.xml";
+ public final static String REMOTE_CACHE_SERVICE_NAME = PROPERTY_PREFIX + ".cache.service.name";
/** Mapping to props file value */
- public final static String TOMCAT_ON = "remote.tomcat.on";
+ public final static String TOMCAT_XML = PROPERTY_PREFIX + ".tomcat.xml";
/** Mapping to props file value */
- public final static String REMOTE_CACHE_SERVICE_PORT = "remote.cache.service.port";
+ public final static String TOMCAT_ON = PROPERTY_PREFIX + ".tomcat.on";
/** Mapping to props file value */
- public final static String REMOTE_LOCAL_CLUSTER_CONSISTENCY = "remote.cluster.LocalClusterConsistency";
+ public final static String REMOTE_CACHE_SERVICE_PORT = PROPERTY_PREFIX + ".cache.service.port";
/** Mapping to props file value */
- public final static String REMOTE_ALLOW_CLUSTER_GET = "remote.cluster.AllowClusterGet";
+ public final static String REMOTE_LOCAL_CLUSTER_CONSISTENCY = PROPERTY_PREFIX + ".cluster.LocalClusterConsistency";
+ /** Mapping to props file value */
+ public final static String REMOTE_ALLOW_CLUSTER_GET = PROPERTY_PREFIX + ".cluster.AllowClusterGet";
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java Mon Aug 18 15:11:14 2008
@@ -39,23 +39,28 @@
import org.apache.jcs.engine.CacheEventQueueFactory;
import org.apache.jcs.engine.CacheListeners;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheEventLogger;
import org.apache.jcs.engine.behavior.ICacheEventQueue;
import org.apache.jcs.engine.behavior.ICacheListener;
import org.apache.jcs.engine.control.CompositeCache;
import org.apache.jcs.engine.control.CompositeCacheManager;
+import org.apache.jcs.engine.logging.CacheEvent;
+import org.apache.jcs.engine.logging.behavior.ICacheEvent;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
-/*
+/**
* This class provides remote cache services. The remote cache server propagates events from local
* caches to other local caches. It can also store cached data, making it available to new clients.
- * <p> Remote cache servers can be clustered. If the cache used by this remote cache is configured
- * to use a remote cache of type cluster, the two remote caches will communicate with each other.
+ * <p>
+ * Remote cache servers can be clustered. If the cache used by this remote cache is configured to
+ * use a remote cache of type cluster, the two remote caches will communicate with each other.
* Remote and put requests can be sent from one remote to another. If they are configured to
* broadcast such event to their client, then remove an puts can be sent to all locals in the
- * cluster. <p> Get requests are made between clustered servers if AllowClusterGet is true. You can
- * setup several clients to use one remote server and several to use another. The get locad will be
- * distributed between the two servers. Since caches are usually high get and low put, this should
- * allow you to scale.
+ * cluster.
+ * <p>
+ * Get requests are made between clustered servers if AllowClusterGet is true. You can setup several
+ * clients to use one remote server and several to use another. The get local will be distributed
+ * between the two servers. Since caches are usually high get and low put, this should allow you to
+ * scale.
*/
class RemoteCacheServer
extends UnicastRemoteObject
@@ -76,8 +81,10 @@
/** Maps cache name to CacheListeners object. association of listeners (regions). */
private final Hashtable cacheListenersMap = new Hashtable();
+ /** maps cluster listeners to regions. */
private final Hashtable clusterListenersMap = new Hashtable();
+ /** The central hub */
private CompositeCacheManager cacheManager;
/** relates listener id with a type */
@@ -97,8 +104,11 @@
/** An optional event logger */
private ICacheEventLogger cacheEventLogger;
+ /** If there is no event logger, we will return this event for all create calls. */
+ private static final ICacheEvent EMPTY_ICACHE_EVENT = new CacheEvent();
+
/**
- * Constructor for the RemoteCacheServer object. Thiks initializes the server with the values
+ * Constructor for the RemoteCacheServer object. This initializes the server with the values
* from the config file.
* <p>
* @param rcsa
@@ -188,14 +198,14 @@
public void update( ICacheElement item, long requesterId )
throws IOException
{
- logEventStart( item, requesterId, ICacheEventLogger.UPDATE_EVENT );
+ ICacheEvent cacheEvent = createICacheEvent( item, requesterId, ICacheEventLogger.UPDATE_EVENT );
try
{
processUpdate( item, requesterId );
}
finally
{
- logEventFinish( item, requesterId, ICacheEventLogger.UPDATE_EVENT );
+ logICacheEvent( cacheEvent );
}
}
@@ -330,8 +340,8 @@
{
if ( cacheEventLogger != null )
{
- cacheEventLogger.logError( "RemoteCacheServer", item.getCacheName(), ICacheEventLogger.UPDATE_EVENT, e
- .getMessage(), item );
+ cacheEventLogger.logError( "RemoteCacheServer", ICacheEventLogger.UPDATE_EVENT, e.getMessage()
+ + " REGION: " + item.getCacheName() + " ITEM: " + item );
}
log.error( "Trouble in Update. requesterId [" + requesterId + "]", e );
@@ -403,14 +413,14 @@
throws IOException
{
ICacheElement element = null;
- logEventStart( cacheName, key, requesterId, ICacheEventLogger.GET_EVENT );
+ ICacheEvent cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.GET_EVENT );
try
{
element = processGet( cacheName, key, requesterId );
}
finally
{
- logEventFinish( element, requesterId, ICacheEventLogger.GET_EVENT );
+ logICacheEvent( cacheEvent );
}
return element;
}
@@ -458,8 +468,8 @@
if ( cacheEventLogger != null )
{
- cacheEventLogger.logError( "RemoteCacheServer", cacheName, ICacheEventLogger.GET_EVENT, e.getMessage(),
- key );
+ cacheEventLogger.logError( "RemoteCacheServer", ICacheEventLogger.GET_EVENT, e.getMessage() + cacheName
+ + " KEY: " + key );
}
}
@@ -555,14 +565,14 @@
public Map getMultiple( String cacheName, Set keys, long requesterId )
throws IOException
{
- logEventStart( cacheName, (Serializable) keys, requesterId, ICacheEventLogger.GETMULTIPLE_EVENT );
+ ICacheEvent cacheEvent = createICacheEvent( cacheName, (Serializable) keys, requesterId, ICacheEventLogger.GETMULTIPLE_EVENT );
try
{
return processGetMultiple( cacheName, keys, requesterId );
}
finally
{
- logEventEnd( cacheName, (Serializable) keys, requesterId, ICacheEventLogger.GETMULTIPLE_EVENT );
+ logICacheEvent( cacheEvent );
}
}
@@ -724,14 +734,14 @@
public void remove( String cacheName, Serializable key, long requesterId )
throws IOException
{
- logEventStart( cacheName, key, requesterId, ICacheEventLogger.REMOVE_EVENT );
+ ICacheEvent cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.REMOVE_EVENT );
try
{
processRemove( cacheName, key, requesterId );
}
finally
{
- logEventEnd( cacheName, key, requesterId, ICacheEventLogger.REMOVE_EVENT );
+ logICacheEvent( cacheEvent );
}
return;
@@ -835,14 +845,14 @@
public void removeAll( String cacheName, long requesterId )
throws IOException
{
- logEventStart( cacheName, "all", requesterId, ICacheEventLogger.REMOVEALL_EVENT );
+ ICacheEvent cacheEvent = createICacheEvent( cacheName, "all", requesterId, ICacheEventLogger.REMOVEALL_EVENT );
try
{
processRemoveAll( cacheName, requesterId );
}
finally
{
- logEventEnd( cacheName, "all", requesterId, ICacheEventLogger.REMOVEALL_EVENT );
+ logICacheEvent( cacheEvent );
}
return;
}
@@ -938,7 +948,7 @@
public void dispose( String cacheName, long requesterId )
throws IOException
{
- logEventStart( cacheName, "none", requesterId, ICacheEventLogger.DISPOSE_EVENT );
+ ICacheEvent cacheEvent = createICacheEvent( cacheName, "none", requesterId, ICacheEventLogger.DISPOSE_EVENT );
try
{
if ( log.isInfoEnabled() )
@@ -966,7 +976,7 @@
}
finally
{
- logEventEnd( cacheName, "none", requesterId, ICacheEventLogger.DISPOSE_EVENT );
+ logICacheEvent( cacheEvent );
}
return;
}
@@ -1324,7 +1334,7 @@
// cleanup
idTypeMap.remove( new Long( listenerId ) );
idIPMap.remove( new Long( listenerId ) );
-
+
if ( log.isInfoEnabled() )
{
log.info( "After removing listener [" + listenerId + "] cache region " + cacheName + "'s listener size ["
@@ -1446,13 +1456,15 @@
* @param item
* @param requesterId
*/
- private void logEventStart( ICacheElement item, long requesterId, String eventName )
+ private ICacheEvent createICacheEvent( ICacheElement item, long requesterId, String eventName )
{
- if ( cacheEventLogger != null )
+ if ( cacheEventLogger == null )
{
- String ipAddress = getIPAddressForRequesterId( requesterId );
- cacheEventLogger.logStartICacheEvent( "RemoteCacheServer", item.getCacheName(), eventName, ipAddress, item );
+ return EMPTY_ICACHE_EVENT;
}
+ String ipAddress = getIPAddressForRequesterId( requesterId );
+ return cacheEventLogger
+ .createICacheEvent( "RemoteCacheServer", item.getCacheName(), eventName, ipAddress, item );
}
/**
@@ -1462,13 +1474,14 @@
* @param key
* @param requesterId
*/
- private void logEventStart( String cacheName, Serializable key, long requesterId, String eventName )
+ private ICacheEvent createICacheEvent( String cacheName, Serializable key, long requesterId, String eventName )
{
- if ( cacheEventLogger != null )
+ if ( cacheEventLogger == null )
{
- String ipAddress = getIPAddressForRequesterId( requesterId );
- cacheEventLogger.logStartICacheEvent( "RemoteCacheServer", cacheName, eventName, ipAddress, key );
+ return EMPTY_ICACHE_EVENT;
}
+ String ipAddress = getIPAddressForRequesterId( requesterId );
+ return cacheEventLogger.createICacheEvent( "RemoteCacheServer", cacheName, eventName, ipAddress, key );
}
/**
@@ -1477,29 +1490,11 @@
* @param item
* @param requesterId
*/
- private void logEventFinish( ICacheElement item, long requesterId, String eventName )
- {
- if ( cacheEventLogger != null )
- {
- String ipAddress = getIPAddressForRequesterId( requesterId );
- cacheEventLogger.logEndICacheEvent( "RemoteCacheServer", item.getCacheName(), eventName, ipAddress, item );
- }
- }
-
- /**
- * Logs an event if an event logger is configured.
- * <p>
- * @param cacheName
- * @param key
- * @param requesterId
- */
- private void logEventEnd( String cacheName, Serializable key, long requesterId, String eventName )
+ protected void logICacheEvent( ICacheEvent cacheEvent )
{
if ( cacheEventLogger != null )
{
- String ipAddress = getIPAddressForRequesterId( requesterId );
- cacheEventLogger.logEndICacheEvent( "RemoteCacheServer", cacheName, eventName,
- ipAddress, key );
+ cacheEventLogger.logICacheEvent( cacheEvent );
}
}
@@ -1513,10 +1508,10 @@
*/
protected String getIPAddressForRequesterId( long requesterId )
{
- String ipAddress = (String)idIPMap.get( new Long( requesterId ) );
+ String ipAddress = (String) idIPMap.get( new Long( requesterId ) );
return ipAddress;
}
-
+
/**
* Allows it to be injected.
* <p>
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java Mon Aug 18 15:11:14 2008
@@ -31,9 +31,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AuxiliaryCacheConfigurator;
import org.apache.jcs.auxiliary.remote.RemoteUtils;
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheConstants;
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheServiceAdmin;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
* Provides remote cache services. This creates remote cache servers and can proxy command line
@@ -64,8 +66,7 @@
* This will allow you to get stats from the server, etc. Perhaps we should provide methods on
* the factory to do this instead.
* <p>
- * A remote cache is either a local cache or a cluster cache.
- * <p.
+ * A remote cache is either a local cache or a cluster cache. <p.
* @return Returns the remoteCacheServer.
*/
public static RemoteCacheServer getRemoteCacheServer()
@@ -132,58 +133,24 @@
log.error( "Problem setting custom RMI Socket Factory.", e );
}
- // TODO: make automatic
- RemoteCacheServerAttributes rcsa = new RemoteCacheServerAttributes();
- rcsa.setConfigFileName( propFile );
-
- Properties prop = RemoteUtils.loadProps( propFile );
- // Properties prop = PropertyLoader.loadProperties( propFile );
-
- String servicePortStr = prop.getProperty( REMOTE_CACHE_SERVICE_PORT );
- int servicePort = -1;
- try
- {
- servicePort = Integer.parseInt( servicePortStr );
-
- rcsa.setServicePort( servicePort );
- log.debug( "Remote cache service uses port number " + servicePort + "." );
- }
- catch ( NumberFormatException ignore )
+ if ( host == null )
{
- log.debug( "Remote cache service port property " + REMOTE_CACHE_SERVICE_PORT
- + " not specified. An anonymous port will be used." );
+ host = "";
}
- String lccStr = prop.getProperty( REMOTE_LOCAL_CLUSTER_CONSISTENCY );
- if ( lccStr == null )
- {
- lccStr = "true";
- }
- boolean lcc = Boolean.valueOf( lccStr ).booleanValue();
- rcsa.setLocalClusterConsistency( lcc );
+ Properties props = RemoteUtils.loadProps( propFile );
- String acgStr = prop.getProperty( REMOTE_ALLOW_CLUSTER_GET );
- if ( acgStr == null )
- {
- acgStr = "true";
- }
- boolean acg = Boolean.valueOf( acgStr ).booleanValue();
- rcsa.setAllowClusterGet( acg );
+ RemoteCacheServerAttributes rcsa = configureServerAttributes( propFile );
- if ( log.isInfoEnabled() )
- {
- log.info( "Creating server with these attributes " + rcsa );
- }
+ serviceName = rcsa.getRemoteServiceName();
+
+ // CONFIGURE THE EVENT LOGGER
+ ICacheEventLogger cacheEventLogger = AuxiliaryCacheConfigurator
+ .parseCacheEventLogger( props, IRemoteCacheConstants.PROPERTY_PREFIX );
// CREATE SERVER
remoteCacheServer = new RemoteCacheServer( rcsa );
-
- if ( host == null )
- {
- host = "";
- }
- // Register the RemoteCacheServer remote object in the registry.
- serviceName = prop.getProperty( REMOTE_CACHE_SERVICE_NAME, REMOTE_CACHE_SERVICE_VAL ).trim();
+ remoteCacheServer.setCacheEventLogger( cacheEventLogger );
if ( log.isInfoEnabled() )
{
@@ -201,6 +168,57 @@
}
}
+ /** Configures the RemoteCacheServerAttributes from the props file. */
+ protected static RemoteCacheServerAttributes configureServerAttributes( String propFile )
+ throws IOException
+ {
+ // TODO: make automatic
+ RemoteCacheServerAttributes rcsa = new RemoteCacheServerAttributes();
+ rcsa.setConfigFileName( propFile );
+
+ Properties prop = RemoteUtils.loadProps( propFile );
+ // Properties prop = PropertyLoader.loadProperties( propFile );
+
+ String servicePortStr = prop.getProperty( REMOTE_CACHE_SERVICE_PORT );
+ try
+ {
+ int servicePort = Integer.parseInt( servicePortStr );
+ rcsa.setServicePort( servicePort );
+ log.debug( "Remote cache service uses port number " + servicePort + "." );
+ }
+ catch ( NumberFormatException ignore )
+ {
+ log.debug( "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 );
+
+ String acgStr = prop.getProperty( REMOTE_ALLOW_CLUSTER_GET );
+ if ( acgStr == null )
+ {
+ acgStr = "true";
+ }
+ boolean acg = Boolean.valueOf( acgStr ).booleanValue();
+ rcsa.setAllowClusterGet( acg );
+
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Creating server with these attributes " + rcsa );
+ }
+
+ // Register the RemoteCacheServer remote object in the registry.
+ rcsa.setRemoteServiceName( prop.getProperty( REMOTE_CACHE_SERVICE_NAME, REMOTE_CACHE_SERVICE_VAL ).trim() );
+
+ return rcsa;
+ }
+
/**
* Unbinds the remote server.
* <p>
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheService.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/ZombieCacheService.java Mon Aug 18 15:11:14 2008
@@ -21,7 +21,6 @@
import java.io.Serializable;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -29,16 +28,15 @@
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.ICacheService;
-
import org.apache.jcs.engine.behavior.IZombie;
/**
- * Zombie adapter for any cache service. balks at every call.
+ * Zombie adapter for any cache service. Balks at every call.
*/
public class ZombieCacheService
implements ICacheService, IZombie
{
-
+ /** The logger. */
private static final Log log = LogFactory.getLog( ZombieCacheService.class );
/**
@@ -53,9 +51,10 @@
// zombies have no inner life
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.engine.behavior.ICacheService#update(org.apache.jcs.engine.behavior.ICacheElement)
+ /**
+ * Does nothing.
+ * <p>
+ * @param item
*/
public void update( ICacheElement item )
{
@@ -63,21 +62,21 @@
}
/**
- * @param cacheName
- * @param key
+ * @param cacheName
+ * @param key
* @return null. zombies have no internal data
- * */
+ */
public ICacheElement get( String cacheName, Serializable key )
{
return null;
}
/**
- * Returns an empty map. Zombies have no internal data.
+ * Returns an empty map. Zombies have no internal data.
* <p>
- * @param cacheName
+ * @param cacheName
* @param keys
- * @return an empty map
+ * @return an empty map
*/
public Map getMultiple( String cacheName, Set keys )
{
Added: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java?rev=686881&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java Mon Aug 18 15:11:14 2008
@@ -0,0 +1,73 @@
+package org.apache.jcs.engine.behavior;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+
+/**
+ * This interface defines the behavior of the serialized element wrapper.
+ * <p>
+ * The value is stored as a byte array. This should allow for a variety of serialization mechanisms.
+ * <p>
+ * This currently extends ICacheElement for backward compatibility.
+ *<p>
+ * @author Aaron Smuts
+ */
+public interface ICacheElementSerialized
+ extends ICacheElement
+{
+ /**
+ * Gets the cacheName attribute of the ICacheElement object. The cacheName is also known as the
+ * region name.
+ *<p>
+ * @return The cacheName value
+ */
+ public String getCacheName();
+
+ /**
+ * Gets the key attribute of the ICacheElementSerialized object. This is the standard key that
+ * the value can be reference by.
+ *<p>
+ * @return The key value
+ */
+ public Serializable getKey();
+
+ /**
+ * Gets the value attribute of the ICacheElementSerialized object. This is the value the client
+ * cached serialized by some mechanism.
+ *<p>
+ * @return The serialized value
+ */
+ public byte[] getSerializedValue();
+
+ /**
+ * Gets the attributes attribute of the ICacheElement object
+ *<p>
+ * @return The attributes value
+ */
+ public IElementAttributes getElementAttributes();
+
+ /**
+ * Sets the attributes attribute of the ICacheElement object
+ *<p>
+ * @param attr The new attributes value
+ */
+ public void setElementAttributes( IElementAttributes attr );
+}
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheElementSerialized.java
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCache.java Mon Aug 18 15:11:14 2008
@@ -974,7 +974,7 @@
}
/**
- * Do not propogate removeall laterally or remotely.
+ * Do not propagate removeall laterally or remotely.
* <p>
* @param key
* @return true if the item was already in the cache.
@@ -987,12 +987,12 @@
/**
* fromRemote: If a remove call was made on a cache with both, then the remote should have been
* called. If it wasn't then the remote is down. we'll assume it is down for all. If it did come
- * from the remote then the cache is remotely configured and lateral removal is unncessary. If
+ * from the remote then the cache is remotely configured and lateral removal is unnecessary. If
* it came laterally then lateral removal is unnecessary. Does this assume that there is only
- * one lateral and remote for the cache? Not really, the intial removal should take care of the
- * problem if the source cache was similiarly configured. Otherwise the remote cache, if it had
+ * one lateral and remote for the cache? Not really, the initial removal should take care of the
+ * problem if the source cache was similarly configured. Otherwise the remote cache, if it had
* no laterals, would remove all the elements from remotely configured caches, but if those
- * caches had some other wierd laterals that were not remotely configured, only laterally
+ * caches had some other weird laterals that were not remotely configured, only laterally
* propagated then they would go out of synch. The same could happen for multiple remotes. If
* this looks necessary we will need to build in an identifier to specify the source of a
* removal.
@@ -1133,7 +1133,7 @@
}
/**
- * Flushes all cache items from memory to auxilliary caches and close the auxilliary caches.
+ * Flushes all cache items from memory to auxiliary caches and close the auxiliary caches.
*/
public void dispose()
{
@@ -1142,8 +1142,8 @@
/**
* Invoked only by CacheManager. This method disposes of the auxiliaries one by one. For the disk cache, the items in memory
- * are freed, meaning that they will be sent through the overflow chanel to disk. After the
- * auxiliaries are disposed, the memory cache is dispposed.
+ * are freed, meaning that they will be sent through the overflow channel to disk. After the
+ * auxiliaries are disposed, the memory cache is disposed.
* <p>
* @param fromRemote
*/
@@ -1161,7 +1161,7 @@
}
alive = false;
- // Dispose of each auxilliary cache, Remote auxilliaries will be
+ // Dispose of each auxiliary cache, Remote auxiliaries will be
// skipped if 'fromRemote' is true.
for ( int i = 0; i < auxCaches.length; i++ )
@@ -1170,10 +1170,10 @@
{
ICache aux = auxCaches[i];
- // Skip this auxilliary if:
- // - The auxilliary is null
- // - The auxilliary is not alive
- // - The auxilliary is remote and the invocation was remote
+ // Skip this auxiliary if:
+ // - The auxiliary is null
+ // - The auxiliary is not alive
+ // - The auxiliary is remote and the invocation was remote
if ( aux == null || aux.getStatus() != CacheConstants.STATUS_ALIVE
|| ( fromRemote && aux.getCacheType() == REMOTE_CACHE ) )
@@ -1191,7 +1191,7 @@
log.info( "In DISPOSE, [" + this.cacheName + "] auxiliary [" + aux + "]" );
}
- // IT USED TO BE THE CASE THAT (If the auxilliary is not a lateral, or the cache
+ // IT USED TO BE THE CASE THAT (If the auxiliary is not a lateral, or the cache
// attributes
// have 'getUseLateral' set, all the elements currently in
// memory are written to the lateral before disposing)
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheConfigurator.java Mon Aug 18 15:11:14 2008
@@ -31,12 +31,13 @@
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.auxiliary.AuxiliaryCache;
import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.jcs.auxiliary.AuxiliaryCacheConfigurator;
import org.apache.jcs.auxiliary.AuxiliaryCacheFactory;
import org.apache.jcs.engine.behavior.ICache;
-import org.apache.jcs.engine.behavior.ICacheEventLogger;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
import org.apache.jcs.utils.config.OptionConverter;
import org.apache.jcs.utils.config.PropertySetter;
@@ -59,26 +60,13 @@
final static String AUXILIARY_PREFIX = "jcs.auxiliary.";
+ /** .attributes */
final static String ATTRIBUTE_PREFIX = ".attributes";
final static String CACHE_ATTRIBUTE_PREFIX = ".cacheattributes";
final static String ELEMENT_ATTRIBUTE_PREFIX = ".elementattributes";
- /**
- * jcs.auxiliary.NAME.cacheeventlogger=CLASSNAME
- * <p>
- * jcs.auxiliary.NAME.cacheeventlogger.attributes.CUSTOMPROPERTY=VALUE
- */
- final static String CACHE_EVENT_LOGGER_PREFIX = ".cacheeventlogger";
-
- /**
- * jcs.auxiliary.NAME.serializer=CLASSNAME
- * <p>
- * jcs.auxiliary.NAME.serializer.attributes.CUSTOMPROPERTY=VALUE
- */
- final static String SERIALIZER_PREFIX = ".serializer";
-
private CompositeCacheManager compositeCacheManager;
/**
@@ -559,11 +547,13 @@
// GET CACHE FROM FACTORY WITH ATTRIBUTES
auxAttr.setCacheName( regName );
+ String auxPrefix = AUXILIARY_PREFIX + auxName;
+
// CONFIGURE THE EVENT LOGGER
- ICacheEventLogger cacheEventLogger = parseCacheEventLogger( props, auxName );
+ ICacheEventLogger cacheEventLogger = AuxiliaryCacheConfigurator.parseCacheEventLogger( props, auxName );
// CONFIGURE THE ELEMENT SERIALIZER
- IElementSerializer elementSerializer = parseElementSerializer( props, auxName );
+ IElementSerializer elementSerializer = AuxiliaryCacheConfigurator.parseElementSerializer( props, auxName );
// Consider putting the compositeCache back in the factory interface
// since the manager may not know about it at this point.
@@ -573,55 +563,4 @@
return auxCache;
}
-
- /**
- * Parses the event logger config, if there is any for the auxiliary.
- * <p>
- * @param props
- * @param auxName
- * @return cacheEventLogger
- */
- protected ICacheEventLogger parseCacheEventLogger( Properties props, String auxName )
- {
- ICacheEventLogger cacheEventLogger = null;
-
- // auxFactory was not previously initialized.
- String eventLoggerClassName = AUXILIARY_PREFIX + auxName + CACHE_EVENT_LOGGER_PREFIX;
- cacheEventLogger = (ICacheEventLogger) OptionConverter
- .instantiateByKey( props, eventLoggerClassName, org.apache.jcs.engine.behavior.ICacheEventLogger.class,
- null );
- if ( cacheEventLogger != null )
- {
- String cacheEventLoggerAttributePrefix = AUXILIARY_PREFIX + auxName + CACHE_EVENT_LOGGER_PREFIX
- + ATTRIBUTE_PREFIX;
- PropertySetter.setProperties( cacheEventLogger, props, cacheEventLoggerAttributePrefix + "." );
- }
- return cacheEventLogger;
- }
-
- /**
- * Parses the element config, if there is any for the auxiliary.
- * <p>
- * @param props
- * @param auxName
- * @return cacheEventLogger
- */
- protected IElementSerializer parseElementSerializer( Properties props, String auxName )
- {
- // TODO take in the entire prop key
-
- IElementSerializer elementSerializer = null;
-
- // auxFactory was not previously initialized.
- String elementSerializerClassName = AUXILIARY_PREFIX + auxName + SERIALIZER_PREFIX;
- elementSerializer = (IElementSerializer) OptionConverter
- .instantiateByKey( props, elementSerializerClassName,
- org.apache.jcs.engine.behavior.IElementSerializer.class, null );
- if ( elementSerializer != null )
- {
- String cacheEventLoggerAttributePrefix = AUXILIARY_PREFIX + auxName + SERIALIZER_PREFIX + ATTRIBUTE_PREFIX;
- PropertySetter.setProperties( elementSerializer, props, cacheEventLoggerAttributePrefix + "." );
- }
- return elementSerializer;
- }
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java Mon Aug 18 15:11:14 2008
@@ -38,12 +38,10 @@
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.CompositeCacheAttributes;
import org.apache.jcs.engine.ElementAttributes;
-import org.apache.jcs.engine.behavior.ICacheEventLogger;
import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.jcs.engine.behavior.IElementAttributes;
-import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.engine.behavior.IShutdownObservable;
import org.apache.jcs.engine.behavior.IShutdownObserver;
import org.apache.jcs.engine.stats.CacheStats;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEvent.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEvent.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEvent.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEvent.java Mon Aug 18 15:11:14 2008
@@ -23,18 +23,15 @@
/**
* Defines how an element event object should behave.
- *
*/
public interface IElementEvent
extends Serializable
{
-
/**
- * Gets the elementEvent attribute of the IElementEvent object. This code is
- * Contained in the IElememtEventConstants class.
- *
+ * Gets the elementEvent attribute of the IElementEvent object. This code is Contained in the
+ * IElememtEventConstants class.
+ *<p>
* @return The elementEvent value
*/
public int getElementEvent();
-
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEventConstants.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEventConstants.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEventConstants.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/event/behavior/IElementEventConstants.java Mon Aug 18 15:11:14 2008
@@ -21,54 +21,34 @@
/**
* This describes the events that an item can encounter.
- *
*/
public interface IElementEventConstants
{
-
- /**
- * Background expiration
- */
+ /** Background expiration */
public final static int ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND = 0;
- /**
- * Expiration discovered on request
- */
+ /*** Expiration discovered on request */
public final static int ELEMENT_EVENT_EXCEEDED_MAXLIFE_ONREQUEST = 1;
- /**
- * Background expiration
- */
+ /** Background expiration */
public final static int ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND = 2;
- /**
- * Expiration discovered on request
- */
+ /** Expiration discovered on request */
public final static int ELEMENT_EVENT_EXCEEDED_IDLETIME_ONREQUEST = 3;
- /**
- * Moving from memory to disk (what if no disk?)
- */
+ /** Moving from memory to disk (what if no disk?) */
public final static int ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE = 4;
- /**
- * Moving from memory to disk (what if no disk?)
- */
+ /** Moving from memory to disk (what if no disk?) */
public final static int ELEMENT_EVENT_SPOOLED_DISK_NOT_AVAILABLE = 5;
- /**
- * Moving from memory to disk, but item is not spoolable
- */
+ /** Moving from memory to disk, but item is not spoolable */
public final static int ELEMENT_EVENT_SPOOLED_NOT_ALLOWED = 6;
- /**
- * Removed activley by a remove command. (Could distinguish between local
- * and remote)
- */
+ /** Removed actively by a remove command. (Could distinguish between local and remote) */
//public final static int ELEMENT_EVENT_REMOVED = 7;
/**
- * Element was requested from cache. Not sure we ever want to implement
- * this.
+ * Element was requested from cache. Not sure we ever want to implement this.
*/
//public final static int ELEMENT_EVENT_GET = 8;
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/group/GroupAttrName.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/group/GroupAttrName.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/group/GroupAttrName.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/group/GroupAttrName.java Mon Aug 18 15:11:14 2008
@@ -23,7 +23,6 @@
/**
* Description of the Class
- *
*/
public class GroupAttrName
implements Serializable
@@ -40,7 +39,6 @@
/**
* Constructor for the GroupAttrName object
- *
* @param groupId
* @param attrName
*/
@@ -58,9 +56,7 @@
/**
* Tests object equality.
- *
- * @param obj
- * The <code>GroupAttrName</code> instance to test.
+ * @param obj The <code>GroupAttrName</code> instance to test.
* @return Whether equal.
*/
public boolean equals( Object obj )
@@ -74,17 +70,15 @@
}
/**
- * @return A hash code based on the hash code of {@ #groupid}and
- * {@link #attrName}.
+ * @return A hash code based on the hash code of @ #groupid} and {@link #attrName}.
*/
public int hashCode()
{
return groupId.hashCode() ^ attrName.hashCode();
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
+ /**
+ * @return the cached value.
*/
public String toString()
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/group/GroupId.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/group/GroupId.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/group/GroupId.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/group/GroupId.java Mon Aug 18 15:11:14 2008
@@ -22,28 +22,25 @@
import java.io.Serializable;
/**
- * Used to avoid name conflict when group cache items are mixed with non-group
- * cache items in the same cache.
- *
+ * Used to avoid name conflict when group cache items are mixed with non-group cache items in the
+ * same cache.
*/
public class GroupId
implements Serializable
{
+ /** Don't change. */
private static final long serialVersionUID = 4626368486444860133L;
/** Description of the Field */
public final String groupName;
- /**
- * the name of the region.
- */
+ /** the name of the region. */
public final String cacheName;
private String toString;
/**
* Constructor for the GroupId object
- *
* @param cacheName
* @param groupName
*/
@@ -62,9 +59,9 @@
}
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
+ /**
+ * @param obj
+ * @return cacheName.equals( g.cacheName ) && groupName.equals( g.groupName );
*/
public boolean equals( Object obj )
{
@@ -76,18 +73,18 @@
return cacheName.equals( g.cacheName ) && groupName.equals( g.groupName );
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
+ /**
+ * @return cacheName.hashCode() + groupName.hashCode();
*/
public int hashCode()
{
return cacheName.hashCode() + groupName.hashCode();
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
+ /**
+ * Caches the value.
+ * <p>
+ * @return debugging string.
*/
public String toString()
{
Added: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEvent.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEvent.java?rev=686881&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEvent.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEvent.java Mon Aug 18 15:11:14 2008
@@ -0,0 +1,117 @@
+package org.apache.jcs.engine.logging;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.jcs.engine.logging.behavior.ICacheEvent;
+
+/** It's returned from create and passed into log. */
+public class CacheEvent
+ implements ICacheEvent
+{
+ /** Don't change. */
+ private static final long serialVersionUID = -5913139566421714330L;
+
+ /** The auxiliary or other source of the event. */
+ private String source;
+
+ /** The cache region */
+ private String region;
+
+ /** The event name: update, get, remove, etc. */
+ private String eventName;
+
+ /** disk location, ip, etc. */
+ private String optionalDetails;
+
+ /** The key that was put or retrieved. */
+ private Serializable key;
+
+ /**
+ * @param source the source to set
+ */
+ public void setSource( String source )
+ {
+ this.source = source;
+ }
+
+ /**
+ * @return the source
+ */
+ public String getSource()
+ {
+ return source;
+ }
+
+ /**
+ * @param region the region to set
+ */
+ public void setRegion( String region )
+ {
+ this.region = region;
+ }
+
+ /**
+ * @return the region
+ */
+ public String getRegion()
+ {
+ return region;
+ }
+
+ /**
+ * @param eventName the eventName to set
+ */
+ public void setEventName( String eventName )
+ {
+ this.eventName = eventName;
+ }
+
+ /**
+ * @return the eventName
+ */
+ public String getEventName()
+ {
+ return eventName;
+ }
+
+ /**
+ * @param optionalDetails the optionalDetails to set
+ */
+ public void setOptionalDetails( String optionalDetails )
+ {
+ this.optionalDetails = optionalDetails;
+ }
+
+ /**
+ * @return the optionalDetails
+ */
+ public String getOptionalDetails()
+ {
+ return optionalDetails;
+ }
+
+ /**
+ * @param key the key to set
+ */
+ public void setKey( Serializable key )
+ {
+ this.key = key;
+ }
+
+ /**
+ * @return the key
+ */
+ public Serializable getKey()
+ {
+ return key;
+ }
+
+ /**
+ * @return reflection toString
+ */
+ public String toString()
+ {
+ return ToStringBuilder.reflectionToString( this );
+ }
+}
Added: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerImpl.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerImpl.java?rev=686881&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerImpl.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerImpl.java Mon Aug 18 15:11:14 2008
@@ -0,0 +1,92 @@
+package org.apache.jcs.engine.logging;
+
+import java.io.Serializable;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.engine.logging.behavior.ICacheEvent;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
+
+/**
+ * This implementation simple logs to a commons logger at debug level, for all events. It's mainly
+ * for testing. It isn't very useful otherwise.
+ */
+public class CacheEventLoggerDebugLoggerImpl
+ implements ICacheEventLogger
+{
+ /** This is the name of the category. */
+ private String logCategoryName = CacheEventLoggerDebugLoggerImpl.class.getName();
+
+ /** The logger. This is recreated on set logCategoryName */
+ private Log log = LogFactory.getLog( logCategoryName );
+
+ /**
+ * @param source
+ * @param region
+ * @param eventName
+ * @param optionalDetails
+ * @param key
+ * @return ICacheEvent
+ */
+ public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
+ Serializable key )
+ {
+ ICacheEvent event = new CacheEvent();
+ event.setSource( source );
+ event.setRegion( region );
+ event.setEventName( eventName );
+ event.setOptionalDetails( optionalDetails );
+ event.setKey( key );
+
+ return event;
+ }
+
+ /**
+ * @param source
+ * @param eventName
+ * @param optionalDetails
+ */
+ public void logApplicationEvent( String source, String eventName, String optionalDetails )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( source + " | " + eventName + " | " + optionalDetails );
+ }
+ }
+
+ /**
+ * @param source
+ * @param eventName
+ * @param errorMessage
+ */
+ public void logError( String source, String eventName, String errorMessage )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( source + " | " + eventName + " | " + errorMessage );
+ }
+ }
+
+ /**
+ * @param event
+ */
+ public void logICacheEvent( ICacheEvent event )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( event );
+ }
+ }
+
+ /**
+ * @param logCategoryName
+ */
+ public synchronized void setLogCategoryName( String logCategoryName )
+ {
+ if ( logCategoryName != null && !logCategoryName.equals( this.logCategoryName ) )
+ {
+ this.logCategoryName = logCategoryName;
+ log = LogFactory.getLog( logCategoryName );
+ }
+ }
+}
Added: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEvent.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEvent.java?rev=686881&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEvent.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEvent.java Mon Aug 18 15:11:14 2008
@@ -0,0 +1,58 @@
+package org.apache.jcs.engine.logging.behavior;
+
+import java.io.Serializable;
+
+/** Defines the common fields required by a cache event. */
+public interface ICacheEvent
+ extends Serializable
+{
+ /**
+ * @param source the source to set
+ */
+ public void setSource( String source );
+
+ /**
+ * @return the source
+ */
+ public String getSource();
+
+ /**
+ * @param region the region to set
+ */
+ public void setRegion( String region );
+
+ /**
+ * @return the region
+ */
+ public String getRegion();
+
+ /**
+ * @param eventName the eventName to set
+ */
+ public void setEventName( String eventName );
+
+ /**
+ * @return the eventName
+ */
+ public String getEventName();
+
+ /**
+ * @param optionalDetails the optionalDetails to set
+ */
+ public void setOptionalDetails( String optionalDetails );
+
+ /**
+ * @return the optionalDetails
+ */
+ public String getOptionalDetails();
+
+ /**
+ * @param key the key to set
+ */
+ public void setKey( Serializable key );
+
+ /**
+ * @return the key
+ */
+ public Serializable getKey();
+}
Copied: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java (from r685702, jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheEventLogger.java)
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java?p2=jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java&p1=jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheEventLogger.java&r1=685702&r2=686881&rev=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheEventLogger.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java Mon Aug 18 15:11:14 2008
@@ -1,4 +1,4 @@
-package org.apache.jcs.engine.behavior;
+package org.apache.jcs.engine.logging.behavior;
import java.io.Serializable;
@@ -29,58 +29,36 @@
/** ICache dispose */
static final String DISPOSE_EVENT = "dispose";
+ /** ICache enqueue. The time in the queue. */
+ //static final String ENQUEUE_EVENT = "enqueue";
/**
- * Logs an event. These are internal application events that do not correspond to ICache calls.
- * <p>
- * @param source - e.g. RemoteCacheServer
- * @param eventName - e.g. update, get, put, remove
- * @param optionalDetails - any extra message
- */
- void logApplicationEvent( String source, String eventName, String optionalDetails );
-
- /**
- * Logs an event.
+ * Creates an event.
* <p>
* @param source - e.g. RemoteCacheServer
* @param region - the name of the region
* @param eventName - e.g. update, get, put, remove
* @param optionalDetails - any extra message
* @param key - the cache key
+ * @return ICacheEvent
*/
- void logStartICacheEvent( String source, String region, String eventName, String optionalDetails, Serializable key );
-
- /**
- * Logs an event.
- * <p>
- * @param source - e.g. RemoteCacheServer
- * @param region - the name of the region
- * @param eventName - e.g. update, get, put, remove
- * @param optionalDetails - any extra message
- * @param item - the item being processed
- */
- void logStartICacheEvent( String source, String region, String eventName, String optionalDetails, ICacheElement item );
+ ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
+ Serializable key );
/**
* Logs an event.
* <p>
- * @param source - e.g. RemoteCacheServer
- * @param region - the name of the region
- * @param eventName - e.g. update, get, put, remove
- * @param optionalDetails - any extra message
- * @param key - the cache key
+ * @param event - the event created in createICacheEvent
*/
- void logEndICacheEvent( String source, String region, String eventName, String optionalDetails, Serializable key );
+ void logICacheEvent( ICacheEvent event );
/**
- * Logs an event.
+ * Logs an event. These are internal application events that do not correspond to ICache calls.
* <p>
* @param source - e.g. RemoteCacheServer
- * @param region - the name of the region
* @param eventName - e.g. update, get, put, remove
* @param optionalDetails - any extra message
- * @param item - the item being processed
*/
- void logEndICacheEvent( String source, String region, String eventName, String optionalDetails, ICacheElement item );
+ void logApplicationEvent( String source, String eventName, String optionalDetails );
/**
* Logs an error.
@@ -91,36 +69,4 @@
* @param errorMessage - any error message
*/
void logError( String source, String eventName, String errorMessage );
-
- /**
- * Logs an error.
- * <p>
- * @param source - e.g. RemoteCacheServer
- * @param region - the name of the region
- * @param eventName - e.g. update, get, put, remove
- * @param errorMessage - any error message
- */
- void logError( String source, String region, String eventName, String errorMessage );
-
- /**
- * Logs an error.
- * <p>
- * @param source - e.g. RemoteCacheServer
- * @param region - the name of the region
- * @param eventName - e.g. update, get, put, remove
- * @param errorMessage - any error message
- * @param item - the item being processed
- */
- void logError( String source, String region, String eventName, String errorMessage, ICacheElement item );
-
- /**
- * Logs an error.
- * <p>
- * @param source - e.g. RemoteCacheServer
- * @param region - the name of the region
- * @param eventName - e.g. update, get, put, remove
- * @param errorMessage - any error message
- * @param key - the cache key
- */
- void logError( String source, String region, String eventName, String errorMessage, Serializable key );
}
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/lru/LRUMemoryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/lru/LRUMemoryCache.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/lru/LRUMemoryCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/lru/LRUMemoryCache.java Mon Aug 18 15:11:14 2008
@@ -402,7 +402,7 @@
list.removeAll();
}
- // --------------------------- iteration mehods (iteration helpers)
+ // --------------------------- iteration methods (iteration helpers)
/**
* iteration aid
*/
Modified: jakarta/jcs/trunk/src/scripts/startRemoteCache.bat
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/scripts/startRemoteCache.bat?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/scripts/startRemoteCache.bat (original)
+++ jakarta/jcs/trunk/src/scripts/startRemoteCache.bat Mon Aug 18 15:11:14 2008
@@ -14,12 +14,15 @@
rem KIND, either express or implied. See the License for the
rem specific language governing permissions and limitations
rem under the License.
-@rem echo off
+@echo off
call prep.bat
:run
rem set DBUGPARM=-classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=5000,suspend=n
-%JAVA_HOME%\bin\java %DBUGPARM% -verbosegc -XX:+PrintTenuringDistribution -ms10m -mx200m -classpath %CLASSPATH% "-Djava.security.policy=%CURDIR%\src\conf\cache.policy" org.apache.jcs.auxiliary.remote.server.RemoteCacheServerFactory /remote.cache%1.ccf
+
+rem -XX:+PrintTenuringDistribution
+
+java %DBUGPARM% -verbosegc -ms10m -mx200m -classpath %CLASSPATH% "-Djava.security.policy=%CURDIR%\src\conf\cache.policy" org.apache.jcs.auxiliary.remote.server.RemoteCacheServerFactory /remote.cache%1.ccf
Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java?rev=686881&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java Mon Aug 18 15:11:14 2008
@@ -0,0 +1,109 @@
+package org.apache.jcs.auxiliary;
+
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.jcs.engine.control.MockCacheEventLogger;
+import org.apache.jcs.engine.control.MockElementSerializer;
+
+/** Unit tests for the auxiliary cache configurator. */
+public class AuxiliaryCacheConfiguratorUnitTest
+ extends TestCase
+{
+ /**
+ * Verify that we don't get an error.
+ */
+ public void testParseCacheEventLogger_Null()
+ {
+ // SETUP
+ Properties props = new Properties();
+
+ // DO WORK
+ MockCacheEventLogger result = (MockCacheEventLogger) AuxiliaryCacheConfigurator.parseCacheEventLogger( props,
+ "junk" );
+
+ // VERIFY
+ assertNull( "Should not have a logger.", result );
+ }
+
+ /**
+ * Verify that we don't get an error.
+ */
+ public void testParseCacheEventLogger_NullName()
+ {
+ // SETUP
+ Properties props = new Properties();
+
+ // DO WORK
+ MockCacheEventLogger result = (MockCacheEventLogger) AuxiliaryCacheConfigurator.parseCacheEventLogger( props,
+ null );
+
+ // VERIFY
+ assertNull( "Should not have a logger.", result );
+ }
+
+ /**
+ * Verify that we can parse the event logger.
+ */
+ public void testParseCacheEventLogger_Normal()
+ {
+ // SETUP
+ String auxPrefix = "jcs.auxiliary." + "MYAux";
+ String testPropertyValue = "This is the value";
+ String className = MockCacheEventLogger.class.getCanonicalName();
+
+ Properties props = new Properties();
+ props.put( auxPrefix + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX, className );
+ props.put( auxPrefix + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX
+ + AuxiliaryCacheConfigurator.ATTRIBUTE_PREFIX + ".testProperty", testPropertyValue );
+
+ // DO WORK
+ MockCacheEventLogger result = (MockCacheEventLogger) AuxiliaryCacheConfigurator
+ .parseCacheEventLogger( props, auxPrefix );
+
+ // VERIFY
+ assertNotNull( "Should have a logger.", result );
+ assertEquals( "Property should be set.", testPropertyValue, result.getTestProperty() );
+ }
+
+ /**
+ * Verify that we can parse the ElementSerializer.
+ */
+ public void testParseElementSerializer_Normal()
+ {
+ // SETUP
+ String auxPrefix = "jcs.auxiliary." + "MYAux";
+ String testPropertyValue = "This is the value";
+ String className = MockElementSerializer.class.getCanonicalName();
+
+ Properties props = new Properties();
+ props.put( auxPrefix + AuxiliaryCacheConfigurator.SERIALIZER_PREFIX, className );
+ props.put( auxPrefix + AuxiliaryCacheConfigurator.SERIALIZER_PREFIX
+ + AuxiliaryCacheConfigurator.ATTRIBUTE_PREFIX + ".testProperty", testPropertyValue );
+
+ // DO WORK
+ MockElementSerializer result = (MockElementSerializer) AuxiliaryCacheConfigurator
+ .parseElementSerializer( props, auxPrefix );
+
+ // VERIFY
+ assertNotNull( "Should have a logger.", result );
+ assertEquals( "Property should be set.", testPropertyValue, result.getTestProperty() );
+ }
+
+ /**
+ * Verify that we can parse the ElementSerializer.
+ */
+ public void testParseElementSerializer_Null()
+ {
+ // SETUP
+ Properties props = new Properties();
+
+ // DO WORK
+ MockElementSerializer result = (MockElementSerializer) AuxiliaryCacheConfigurator
+ .parseElementSerializer( props, "junk" );
+
+ // VERIFY
+ assertNull( "Should not have a logger.", result );
+ }
+}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java Mon Aug 18 15:11:14 2008
@@ -28,8 +28,8 @@
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.behavior.ICache;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheEventLogger;
import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
import org.apache.jcs.engine.stats.behavior.IStats;
/**
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java Mon Aug 18 15:11:14 2008
@@ -3,7 +3,9 @@
import java.io.Serializable;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheEventLogger;
+import org.apache.jcs.engine.logging.CacheEvent;
+import org.apache.jcs.engine.logging.behavior.ICacheEvent;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
* For testing auxiliary event logging. Improve later so we can test the details. This is very
@@ -35,27 +37,9 @@
}
/**
- * @param source
- * @param region
- * @param eventName
- * @param optionalDetails
- * @param key
- */
- public void logEndICacheEvent( String source, String region, String eventName, String optionalDetails,
- Serializable key )
- {
- endICacheEventCalls++;
- }
-
- /**
- * @param source
- * @param region
- * @param eventName
- * @param optionalDetails
- * @param item
+ * @param cacheEvent
*/
- public void logEndICacheEvent( String source, String region, String eventName, String optionalDetails,
- ICacheElement item )
+ public void logICacheEvent( ICacheEvent cacheEvent )
{
endICacheEventCalls++;
}
@@ -74,50 +58,15 @@
* @param source
* @param region
* @param eventName
- * @param errorMessage
- */
- public void logError( String source, String region, String eventName, String errorMessage )
- {
- errorEventCalls++;
- }
-
- /**
- * @param source
- * @param region
- * @param eventName
- * @param errorMessage
- * @param item
- */
- public void logError( String source, String region, String eventName, String errorMessage, ICacheElement item )
- {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * @param source
- * @param region
- * @param eventName
- * @param errorMessage
- * @param key
- */
- public void logError( String source, String region, String eventName, String errorMessage, Serializable key )
- {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * @param source
- * @param region
- * @param eventName
* @param optionalDetails
* @param key
+ * @return ICacheEvent
*/
- public void logStartICacheEvent( String source, String region, String eventName, String optionalDetails,
- Serializable key )
+ public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
+ Serializable key )
{
startICacheEventCalls++;
+ return new CacheEvent();
}
/**
@@ -126,10 +75,12 @@
* @param eventName
* @param optionalDetails
* @param item
+ * @return ICacheEvent
*/
- public void logStartICacheEvent( String source, String region, String eventName, String optionalDetails,
- ICacheElement item )
+ public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
+ ICacheElement item )
{
startICacheEventCalls++;
+ return new CacheEvent();
}
}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java Mon Aug 18 15:11:14 2008
@@ -34,8 +34,8 @@
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheEventLogger;
import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
import org.apache.jcs.engine.stats.behavior.IStats;
/**
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java Mon Aug 18 15:11:14 2008
@@ -65,6 +65,8 @@
/**
* returns the listener id, which can be setup.
+ * @return
+ * @throws IOException
*/
public long getListenerId()
throws IOException
@@ -80,6 +82,8 @@
/**
* Return the setup remoteType.
+ * @return
+ * @throws IOException
*/
public int getRemoteType()
throws IOException
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java Mon Aug 18 15:11:14 2008
@@ -61,8 +61,8 @@
/**
* Gets the remoteType attribute of the RemoteCacheClientTest object
- *
* @return The remoteType value
+ * @throws IOException
*/
public int getRemoteType()
throws IOException
@@ -72,7 +72,6 @@
/**
* Constructor for the RemoteCacheClientTest object
- *
* @param count
* @exception MalformedURLException
* @exception NotBoundException
@@ -86,7 +85,6 @@
/**
* Constructor for the RemoteCacheClientTest object
- *
* @param count
* @param write
* @param read
@@ -103,7 +101,6 @@
/**
* Constructor for the RemoteCacheClientTest object
- *
* @param host
* @param port
* @param count
@@ -197,28 +194,41 @@
}
}
- /** Description of the Method */
+ /**
+ * @param cb
+ * @throws IOException
+ */
public void handlePut( ICacheElement cb )
throws IOException
{
p( "handlePut> cb=" + cb );
}
- /** Description of the Method */
+ /**
+ * @param cacheName
+ * @param key
+ * @throws IOException
+ */
public void handleRemove( String cacheName, Serializable key )
throws IOException
{
p( "handleRemove> cacheName=" + cacheName + ", key=" + key );
}
- /** Description of the Method */
+ /**
+ * @param cacheName
+ * @throws IOException
+ */
public void handleRemoveAll( String cacheName )
throws IOException
{
p( "handleRemove> cacheName=" + cacheName );
}
- /** Description of the Method */
+ /**
+ * @param cacheName
+ * @throws IOException
+ */
public void handleDispose( String cacheName )
throws IOException
{
@@ -230,9 +240,7 @@
*/
/**
* The main program for the RemoteCacheClientTest class
- *
- * @param args
- * The command line arguments
+ * @param args The command line arguments
* @throws Exception
*/
public static void main( String[] args )
@@ -270,9 +278,8 @@
/**
* Sets the listenerId attribute of the RemoteCacheClientTest object
- *
- * @param id
- * The new listenerId value
+ * @param id The new listenerId value
+ * @throws IOException
*/
public void setListenerId( long id )
throws IOException
@@ -283,8 +290,8 @@
/**
* Gets the listenerId attribute of the RemoteCacheClientTest object
- *
* @return The listenerId value
+ * @throws IOException
*/
public long getListenerId()
throws IOException
@@ -292,7 +299,8 @@
return listenerId;
}
- /** Helper for output, this is an user run test class
+ /**
+ * Helper for output, this is an user run test class
* @param s
*/
private static void p( String s )
@@ -300,6 +308,10 @@
System.out.println( s );
}
+ /**
+ * @return null
+ * @throws IOException
+ */
public String getLocalHostAddress()
throws IOException
{
@@ -307,13 +319,12 @@
return null;
}
- /* (non-Javadoc)
- * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheListener#dispose()
+ /**
+ * @throws IOException
*/
public void dispose()
throws IOException
{
// TODO Auto-generated method stub
-
}
}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java Mon Aug 18 15:11:14 2008
@@ -9,94 +9,6 @@
extends TestCase
{
/**
- * Verify that we don't get an error.
- */
- public void testParseCacheEventLogger_Null()
- {
- // SETUP
- Properties props = new Properties();
-
- CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( CompositeCacheManager
- .getUnconfiguredInstance() );
-
- // DO WORK
- MockCacheEventLogger result = (MockCacheEventLogger) configurator.parseCacheEventLogger( props, "junk" );
-
- // VERIFY
- assertNull( "Should not have a logger.", result );
- }
-
- /**
- * Verify that we don't get an error.
- */
- public void testParseCacheEventLogger_NullName()
- {
- // SETUP
- Properties props = new Properties();
-
- CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( CompositeCacheManager
- .getUnconfiguredInstance() );
-
- // DO WORK
- MockCacheEventLogger result = (MockCacheEventLogger) configurator.parseCacheEventLogger( props, null );
-
- // VERIFY
- assertNull( "Should not have a logger.", result );
- }
-
- /**
- * Verify that we can parse the event logger.
- */
- public void testParseCacheEventLogger_Normal()
- {
- // SETUP
- String auxName = "MYAux";
- String testPropertyValue = "This is the value";
- String className = MockCacheEventLogger.class.getCanonicalName();
-
- Properties props = new Properties();
- props.put( "jcs.auxiliary." + auxName + CompositeCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX, className );
- props.put( "jcs.auxiliary." + auxName + CompositeCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX
- + CompositeCacheConfigurator.ATTRIBUTE_PREFIX + ".testProperty", testPropertyValue );
-
- CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( CompositeCacheManager
- .getUnconfiguredInstance() );
-
- // DO WORK
- MockCacheEventLogger result = (MockCacheEventLogger) configurator.parseCacheEventLogger( props, auxName );
-
- // VERIFY
- assertNotNull( "Should have a logger.", result );
- assertEquals( "Property should be set.", testPropertyValue, result.getTestProperty() );
- }
-
- /**
- * Verify that we can parse the ElementSerializer.
- */
- public void testParseElementSerializer_Normal()
- {
- // SETUP
- String auxName = "MYAux";
- String testPropertyValue = "This is the value";
- String className = MockElementSerializer.class.getCanonicalName();
-
- Properties props = new Properties();
- props.put( "jcs.auxiliary." + auxName + CompositeCacheConfigurator.SERIALIZER_PREFIX, className );
- props.put( "jcs.auxiliary." + auxName + CompositeCacheConfigurator.SERIALIZER_PREFIX
- + CompositeCacheConfigurator.ATTRIBUTE_PREFIX + ".testProperty", testPropertyValue );
-
- CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( CompositeCacheManager
- .getUnconfiguredInstance() );
-
- // DO WORK
- MockElementSerializer result = (MockElementSerializer) configurator.parseElementSerializer( props, auxName );
-
- // VERIFY
- assertNotNull( "Should have a logger.", result );
- assertEquals( "Property should be set.", testPropertyValue, result.getTestProperty() );
- }
-
- /**
* Verify that we can parse the ElementSerializer.
*/
public void testParseElementSerializer_Null()
@@ -108,9 +20,9 @@
.getUnconfiguredInstance() );
// DO WORK
- MockElementSerializer result = (MockElementSerializer) configurator.parseElementSerializer( props, "junk" );
+ //MockElementSerializer result = (MockElementSerializer) configurator.parseElementSerializer( props, "junk" );
// VERIFY
- assertNull( "Should not have a logger.", result );
+ //assertNull( "Should not have a logger.", result );
}
}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java Mon Aug 18 15:11:14 2008
@@ -35,10 +35,10 @@
import org.apache.jcs.engine.CompositeCacheAttributes;
import org.apache.jcs.engine.ElementAttributes;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheEventLogger;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.behavior.IElementSerializer;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
import org.apache.jcs.engine.stats.behavior.IStats;
/**
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCacheEventLogger.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCacheEventLogger.java?rev=686881&r1=686880&r2=686881&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCacheEventLogger.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCacheEventLogger.java Mon Aug 18 15:11:14 2008
@@ -3,7 +3,9 @@
import java.io.Serializable;
import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheEventLogger;
+import org.apache.jcs.engine.logging.CacheEvent;
+import org.apache.jcs.engine.logging.behavior.ICacheEvent;
+import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
/**
* For testing the configurator.
@@ -26,32 +28,6 @@
/**
* @param source
- * @param region
- * @param eventName
- * @param optionalDetails
- * @param key
- */
- public void logEndICacheEvent( String source, String region, String eventName, String optionalDetails,
- Serializable key )
- {
- // TODO Auto-generated method stub
- }
-
- /**
- * @param source
- * @param region
- * @param eventName
- * @param optionalDetails
- * @param item
- */
- public void logEndICacheEvent( String source, String region, String eventName, String optionalDetails,
- ICacheElement item )
- {
- // TODO Auto-generated method stub
- }
-
- /**
- * @param source
* @param eventName
* @param errorMessage
*/
@@ -64,35 +40,14 @@
* @param source
* @param region
* @param eventName
- * @param errorMessage
- */
- public void logError( String source, String region, String eventName, String errorMessage )
- {
- // TODO Auto-generated method stub
- }
-
- /**
- * @param source
- * @param region
- * @param eventName
- * @param errorMessage
- * @param item
- */
- public void logError( String source, String region, String eventName, String errorMessage, ICacheElement item )
- {
- // TODO Auto-generated method stub
- }
-
- /**
- * @param source
- * @param region
- * @param eventName
- * @param errorMessage
+ * @param optionalDetails
* @param key
+ * @return ICacheEvent
*/
- public void logError( String source, String region, String eventName, String errorMessage, Serializable key )
+ public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
+ Serializable key )
{
- // TODO Auto-generated method stub
+ return new CacheEvent();
}
/**
@@ -100,25 +55,21 @@
* @param region
* @param eventName
* @param optionalDetails
- * @param key
+ * @param item
+ * @return ICacheEvent
*/
- public void logStartICacheEvent( String source, String region, String eventName, String optionalDetails,
- Serializable key )
+ public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
+ ICacheElement item )
{
- // TODO Auto-generated method stub
+ return new CacheEvent();
}
/**
- * @param source
- * @param region
- * @param eventName
- * @param optionalDetails
- * @param item
+ * @param event
*/
- public void logStartICacheEvent( String source, String region, String eventName, String optionalDetails,
- ICacheElement item )
+ public void logICacheEvent( ICacheEvent event )
{
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org
|