commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1570993 [8/24] - in /commons/proper/jcs/trunk/src: assembly/ changes/ conf/ java/org/apache/commons/jcs/access/ java/org/apache/commons/jcs/access/exception/ java/org/apache/commons/jcs/admin/ java/org/apache/commons/jcs/auxiliary/ java/or...
Date Sun, 23 Feb 2014 10:37:52 GMT
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheMonitor.java Sun Feb 23 10:37:48 2014
@@ -1,247 +1,247 @@
-package org.apache.commons.jcs.auxiliary.remote.http.client;
-
-/*
- * 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;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.commons.jcs.auxiliary.remote.http.client.behavior.IRemoteHttpCacheClient;
-import org.apache.commons.jcs.engine.CacheStatus;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Upon the notification of a connection error, the monitor changes to operate in a time driven
- * mode. That is, it attempts to recover the connections on a periodic basis. When all failed
- * connections are restored, it changes back to the failure driven mode.
- */
-public class RemoteHttpCacheMonitor
-    implements Runnable
-{
-    /** The logger */
-    private final static Log log = LogFactory.getLog( RemoteHttpCacheMonitor.class );
-
-    /** The remote cache that we are monitoring */
-    private static RemoteHttpCacheMonitor instance;
-
-    /** Time between checks */
-    private static long idlePeriod = 3 * 1000;
-
-    /** Set of remote caches to monitor. This are added on error, if not before. */
-    private final Set<RemoteHttpCache<?, ?>> remoteHttpCaches = new HashSet<RemoteHttpCache<?, ?>>();
-
-    /**
-     * Must make sure RemoteCacheMonitor is started before any remote error can be detected!
-     */
-    private boolean alright = true;
-
-    /** Time driven mode */
-    final static int TIME = 0;
-
-    /** Error driven mode -- only check on health if there is an error */
-    final static int ERROR = 1;
-
-    /** The mode to use */
-    static int mode = ERROR;
-
-    /**
-     * Configures the idle period between repairs.
-     * <p>
-     * @param idlePeriod The new idlePeriod value
-     */
-    public static void setIdlePeriod( long idlePeriod )
-    {
-        if ( idlePeriod > RemoteHttpCacheMonitor.idlePeriod )
-        {
-            RemoteHttpCacheMonitor.idlePeriod = idlePeriod;
-        }
-    }
-
-    /** Constructor for the RemoteCacheMonitor object */
-    private RemoteHttpCacheMonitor()
-    {
-        super();
-    }
-
-    /**
-     * Returns the singleton instance.
-     * <p>
-     * @return The instance value
-     */
-    static RemoteHttpCacheMonitor getInstance()
-    {
-        synchronized ( RemoteHttpCacheMonitor.class )
-        {
-            if ( instance == null )
-            {
-                return instance = new RemoteHttpCacheMonitor();
-            }
-        }
-        return instance;
-    }
-
-    /**
-     * Notifies the cache monitor that an error occurred, and kicks off the error recovery process.
-     * <p>
-     * @param remoteCache
-     */
-    public void notifyError( RemoteHttpCache<?, ?> remoteCache )
-    {
-        if ( log.isInfoEnabled() )
-        {
-            log.info( "Notified of an error. " + remoteCache );
-        }
-        bad();
-        synchronized ( this )
-        {
-            remoteHttpCaches.add( remoteCache );
-            notify();
-        }
-    }
-
-    // Run forever.
-
-    // Avoid the use of any synchronization in the process of monitoring for
-    // performance reasons.
-    // If exception is thrown owing to synchronization,
-    // just skip the monitoring until the next round.
-    /** Main processing method for the RemoteCacheMonitor object */
-    public void run()
-    {
-        if ( log.isInfoEnabled() )
-        {
-            log.info( "Monitoring daemon started" );
-        }
-        do
-        {
-            if ( mode == ERROR )
-            {
-                synchronized ( this )
-                {
-                    if ( alright )
-                    {
-                        // make this configurable, comment out wait to enter
-                        // time driven mode
-                        // Failure driven mode.
-                        try
-                        {
-                            if ( log.isDebugEnabled() )
-                            {
-                                log.debug( "FAILURE DRIVEN MODE: cache monitor waiting for error" );
-                            }
-                            wait();
-                            // wake up only if there is an error.
-                        }
-                        catch ( InterruptedException ignore )
-                        {
-                            // swallow
-                        }
-                    }
-                }
-            }
-            else
-            {
-                if ( log.isDebugEnabled() )
-                {
-                    log.debug( "TIME DRIVEN MODE: cache monitor sleeping for " + idlePeriod );
-                }
-                // Time driven mode: sleep between each round of recovery
-                // attempt.
-                // will need to test not just check status
-            }
-
-            try
-            {
-                Thread.sleep( idlePeriod );
-            }
-            catch ( InterruptedException ex )
-            {
-                // ignore;
-            }
-
-            // The "allright" flag must be false here.
-            // Simply presume we can fix all the errors until proven otherwise.
-            synchronized ( this )
-            {
-                alright = true;
-            }
-
-            // Make a copy
-            Set<RemoteHttpCache<? extends Serializable, ? extends Serializable>> remoteCachesToExamine =
-                new HashSet<RemoteHttpCache<? extends Serializable, ? extends Serializable>>();
-            synchronized ( this )
-            {
-                for (RemoteHttpCache<? extends Serializable, ? extends Serializable> remoteCache : this.remoteHttpCaches)
-                {
-                    remoteCachesToExamine.add( remoteCache );
-                }
-            }
-            // If any cache is in error, it strongly suggests all caches
-            // managed by the
-            // same RmicCacheManager instance are in error. So we fix
-            // them once and for all.
-            for (RemoteHttpCache<? extends Serializable, ? extends Serializable> remoteCache : remoteCachesToExamine)
-            {
-                try
-                {
-                    if ( remoteCache.getStatus() == CacheStatus.ERROR )
-                    {
-                        RemoteHttpCacheAttributes attributes = remoteCache.getRemoteHttpCacheAttributes();
-
-                        IRemoteHttpCacheClient<Serializable, Serializable> remoteService = RemoteHttpCacheManager.getInstance()
-                            .createRemoteHttpCacheClientForAttributes( attributes );
-
-                        if ( log.isInfoEnabled() )
-                        {
-                            log.info( "Performing Alive check on service " + remoteService );
-                        }
-                        // If we can't fix them, just skip and re-try in
-                        // the next round.
-                        if ( remoteService.isAlive() )
-                        {
-                            remoteCache.fixCache( remoteService );
-                        }
-                        else
-                        {
-                            bad();
-                        }
-                        break;
-                    }
-                }
-                catch ( Exception ex )
-                {
-                    bad();
-                    // Problem encountered in fixing the caches managed by a
-                    // RemoteCacheManager instance.
-                    // Soldier on to the next RemoteHttpCache.
-                    log.error( ex );
-                }
-            }
-        }
-        while ( true );
-    }
-
-    /** Sets the "aright" flag to false in a critical section. */
-    private synchronized void bad()
-    {
-        alright = false;
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.client;
+
+/*
+ * 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;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.jcs.auxiliary.remote.http.client.behavior.IRemoteHttpCacheClient;
+import org.apache.commons.jcs.engine.CacheStatus;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Upon the notification of a connection error, the monitor changes to operate in a time driven
+ * mode. That is, it attempts to recover the connections on a periodic basis. When all failed
+ * connections are restored, it changes back to the failure driven mode.
+ */
+public class RemoteHttpCacheMonitor
+    implements Runnable
+{
+    /** The logger */
+    private final static Log log = LogFactory.getLog( RemoteHttpCacheMonitor.class );
+
+    /** The remote cache that we are monitoring */
+    private static RemoteHttpCacheMonitor instance;
+
+    /** Time between checks */
+    private static long idlePeriod = 3 * 1000;
+
+    /** Set of remote caches to monitor. This are added on error, if not before. */
+    private final Set<RemoteHttpCache<?, ?>> remoteHttpCaches = new HashSet<RemoteHttpCache<?, ?>>();
+
+    /**
+     * Must make sure RemoteCacheMonitor is started before any remote error can be detected!
+     */
+    private boolean alright = true;
+
+    /** Time driven mode */
+    final static int TIME = 0;
+
+    /** Error driven mode -- only check on health if there is an error */
+    final static int ERROR = 1;
+
+    /** The mode to use */
+    static int mode = ERROR;
+
+    /**
+     * Configures the idle period between repairs.
+     * <p>
+     * @param idlePeriod The new idlePeriod value
+     */
+    public static void setIdlePeriod( long idlePeriod )
+    {
+        if ( idlePeriod > RemoteHttpCacheMonitor.idlePeriod )
+        {
+            RemoteHttpCacheMonitor.idlePeriod = idlePeriod;
+        }
+    }
+
+    /** Constructor for the RemoteCacheMonitor object */
+    private RemoteHttpCacheMonitor()
+    {
+        super();
+    }
+
+    /**
+     * Returns the singleton instance.
+     * <p>
+     * @return The instance value
+     */
+    static RemoteHttpCacheMonitor getInstance()
+    {
+        synchronized ( RemoteHttpCacheMonitor.class )
+        {
+            if ( instance == null )
+            {
+                return instance = new RemoteHttpCacheMonitor();
+            }
+        }
+        return instance;
+    }
+
+    /**
+     * Notifies the cache monitor that an error occurred, and kicks off the error recovery process.
+     * <p>
+     * @param remoteCache
+     */
+    public void notifyError( RemoteHttpCache<?, ?> remoteCache )
+    {
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Notified of an error. " + remoteCache );
+        }
+        bad();
+        synchronized ( this )
+        {
+            remoteHttpCaches.add( remoteCache );
+            notify();
+        }
+    }
+
+    // Run forever.
+
+    // Avoid the use of any synchronization in the process of monitoring for
+    // performance reasons.
+    // If exception is thrown owing to synchronization,
+    // just skip the monitoring until the next round.
+    /** Main processing method for the RemoteCacheMonitor object */
+    public void run()
+    {
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Monitoring daemon started" );
+        }
+        do
+        {
+            if ( mode == ERROR )
+            {
+                synchronized ( this )
+                {
+                    if ( alright )
+                    {
+                        // make this configurable, comment out wait to enter
+                        // time driven mode
+                        // Failure driven mode.
+                        try
+                        {
+                            if ( log.isDebugEnabled() )
+                            {
+                                log.debug( "FAILURE DRIVEN MODE: cache monitor waiting for error" );
+                            }
+                            wait();
+                            // wake up only if there is an error.
+                        }
+                        catch ( InterruptedException ignore )
+                        {
+                            // swallow
+                        }
+                    }
+                }
+            }
+            else
+            {
+                if ( log.isDebugEnabled() )
+                {
+                    log.debug( "TIME DRIVEN MODE: cache monitor sleeping for " + idlePeriod );
+                }
+                // Time driven mode: sleep between each round of recovery
+                // attempt.
+                // will need to test not just check status
+            }
+
+            try
+            {
+                Thread.sleep( idlePeriod );
+            }
+            catch ( InterruptedException ex )
+            {
+                // ignore;
+            }
+
+            // The "allright" flag must be false here.
+            // Simply presume we can fix all the errors until proven otherwise.
+            synchronized ( this )
+            {
+                alright = true;
+            }
+
+            // Make a copy
+            Set<RemoteHttpCache<? extends Serializable, ? extends Serializable>> remoteCachesToExamine =
+                new HashSet<RemoteHttpCache<? extends Serializable, ? extends Serializable>>();
+            synchronized ( this )
+            {
+                for (RemoteHttpCache<? extends Serializable, ? extends Serializable> remoteCache : this.remoteHttpCaches)
+                {
+                    remoteCachesToExamine.add( remoteCache );
+                }
+            }
+            // If any cache is in error, it strongly suggests all caches
+            // managed by the
+            // same RmicCacheManager instance are in error. So we fix
+            // them once and for all.
+            for (RemoteHttpCache<? extends Serializable, ? extends Serializable> remoteCache : remoteCachesToExamine)
+            {
+                try
+                {
+                    if ( remoteCache.getStatus() == CacheStatus.ERROR )
+                    {
+                        RemoteHttpCacheAttributes attributes = remoteCache.getRemoteHttpCacheAttributes();
+
+                        IRemoteHttpCacheClient<Serializable, Serializable> remoteService = RemoteHttpCacheManager.getInstance()
+                            .createRemoteHttpCacheClientForAttributes( attributes );
+
+                        if ( log.isInfoEnabled() )
+                        {
+                            log.info( "Performing Alive check on service " + remoteService );
+                        }
+                        // If we can't fix them, just skip and re-try in
+                        // the next round.
+                        if ( remoteService.isAlive() )
+                        {
+                            remoteCache.fixCache( remoteService );
+                        }
+                        else
+                        {
+                            bad();
+                        }
+                        break;
+                    }
+                }
+                catch ( Exception ex )
+                {
+                    bad();
+                    // Problem encountered in fixing the caches managed by a
+                    // RemoteCacheManager instance.
+                    // Soldier on to the next RemoteHttpCache.
+                    log.error( ex );
+                }
+            }
+        }
+        while ( true );
+    }
+
+    /** Sets the "aright" flag to false in a critical section. */
+    private synchronized void bad()
+    {
+        alright = false;
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java Sun Feb 23 10:37:48 2014
@@ -1,54 +1,54 @@
-package org.apache.commons.jcs.auxiliary.remote.http.client;
-
-/*
- * 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;
-
-import org.apache.commons.jcs.auxiliary.remote.AbstractRemoteCacheListener;
-import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
-
-/** Does nothing */
-public class RemoteHttpClientListener<K extends Serializable, V extends Serializable>
-    extends AbstractRemoteCacheListener<K, V>
-{
-    /** TODO serialVersionUID */
-    private static final long serialVersionUID = -9078366610772128010L;
-
-    /**
-     * Only need one since it does work for all regions, just reference by multiple region names.
-     * <p>
-     * The constructor exports this object, making it available to receive incoming calls. The
-     * callback port is anonymous unless a local port value was specified in the configuration.
-     * <p>
-     * @param irca
-     * @param cacheMgr
-     */
-    public RemoteHttpClientListener( IRemoteCacheAttributes irca, ICompositeCacheManager cacheMgr )
-    {
-        super( irca, cacheMgr );
-    }
-
-    /** Nothing */
-    public void dispose()
-    {
-        // noop
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.client;
+
+/*
+ * 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;
+
+import org.apache.commons.jcs.auxiliary.remote.AbstractRemoteCacheListener;
+import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
+import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
+
+/** Does nothing */
+public class RemoteHttpClientListener<K extends Serializable, V extends Serializable>
+    extends AbstractRemoteCacheListener<K, V>
+{
+    /** TODO serialVersionUID */
+    private static final long serialVersionUID = -9078366610772128010L;
+
+    /**
+     * Only need one since it does work for all regions, just reference by multiple region names.
+     * <p>
+     * The constructor exports this object, making it available to receive incoming calls. The
+     * callback port is anonymous unless a local port value was specified in the configuration.
+     * <p>
+     * @param irca
+     * @param cacheMgr
+     */
+    public RemoteHttpClientListener( IRemoteCacheAttributes irca, ICompositeCacheManager cacheMgr )
+    {
+        super( irca, cacheMgr );
+    }
+
+    /** Nothing */
+    public void dispose()
+    {
+        // noop
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/behavior/IRemoteHttpCacheClient.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/behavior/IRemoteHttpCacheClient.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/behavior/IRemoteHttpCacheClient.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/behavior/IRemoteHttpCacheClient.java Sun Feb 23 10:37:48 2014
@@ -1,51 +1,52 @@
-package org.apache.commons.jcs.auxiliary.remote.http.client.behavior;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-import org.apache.commons.jcs.auxiliary.remote.http.client.RemoteHttpCacheAttributes;
-import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
-
-/*
- * 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.
- */
-
-/**
- * It's not entirely clear that this interface is needed. I simply wanted the initialization method.
- * This could be added to the ICacheSerice method.
- */
-public interface IRemoteHttpCacheClient<K extends Serializable, V extends Serializable>
-    extends ICacheServiceNonLocal<K, V>
-{
-    /**
-     * The provides an extension point. If you want to extend this and use a special dispatcher,
-     * here is the place to do it.
-     * <p>
-     * @param attributes
-     */
-    void initialize( RemoteHttpCacheAttributes attributes );
-
-    /**
-     * Make and alive request.
-     * <p>
-     * @return true if we make a successful alive request.
-     * @throws IOException
-     */
-    boolean isAlive()
-        throws IOException;
-}
\ No newline at end of file
+package org.apache.commons.jcs.auxiliary.remote.http.client.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.IOException;
+import java.io.Serializable;
+
+import org.apache.commons.jcs.auxiliary.remote.http.client.RemoteHttpCacheAttributes;
+import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
+
+
+/**
+ * It's not entirely clear that this interface is needed. I simply wanted the initialization method.
+ * This could be added to the ICacheSerice method.
+ */
+public interface IRemoteHttpCacheClient<K extends Serializable, V extends Serializable>
+    extends ICacheServiceNonLocal<K, V>
+{
+    /**
+     * The provides an extension point. If you want to extend this and use a special dispatcher,
+     * here is the place to do it.
+     * <p>
+     * @param attributes
+     */
+    void initialize( RemoteHttpCacheAttributes attributes );
+
+    /**
+     * Make and alive request.
+     * <p>
+     * @return true if we make a successful alive request.
+     * @throws IOException
+     */
+    boolean isAlive()
+        throws IOException;
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java Sun Feb 23 10:37:48 2014
@@ -1,590 +1,590 @@
-package org.apache.commons.jcs.auxiliary.remote.http.server;
-
-/*
- * 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.IOException;
-import java.io.Serializable;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
-import org.apache.commons.jcs.engine.control.CompositeCache;
-import org.apache.commons.jcs.engine.control.CompositeCacheManager;
-import org.apache.commons.jcs.engine.logging.CacheEvent;
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent;
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * This class contains common methods for remote cache services. Eventually I hope to extract out
- * much of the RMI server to use this as well. I'm starting with the Http service.
- */
-public abstract class AbstractRemoteCacheService<K extends Serializable, V extends Serializable>
-    implements ICacheServiceNonLocal<K, V>
-{
-    /** An optional event logger */
-    private transient ICacheEventLogger cacheEventLogger;
-
-    /** The central hub */
-    private ICompositeCacheManager cacheManager;
-
-    /** Name of the event log source. */
-    private String eventLogSourceName = "AbstractRemoteCacheService";
-
-    /** Number of puts into the cache. */
-    private int puts = 0;
-
-    /** The interval at which we will log updates. */
-    private final int logInterval = 100;
-
-    /** log instance */
-    private final static Log log = LogFactory.getLog( AbstractRemoteCacheService.class );
-
-    /**
-     * Creates the super with the needed items.
-     * <p>
-     * @param cacheManager
-     * @param cacheEventLogger
-     */
-    public AbstractRemoteCacheService( ICompositeCacheManager cacheManager, ICacheEventLogger cacheEventLogger )
-    {
-        this.cacheManager = cacheManager;
-        this.cacheEventLogger = cacheEventLogger;
-    }
-
-    /**
-     * @param item
-     * @throws IOException
-     */
-    public void update( ICacheElement<K, V> item )
-        throws IOException
-    {
-        update( item, 0 );
-    }
-
-    /**
-     * The internal processing is wrapped in event logging calls.
-     * <p>
-     * @param item
-     * @param requesterId
-     * @throws IOException
-     */
-    public void update( ICacheElement<K, V> item, long requesterId )
-        throws IOException
-    {
-        ICacheEvent<ICacheElement<K, V>> cacheEvent = createICacheEvent( item, requesterId, ICacheEventLogger.UPDATE_EVENT );
-        try
-        {
-            logUpdateInfo( item );
-
-            processUpdate( item, requesterId );
-        }
-        finally
-        {
-            logICacheEvent( cacheEvent );
-        }
-    }
-
-    /**
-     * The internal processing is wrapped in event logging calls.
-     * <p>
-     * @param item
-     * @param requesterId
-     * @throws IOException
-     */
-    abstract void processUpdate( ICacheElement<K, V> item, long requesterId )
-        throws IOException;
-
-    /**
-     * Log some details.
-     * <p>
-     * @param item
-     */
-    private void logUpdateInfo( ICacheElement<K, V> item )
-    {
-        if ( log.isInfoEnabled() )
-        {
-            // not thread safe, but it doesn't have to be accurate
-            puts++;
-            if ( puts % logInterval == 0 )
-            {
-                log.info( "puts = " + puts );
-            }
-        }
-
-        if ( log.isDebugEnabled() )
-        {
-            log.debug( "In update, put [" + item.getKey() + "] in [" + item.getCacheName() + "]" );
-        }
-    }
-
-    /**
-     * Returns a cache value from the specified remote cache; or null if the cache or key does not
-     * exist.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @return ICacheElement
-     * @throws IOException
-     */
-    public ICacheElement<K, V> get( String cacheName, K key )
-        throws IOException
-    {
-        return this.get( cacheName, key, 0 );
-    }
-
-    /**
-     * Returns a cache bean from the specified cache; or null if the key does not exist.
-     * <p>
-     * Adding the requestor id, allows the cache to determine the source of the get.
-     * <p>
-     * The internal processing is wrapped in event logging calls.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @param requesterId
-     * @return ICacheElement
-     * @throws IOException
-     */
-    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
-        throws IOException
-    {
-        ICacheElement<K, V> element = null;
-        ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.GET_EVENT );
-        try
-        {
-            element = processGet( cacheName, key, requesterId );
-        }
-        finally
-        {
-            logICacheEvent( cacheEvent );
-        }
-        return element;
-    }
-
-    /**
-     * Returns a cache bean from the specified cache; or null if the key does not exist.
-     * <p>
-     * Adding the requestor id, allows the cache to determine the source of the get.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @param requesterId
-     * @return ICacheElement
-     * @throws IOException
-     */
-    abstract ICacheElement<K, V> processGet( String cacheName, K key, long requesterId )
-        throws IOException;
-
-    /**
-     * Gets all matching items.
-     * <p>
-     * @param cacheName
-     * @param pattern
-     * @return Map of keys and wrapped objects
-     * @throws IOException
-     */
-    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
-        throws IOException
-    {
-        return getMatching( cacheName, pattern, 0 );
-    }
-
-    /**
-     * Retrieves all matching keys.
-     * <p>
-     * @param cacheName
-     * @param pattern
-     * @param requesterId
-     * @return Map of keys and wrapped objects
-     * @throws IOException
-     */
-    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
-        throws IOException
-    {
-        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, pattern, requesterId,
-                                                    ICacheEventLogger.GETMATCHING_EVENT );
-        try
-        {
-            return processGetMatching( cacheName, pattern, requesterId );
-        }
-        finally
-        {
-            logICacheEvent( cacheEvent );
-        }
-    }
-
-    /**
-     * Retrieves all matching keys.
-     * <p>
-     * @param cacheName
-     * @param pattern
-     * @param requesterId
-     * @return Map of keys and wrapped objects
-     * @throws IOException
-     */
-    abstract Map<K, ICacheElement<K, V>> processGetMatching( String cacheName, String pattern, long requesterId )
-        throws IOException;
-
-    /**
-     * Gets multiple items from the cache based on the given set of keys.
-     * <p>
-     * @param cacheName
-     * @param keys
-     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
-     *         data in cache for any of these keys
-     * @throws IOException
-     */
-    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
-        throws IOException
-    {
-        return this.getMultiple( cacheName, keys, 0 );
-    }
-
-    /**
-     * Gets multiple items from the cache based on the given set of keys.
-     * <p>
-     * The internal processing is wrapped in event logging calls.
-     * <p>
-     * @param cacheName
-     * @param keys
-     * @param requesterId
-     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
-     *         data in cache for any of these keys
-     * @throws IOException
-     */
-    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
-        throws IOException
-    {
-        ICacheEvent<Serializable> cacheEvent = createICacheEvent( cacheName, (Serializable) keys, requesterId,
-                                                    ICacheEventLogger.GETMULTIPLE_EVENT );
-        try
-        {
-            return processGetMultiple( cacheName, keys, requesterId );
-        }
-        finally
-        {
-            logICacheEvent( cacheEvent );
-        }
-    }
-
-    /**
-     * Gets multiple items from the cache based on the given set of keys.
-     * <p>
-     * @param cacheName
-     * @param keys
-     * @param requesterId
-     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
-     *         data in cache for any of these keys
-     * @throws IOException
-     */
-    abstract Map<K, ICacheElement<K, V>> processGetMultiple( String cacheName, Set<K> keys, long requesterId )
-        throws IOException;
-
-    /**
-     * Return the keys in this cache.
-     * <p>
-     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
-     */
-    public Set<K> getKeySet( String cacheName )
-    {
-        return processGetKeySet( cacheName );
-    }
-
-    /**
-     * Gets the set of keys of objects currently in the cache.
-     * <p>
-     * @param cacheName
-     * @return Set
-     */
-    public Set<K> processGetKeySet( String cacheName )
-    {
-        CompositeCache<K, V> cache = getCacheManager().getCache( cacheName );
-
-        return cache.getKeySet();
-    }
-
-    /**
-     * Removes the given key from the specified remote cache. Defaults the listener id to 0.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @throws IOException
-     */
-    public void remove( String cacheName, K key )
-        throws IOException
-    {
-        remove( cacheName, key, 0 );
-    }
-
-    /**
-     * Remove the key from the cache region and don't tell the source listener about it.
-     * <p>
-     * The internal processing is wrapped in event logging calls.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @param requesterId
-     * @throws IOException
-     */
-    public void remove( String cacheName, K key, long requesterId )
-        throws IOException
-    {
-        ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.REMOVE_EVENT );
-        try
-        {
-            processRemove( cacheName, key, requesterId );
-        }
-        finally
-        {
-            logICacheEvent( cacheEvent );
-        }
-    }
-
-    /**
-     * Remove the key from the cache region and don't tell the source listener about it.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @param requesterId
-     * @throws IOException
-     */
-    abstract void processRemove( String cacheName, K key, long requesterId )
-        throws IOException;
-
-    /**
-     * Remove all keys from the specified remote cache.
-     * <p>
-     * @param cacheName
-     * @throws IOException
-     */
-    public void removeAll( String cacheName )
-        throws IOException
-    {
-        removeAll( cacheName, 0 );
-    }
-
-    /**
-     * Remove all keys from the specified remote cache.
-     * <p>
-     * The internal processing is wrapped in event logging calls.
-     * <p>
-     * @param cacheName
-     * @param requesterId
-     * @throws IOException
-     */
-    public void removeAll( String cacheName, long requesterId )
-        throws IOException
-    {
-        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, "all", requesterId, ICacheEventLogger.REMOVEALL_EVENT );
-        try
-        {
-            processRemoveAll( cacheName, requesterId );
-        }
-        finally
-        {
-            logICacheEvent( cacheEvent );
-        }
-    }
-
-    /**
-     * Remove all keys from the specified remote cache.
-     * <p>
-     * @param cacheName
-     * @param requesterId
-     * @throws IOException
-     */
-    abstract void processRemoveAll( String cacheName, long requesterId )
-        throws IOException;
-
-    /**
-     * Frees the specified remote cache.
-     * <p>
-     * @param cacheName
-     * @throws IOException
-     */
-    public void dispose( String cacheName )
-        throws IOException
-    {
-        dispose( cacheName, 0 );
-    }
-
-    /**
-     * Frees the specified remote cache.
-     * <p>
-     * @param cacheName
-     * @param requesterId
-     * @throws IOException
-     */
-    public void dispose( String cacheName, long requesterId )
-        throws IOException
-    {
-        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, "none", requesterId, ICacheEventLogger.DISPOSE_EVENT );
-        try
-        {
-            processDispose( cacheName, requesterId );
-        }
-        finally
-        {
-            logICacheEvent( cacheEvent );
-        }
-    }
-
-    /**
-     * @param cacheName
-     * @param requesterId
-     * @throws IOException
-     */
-    abstract void processDispose( String cacheName, long requesterId )
-        throws IOException;
-
-    /**
-     * Gets the stats attribute of the RemoteCacheServer object.
-     * <p>
-     * @return The stats value
-     * @throws IOException
-     */
-    public String getStats()
-        throws IOException
-    {
-        return cacheManager.getStats();
-    }
-
-    /**
-     * Logs an event if an event logger is configured.
-     * <p>
-     * @param item
-     * @param requesterId
-     * @param eventName
-     * @return ICacheEvent
-     */
-    protected ICacheEvent<ICacheElement<K, V>> createICacheEvent( ICacheElement<K, V> item, long requesterId, String eventName )
-    {
-        if ( cacheEventLogger == null )
-        {
-            return new CacheEvent<ICacheElement<K, V>>();
-        }
-        String ipAddress = getExtraInfoForRequesterId( requesterId );
-        return cacheEventLogger.createICacheEvent( getEventLogSourceName(), item.getCacheName(), eventName, ipAddress,
-                                                   item );
-    }
-
-    /**
-     * Logs an event if an event logger is configured.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @param requesterId
-     * @param eventName
-     * @return ICacheEvent
-     */
-    protected <T extends Serializable> ICacheEvent<T> createICacheEvent( String cacheName, T key, long requesterId, String eventName )
-    {
-        if ( cacheEventLogger == null )
-        {
-            return new CacheEvent<T>();
-        }
-        String ipAddress = getExtraInfoForRequesterId( requesterId );
-        return cacheEventLogger.createICacheEvent( getEventLogSourceName(), cacheName, eventName, ipAddress, key );
-    }
-
-    /**
-     * Logs an event if an event logger is configured.
-     * <p>
-     * @param source
-     * @param eventName
-     * @param optionalDetails
-     */
-    protected void logApplicationEvent( String source, String eventName, String optionalDetails )
-    {
-        if ( cacheEventLogger != null )
-        {
-            cacheEventLogger.logApplicationEvent( source, eventName, optionalDetails );
-        }
-    }
-
-    /**
-     * Logs an event if an event logger is configured.
-     * <p>
-     * @param cacheEvent
-     */
-    protected <T extends Serializable> void logICacheEvent( ICacheEvent<T> cacheEvent )
-    {
-        if ( cacheEventLogger != null )
-        {
-            cacheEventLogger.logICacheEvent( cacheEvent );
-        }
-    }
-
-    /**
-     * Ip address for the client, if one is stored.
-     * <p>
-     * Protected for testing.
-     * <p>
-     * @param requesterId
-     * @return String
-     */
-    protected abstract String getExtraInfoForRequesterId( long requesterId );
-
-    /**
-     * Allows it to be injected.
-     * <p>
-     * @param cacheEventLogger
-     */
-    public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
-    {
-        this.cacheEventLogger = cacheEventLogger;
-    }
-
-    /**
-     * @param cacheManager the cacheManager to set
-     */
-    protected void setCacheManager( CompositeCacheManager cacheManager )
-    {
-        this.cacheManager = cacheManager;
-    }
-
-    /**
-     * @return the cacheManager
-     */
-    protected ICompositeCacheManager getCacheManager()
-    {
-        return cacheManager;
-    }
-
-    /**
-     * @param eventLogSourceName the eventLogSourceName to set
-     */
-    protected void setEventLogSourceName( String eventLogSourceName )
-    {
-        this.eventLogSourceName = eventLogSourceName;
-    }
-
-    /**
-     * @return the eventLogSourceName
-     */
-    protected String getEventLogSourceName()
-    {
-        return eventLogSourceName;
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.server;
+
+/*
+ * 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.IOException;
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
+import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.commons.jcs.engine.control.CompositeCache;
+import org.apache.commons.jcs.engine.control.CompositeCacheManager;
+import org.apache.commons.jcs.engine.logging.CacheEvent;
+import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent;
+import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This class contains common methods for remote cache services. Eventually I hope to extract out
+ * much of the RMI server to use this as well. I'm starting with the Http service.
+ */
+public abstract class AbstractRemoteCacheService<K extends Serializable, V extends Serializable>
+    implements ICacheServiceNonLocal<K, V>
+{
+    /** An optional event logger */
+    private transient ICacheEventLogger cacheEventLogger;
+
+    /** The central hub */
+    private ICompositeCacheManager cacheManager;
+
+    /** Name of the event log source. */
+    private String eventLogSourceName = "AbstractRemoteCacheService";
+
+    /** Number of puts into the cache. */
+    private int puts = 0;
+
+    /** The interval at which we will log updates. */
+    private final int logInterval = 100;
+
+    /** log instance */
+    private final static Log log = LogFactory.getLog( AbstractRemoteCacheService.class );
+
+    /**
+     * Creates the super with the needed items.
+     * <p>
+     * @param cacheManager
+     * @param cacheEventLogger
+     */
+    public AbstractRemoteCacheService( ICompositeCacheManager cacheManager, ICacheEventLogger cacheEventLogger )
+    {
+        this.cacheManager = cacheManager;
+        this.cacheEventLogger = cacheEventLogger;
+    }
+
+    /**
+     * @param item
+     * @throws IOException
+     */
+    public void update( ICacheElement<K, V> item )
+        throws IOException
+    {
+        update( item, 0 );
+    }
+
+    /**
+     * The internal processing is wrapped in event logging calls.
+     * <p>
+     * @param item
+     * @param requesterId
+     * @throws IOException
+     */
+    public void update( ICacheElement<K, V> item, long requesterId )
+        throws IOException
+    {
+        ICacheEvent<ICacheElement<K, V>> cacheEvent = createICacheEvent( item, requesterId, ICacheEventLogger.UPDATE_EVENT );
+        try
+        {
+            logUpdateInfo( item );
+
+            processUpdate( item, requesterId );
+        }
+        finally
+        {
+            logICacheEvent( cacheEvent );
+        }
+    }
+
+    /**
+     * The internal processing is wrapped in event logging calls.
+     * <p>
+     * @param item
+     * @param requesterId
+     * @throws IOException
+     */
+    abstract void processUpdate( ICacheElement<K, V> item, long requesterId )
+        throws IOException;
+
+    /**
+     * Log some details.
+     * <p>
+     * @param item
+     */
+    private void logUpdateInfo( ICacheElement<K, V> item )
+    {
+        if ( log.isInfoEnabled() )
+        {
+            // not thread safe, but it doesn't have to be accurate
+            puts++;
+            if ( puts % logInterval == 0 )
+            {
+                log.info( "puts = " + puts );
+            }
+        }
+
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "In update, put [" + item.getKey() + "] in [" + item.getCacheName() + "]" );
+        }
+    }
+
+    /**
+     * Returns a cache value from the specified remote cache; or null if the cache or key does not
+     * exist.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @return ICacheElement
+     * @throws IOException
+     */
+    public ICacheElement<K, V> get( String cacheName, K key )
+        throws IOException
+    {
+        return this.get( cacheName, key, 0 );
+    }
+
+    /**
+     * Returns a cache bean from the specified cache; or null if the key does not exist.
+     * <p>
+     * Adding the requestor id, allows the cache to determine the source of the get.
+     * <p>
+     * The internal processing is wrapped in event logging calls.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @param requesterId
+     * @return ICacheElement
+     * @throws IOException
+     */
+    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
+        throws IOException
+    {
+        ICacheElement<K, V> element = null;
+        ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.GET_EVENT );
+        try
+        {
+            element = processGet( cacheName, key, requesterId );
+        }
+        finally
+        {
+            logICacheEvent( cacheEvent );
+        }
+        return element;
+    }
+
+    /**
+     * Returns a cache bean from the specified cache; or null if the key does not exist.
+     * <p>
+     * Adding the requestor id, allows the cache to determine the source of the get.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @param requesterId
+     * @return ICacheElement
+     * @throws IOException
+     */
+    abstract ICacheElement<K, V> processGet( String cacheName, K key, long requesterId )
+        throws IOException;
+
+    /**
+     * Gets all matching items.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @return Map of keys and wrapped objects
+     * @throws IOException
+     */
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
+        throws IOException
+    {
+        return getMatching( cacheName, pattern, 0 );
+    }
+
+    /**
+     * Retrieves all matching keys.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @param requesterId
+     * @return Map of keys and wrapped objects
+     * @throws IOException
+     */
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
+        throws IOException
+    {
+        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, pattern, requesterId,
+                                                    ICacheEventLogger.GETMATCHING_EVENT );
+        try
+        {
+            return processGetMatching( cacheName, pattern, requesterId );
+        }
+        finally
+        {
+            logICacheEvent( cacheEvent );
+        }
+    }
+
+    /**
+     * Retrieves all matching keys.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @param requesterId
+     * @return Map of keys and wrapped objects
+     * @throws IOException
+     */
+    abstract Map<K, ICacheElement<K, V>> processGetMatching( String cacheName, String pattern, long requesterId )
+        throws IOException;
+
+    /**
+     * Gets multiple items from the cache based on the given set of keys.
+     * <p>
+     * @param cacheName
+     * @param keys
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
+     *         data in cache for any of these keys
+     * @throws IOException
+     */
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
+        throws IOException
+    {
+        return this.getMultiple( cacheName, keys, 0 );
+    }
+
+    /**
+     * Gets multiple items from the cache based on the given set of keys.
+     * <p>
+     * The internal processing is wrapped in event logging calls.
+     * <p>
+     * @param cacheName
+     * @param keys
+     * @param requesterId
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
+     *         data in cache for any of these keys
+     * @throws IOException
+     */
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
+        throws IOException
+    {
+        ICacheEvent<Serializable> cacheEvent = createICacheEvent( cacheName, (Serializable) keys, requesterId,
+                                                    ICacheEventLogger.GETMULTIPLE_EVENT );
+        try
+        {
+            return processGetMultiple( cacheName, keys, requesterId );
+        }
+        finally
+        {
+            logICacheEvent( cacheEvent );
+        }
+    }
+
+    /**
+     * Gets multiple items from the cache based on the given set of keys.
+     * <p>
+     * @param cacheName
+     * @param keys
+     * @param requesterId
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
+     *         data in cache for any of these keys
+     * @throws IOException
+     */
+    abstract Map<K, ICacheElement<K, V>> processGetMultiple( String cacheName, Set<K> keys, long requesterId )
+        throws IOException;
+
+    /**
+     * Return the keys in this cache.
+     * <p>
+     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
+     */
+    public Set<K> getKeySet( String cacheName )
+    {
+        return processGetKeySet( cacheName );
+    }
+
+    /**
+     * Gets the set of keys of objects currently in the cache.
+     * <p>
+     * @param cacheName
+     * @return Set
+     */
+    public Set<K> processGetKeySet( String cacheName )
+    {
+        CompositeCache<K, V> cache = getCacheManager().getCache( cacheName );
+
+        return cache.getKeySet();
+    }
+
+    /**
+     * Removes the given key from the specified remote cache. Defaults the listener id to 0.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @throws IOException
+     */
+    public void remove( String cacheName, K key )
+        throws IOException
+    {
+        remove( cacheName, key, 0 );
+    }
+
+    /**
+     * Remove the key from the cache region and don't tell the source listener about it.
+     * <p>
+     * The internal processing is wrapped in event logging calls.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @param requesterId
+     * @throws IOException
+     */
+    public void remove( String cacheName, K key, long requesterId )
+        throws IOException
+    {
+        ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.REMOVE_EVENT );
+        try
+        {
+            processRemove( cacheName, key, requesterId );
+        }
+        finally
+        {
+            logICacheEvent( cacheEvent );
+        }
+    }
+
+    /**
+     * Remove the key from the cache region and don't tell the source listener about it.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @param requesterId
+     * @throws IOException
+     */
+    abstract void processRemove( String cacheName, K key, long requesterId )
+        throws IOException;
+
+    /**
+     * Remove all keys from the specified remote cache.
+     * <p>
+     * @param cacheName
+     * @throws IOException
+     */
+    public void removeAll( String cacheName )
+        throws IOException
+    {
+        removeAll( cacheName, 0 );
+    }
+
+    /**
+     * Remove all keys from the specified remote cache.
+     * <p>
+     * The internal processing is wrapped in event logging calls.
+     * <p>
+     * @param cacheName
+     * @param requesterId
+     * @throws IOException
+     */
+    public void removeAll( String cacheName, long requesterId )
+        throws IOException
+    {
+        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, "all", requesterId, ICacheEventLogger.REMOVEALL_EVENT );
+        try
+        {
+            processRemoveAll( cacheName, requesterId );
+        }
+        finally
+        {
+            logICacheEvent( cacheEvent );
+        }
+    }
+
+    /**
+     * Remove all keys from the specified remote cache.
+     * <p>
+     * @param cacheName
+     * @param requesterId
+     * @throws IOException
+     */
+    abstract void processRemoveAll( String cacheName, long requesterId )
+        throws IOException;
+
+    /**
+     * Frees the specified remote cache.
+     * <p>
+     * @param cacheName
+     * @throws IOException
+     */
+    public void dispose( String cacheName )
+        throws IOException
+    {
+        dispose( cacheName, 0 );
+    }
+
+    /**
+     * Frees the specified remote cache.
+     * <p>
+     * @param cacheName
+     * @param requesterId
+     * @throws IOException
+     */
+    public void dispose( String cacheName, long requesterId )
+        throws IOException
+    {
+        ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, "none", requesterId, ICacheEventLogger.DISPOSE_EVENT );
+        try
+        {
+            processDispose( cacheName, requesterId );
+        }
+        finally
+        {
+            logICacheEvent( cacheEvent );
+        }
+    }
+
+    /**
+     * @param cacheName
+     * @param requesterId
+     * @throws IOException
+     */
+    abstract void processDispose( String cacheName, long requesterId )
+        throws IOException;
+
+    /**
+     * Gets the stats attribute of the RemoteCacheServer object.
+     * <p>
+     * @return The stats value
+     * @throws IOException
+     */
+    public String getStats()
+        throws IOException
+    {
+        return cacheManager.getStats();
+    }
+
+    /**
+     * Logs an event if an event logger is configured.
+     * <p>
+     * @param item
+     * @param requesterId
+     * @param eventName
+     * @return ICacheEvent
+     */
+    protected ICacheEvent<ICacheElement<K, V>> createICacheEvent( ICacheElement<K, V> item, long requesterId, String eventName )
+    {
+        if ( cacheEventLogger == null )
+        {
+            return new CacheEvent<ICacheElement<K, V>>();
+        }
+        String ipAddress = getExtraInfoForRequesterId( requesterId );
+        return cacheEventLogger.createICacheEvent( getEventLogSourceName(), item.getCacheName(), eventName, ipAddress,
+                                                   item );
+    }
+
+    /**
+     * Logs an event if an event logger is configured.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @param requesterId
+     * @param eventName
+     * @return ICacheEvent
+     */
+    protected <T extends Serializable> ICacheEvent<T> createICacheEvent( String cacheName, T key, long requesterId, String eventName )
+    {
+        if ( cacheEventLogger == null )
+        {
+            return new CacheEvent<T>();
+        }
+        String ipAddress = getExtraInfoForRequesterId( requesterId );
+        return cacheEventLogger.createICacheEvent( getEventLogSourceName(), cacheName, eventName, ipAddress, key );
+    }
+
+    /**
+     * Logs an event if an event logger is configured.
+     * <p>
+     * @param source
+     * @param eventName
+     * @param optionalDetails
+     */
+    protected void logApplicationEvent( String source, String eventName, String optionalDetails )
+    {
+        if ( cacheEventLogger != null )
+        {
+            cacheEventLogger.logApplicationEvent( source, eventName, optionalDetails );
+        }
+    }
+
+    /**
+     * Logs an event if an event logger is configured.
+     * <p>
+     * @param cacheEvent
+     */
+    protected <T extends Serializable> void logICacheEvent( ICacheEvent<T> cacheEvent )
+    {
+        if ( cacheEventLogger != null )
+        {
+            cacheEventLogger.logICacheEvent( cacheEvent );
+        }
+    }
+
+    /**
+     * Ip address for the client, if one is stored.
+     * <p>
+     * Protected for testing.
+     * <p>
+     * @param requesterId
+     * @return String
+     */
+    protected abstract String getExtraInfoForRequesterId( long requesterId );
+
+    /**
+     * Allows it to be injected.
+     * <p>
+     * @param cacheEventLogger
+     */
+    public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
+    {
+        this.cacheEventLogger = cacheEventLogger;
+    }
+
+    /**
+     * @param cacheManager the cacheManager to set
+     */
+    protected void setCacheManager( CompositeCacheManager cacheManager )
+    {
+        this.cacheManager = cacheManager;
+    }
+
+    /**
+     * @return the cacheManager
+     */
+    protected ICompositeCacheManager getCacheManager()
+    {
+        return cacheManager;
+    }
+
+    /**
+     * @param eventLogSourceName the eventLogSourceName to set
+     */
+    protected void setEventLogSourceName( String eventLogSourceName )
+    {
+        this.eventLogSourceName = eventLogSourceName;
+    }
+
+    /**
+     * @return the eventLogSourceName
+     */
+    protected String getEventLogSourceName()
+    {
+        return eventLogSourceName;
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java Sun Feb 23 10:37:48 2014
@@ -1,174 +1,174 @@
-package org.apache.commons.jcs.auxiliary.remote.http.server;
-
-/*
- * 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.IOException;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheResponse;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
-import org.apache.commons.jcs.engine.control.CompositeCacheManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The Servlet deserializes the request object. The request object is passed to the processor. The
- * processor then calls the service which does the work of talking to the cache.
- * <p>
- * This is essentially an adaptor on top of the service.
- */
-public class RemoteCacheServiceAdaptor<K extends Serializable, V extends Serializable>
-{
-    /** The Logger. */
-    private final static Log log = LogFactory.getLog( RemoteCacheServiceAdaptor.class );
-
-    /** The service that does the work. */
-    private ICacheServiceNonLocal<K, V> remoteCacheService;
-
-    /** This is for testing without the factory. */
-    protected RemoteCacheServiceAdaptor()
-    {
-        // for testing.
-    }
-
-    /**
-     * Create a process with a cache manager.
-     * <p>
-     * @param cacheManager
-     */
-    public RemoteCacheServiceAdaptor( CompositeCacheManager cacheManager )
-    {
-        ICacheServiceNonLocal<K, V> rcs = RemoteHttpCacheSeviceFactory.createRemoteHttpCacheService( cacheManager );
-        setRemoteCacheService( rcs );
-    }
-
-    /**
-     * Processes the request. It will call the appropriate method on the service
-     * <p>
-     * @param request
-     * @return RemoteHttpCacheResponse, never null
-     */
-    @SuppressWarnings( "unchecked" ) // need to cast to correct return type
-    public <T> RemoteCacheResponse<T> processRequest( RemoteCacheRequest<K, V> request )
-    {
-        RemoteCacheResponse<Object> response = new RemoteCacheResponse<Object>();
-
-        if ( request == null )
-        {
-            String message = "The request is null. Cannot process";
-            log.warn( message );
-            response.setSuccess( false );
-            response.setErrorMessage( message );
-        }
-        else
-        {
-            try
-            {
-                switch ( request.getRequestType() )
-                {
-                    case GET:
-                        ICacheElement<K, V> element = getRemoteCacheService().get( request.getCacheName(), request.getKey(),
-                                                                             request.getRequesterId() );
-                        response.setPayload(element);
-                        break;
-                    case GET_MULTIPLE:
-                        Map<K, ICacheElement<K, V>> elementMap = getRemoteCacheService().getMultiple( request.getCacheName(),
-                                                                              request.getKeySet(),
-                                                                              request.getRequesterId() );
-                        if ( elementMap != null )
-                        {
-                            Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K,V>>();
-                            map.putAll(elementMap);
-                            response.setPayload(map);
-                        }
-                        break;
-                    case GET_MATCHING:
-                        Map<K, ICacheElement<K, V>> elementMapMatching = getRemoteCacheService().getMatching( request.getCacheName(),
-                                                                                      request.getPattern(),
-                                                                                      request.getRequesterId() );
-                        if ( elementMapMatching != null )
-                        {
-                            Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K,V>>();
-                            map.putAll(elementMapMatching);
-                            response.setPayload(map);
-                        }
-                        break;
-                    case REMOVE:
-                        getRemoteCacheService().remove( request.getCacheName(), request.getKey(),
-                                                        request.getRequesterId() );
-                        break;
-                    case REMOVE_ALL:
-                        getRemoteCacheService().removeAll( request.getCacheName(), request.getRequesterId() );
-                        break;
-                    case UPDATE:
-                        getRemoteCacheService().update( request.getCacheElement(), request.getRequesterId() );
-                        break;
-                    case ALIVE_CHECK:
-                        response.setSuccess( true );
-                        break;
-                    case DISPOSE:
-                        response.setSuccess( true );
-                        // DO NOTHING
-                        break;
-                    case GET_KEYSET:
-                        Set<K> keys = getRemoteCacheService().getKeySet( request.getCacheName() );
-                        response.setPayload( keys );
-                        break;
-                    default:
-                        String message = "Unknown event type.  Cannot process " + request;
-                        log.warn( message );
-                        response.setSuccess( false );
-                        response.setErrorMessage( message );
-                        break;
-                }
-            }
-            catch ( IOException e )
-            {
-                String message = "Problem processing request. " + request + " Error: " + e.getMessage();
-                log.error( message, e );
-                response.setSuccess( false );
-                response.setErrorMessage( message );
-            }
-        }
-
-        return (RemoteCacheResponse<T>)response;
-    }
-
-    /**
-     * @param remoteHttpCacheService the remoteHttpCacheService to set
-     */
-    public void setRemoteCacheService( ICacheServiceNonLocal<K, V> remoteHttpCacheService )
-    {
-        this.remoteCacheService = remoteHttpCacheService;
-    }
-
-    /**
-     * @return the remoteHttpCacheService
-     */
-    public ICacheServiceNonLocal<K, V> getRemoteCacheService()
-    {
-        return remoteCacheService;
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.server;
+
+/*
+ * 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.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheResponse;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
+import org.apache.commons.jcs.engine.control.CompositeCacheManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The Servlet deserializes the request object. The request object is passed to the processor. The
+ * processor then calls the service which does the work of talking to the cache.
+ * <p>
+ * This is essentially an adaptor on top of the service.
+ */
+public class RemoteCacheServiceAdaptor<K extends Serializable, V extends Serializable>
+{
+    /** The Logger. */
+    private final static Log log = LogFactory.getLog( RemoteCacheServiceAdaptor.class );
+
+    /** The service that does the work. */
+    private ICacheServiceNonLocal<K, V> remoteCacheService;
+
+    /** This is for testing without the factory. */
+    protected RemoteCacheServiceAdaptor()
+    {
+        // for testing.
+    }
+
+    /**
+     * Create a process with a cache manager.
+     * <p>
+     * @param cacheManager
+     */
+    public RemoteCacheServiceAdaptor( CompositeCacheManager cacheManager )
+    {
+        ICacheServiceNonLocal<K, V> rcs = RemoteHttpCacheSeviceFactory.createRemoteHttpCacheService( cacheManager );
+        setRemoteCacheService( rcs );
+    }
+
+    /**
+     * Processes the request. It will call the appropriate method on the service
+     * <p>
+     * @param request
+     * @return RemoteHttpCacheResponse, never null
+     */
+    @SuppressWarnings( "unchecked" ) // need to cast to correct return type
+    public <T> RemoteCacheResponse<T> processRequest( RemoteCacheRequest<K, V> request )
+    {
+        RemoteCacheResponse<Object> response = new RemoteCacheResponse<Object>();
+
+        if ( request == null )
+        {
+            String message = "The request is null. Cannot process";
+            log.warn( message );
+            response.setSuccess( false );
+            response.setErrorMessage( message );
+        }
+        else
+        {
+            try
+            {
+                switch ( request.getRequestType() )
+                {
+                    case GET:
+                        ICacheElement<K, V> element = getRemoteCacheService().get( request.getCacheName(), request.getKey(),
+                                                                             request.getRequesterId() );
+                        response.setPayload(element);
+                        break;
+                    case GET_MULTIPLE:
+                        Map<K, ICacheElement<K, V>> elementMap = getRemoteCacheService().getMultiple( request.getCacheName(),
+                                                                              request.getKeySet(),
+                                                                              request.getRequesterId() );
+                        if ( elementMap != null )
+                        {
+                            Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K,V>>();
+                            map.putAll(elementMap);
+                            response.setPayload(map);
+                        }
+                        break;
+                    case GET_MATCHING:
+                        Map<K, ICacheElement<K, V>> elementMapMatching = getRemoteCacheService().getMatching( request.getCacheName(),
+                                                                                      request.getPattern(),
+                                                                                      request.getRequesterId() );
+                        if ( elementMapMatching != null )
+                        {
+                            Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K,V>>();
+                            map.putAll(elementMapMatching);
+                            response.setPayload(map);
+                        }
+                        break;
+                    case REMOVE:
+                        getRemoteCacheService().remove( request.getCacheName(), request.getKey(),
+                                                        request.getRequesterId() );
+                        break;
+                    case REMOVE_ALL:
+                        getRemoteCacheService().removeAll( request.getCacheName(), request.getRequesterId() );
+                        break;
+                    case UPDATE:
+                        getRemoteCacheService().update( request.getCacheElement(), request.getRequesterId() );
+                        break;
+                    case ALIVE_CHECK:
+                        response.setSuccess( true );
+                        break;
+                    case DISPOSE:
+                        response.setSuccess( true );
+                        // DO NOTHING
+                        break;
+                    case GET_KEYSET:
+                        Set<K> keys = getRemoteCacheService().getKeySet( request.getCacheName() );
+                        response.setPayload( keys );
+                        break;
+                    default:
+                        String message = "Unknown event type.  Cannot process " + request;
+                        log.warn( message );
+                        response.setSuccess( false );
+                        response.setErrorMessage( message );
+                        break;
+                }
+            }
+            catch ( IOException e )
+            {
+                String message = "Problem processing request. " + request + " Error: " + e.getMessage();
+                log.error( message, e );
+                response.setSuccess( false );
+                response.setErrorMessage( message );
+            }
+        }
+
+        return (RemoteCacheResponse<T>)response;
+    }
+
+    /**
+     * @param remoteHttpCacheService the remoteHttpCacheService to set
+     */
+    public void setRemoteCacheService( ICacheServiceNonLocal<K, V> remoteHttpCacheService )
+    {
+        this.remoteCacheService = remoteHttpCacheService;
+    }
+
+    /**
+     * @return the remoteHttpCacheService
+     */
+    public ICacheServiceNonLocal<K, V> getRemoteCacheService()
+    {
+        return remoteCacheService;
+    }
+}

Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServerAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServerAttributes.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServerAttributes.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServerAttributes.java Sun Feb 23 10:37:48 2014
@@ -1,114 +1,114 @@
-package org.apache.commons.jcs.auxiliary.remote.http.server;
-
-/*
- * 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 org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
-import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
-
-/**
- * Configuration for the RemoteHttpCacheServer. Most of these properties are used only by the
- * service.
- */
-public class RemoteHttpCacheServerAttributes
-    extends AbstractAuxiliaryCacheAttributes
-{
-    /** Don't change. */
-    private static final long serialVersionUID = -3987239306108780496L;
-
-    /** Can a cluster remote put to other remotes */
-    private boolean localClusterConsistency = true;
-
-    /** Can a cluster remote get from other remotes */
-    private boolean allowClusterGet = true;
-
-    /**
-     * clones
-     * <p>
-     * @return AuxiliaryCacheAttributes clone
-     */
-    public AuxiliaryCacheAttributes copy()
-    {
-        try
-        {
-            return (AuxiliaryCacheAttributes) this.clone();
-        }
-        catch ( Exception e )
-        {
-            // swallow
-        }
-        return this;
-    }
-
-    /**
-     * Should cluster updates be propagated to the locals
-     * <p>
-     * @return The localClusterConsistency value
-     */
-    public boolean isLocalClusterConsistency()
-    {
-        return localClusterConsistency;
-    }
-
-    /**
-     * Should cluster updates be propagated to the locals
-     * <p>
-     * @param r The new localClusterConsistency value
-     */
-    public void setLocalClusterConsistency( boolean r )
-    {
-        this.localClusterConsistency = r;
-    }
-
-    /**
-     * Should gets from non-cluster clients be allowed to get from other remote auxiliaries.
-     * <p>
-     * @return The localClusterConsistency value
-     */
-    public boolean isAllowClusterGet()
-    {
-        return allowClusterGet;
-    }
-
-    /**
-     * Should we try to get from other cluster servers if we don't find the items locally.
-     * <p>
-     * @param r The new localClusterConsistency value
-     */
-    public void setAllowClusterGet( boolean r )
-    {
-        allowClusterGet = r;
-    }
-
-    /**
-     * @return String details
-     */
-    @Override
-    public String toString()
-    {
-        StringBuffer buf = new StringBuffer();
-        buf.append( "\nRemoteHttpCacheServiceAttributes" );
-        buf.append( "\n cacheName = [" + this.getCacheName() + "]" );
-        buf.append( "\n allowClusterGet = [" + this.isAllowClusterGet() + "]" );
-        buf.append( "\n localClusterConsistency = [" + this.isLocalClusterConsistency() + "]" );
-        buf.append( "\n eventQueueType = [" + this.getEventQueueType() + "]" );
-        buf.append( "\n eventQueuePoolName = [" + this.getEventQueuePoolName() + "]" );
-        return buf.toString();
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.server;
+
+/*
+ * 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 org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
+import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
+
+/**
+ * Configuration for the RemoteHttpCacheServer. Most of these properties are used only by the
+ * service.
+ */
+public class RemoteHttpCacheServerAttributes
+    extends AbstractAuxiliaryCacheAttributes
+{
+    /** Don't change. */
+    private static final long serialVersionUID = -3987239306108780496L;
+
+    /** Can a cluster remote put to other remotes */
+    private boolean localClusterConsistency = true;
+
+    /** Can a cluster remote get from other remotes */
+    private boolean allowClusterGet = true;
+
+    /**
+     * clones
+     * <p>
+     * @return AuxiliaryCacheAttributes clone
+     */
+    public AuxiliaryCacheAttributes copy()
+    {
+        try
+        {
+            return (AuxiliaryCacheAttributes) this.clone();
+        }
+        catch ( Exception e )
+        {
+            // swallow
+        }
+        return this;
+    }
+
+    /**
+     * Should cluster updates be propagated to the locals
+     * <p>
+     * @return The localClusterConsistency value
+     */
+    public boolean isLocalClusterConsistency()
+    {
+        return localClusterConsistency;
+    }
+
+    /**
+     * Should cluster updates be propagated to the locals
+     * <p>
+     * @param r The new localClusterConsistency value
+     */
+    public void setLocalClusterConsistency( boolean r )
+    {
+        this.localClusterConsistency = r;
+    }
+
+    /**
+     * Should gets from non-cluster clients be allowed to get from other remote auxiliaries.
+     * <p>
+     * @return The localClusterConsistency value
+     */
+    public boolean isAllowClusterGet()
+    {
+        return allowClusterGet;
+    }
+
+    /**
+     * Should we try to get from other cluster servers if we don't find the items locally.
+     * <p>
+     * @param r The new localClusterConsistency value
+     */
+    public void setAllowClusterGet( boolean r )
+    {
+        allowClusterGet = r;
+    }
+
+    /**
+     * @return String details
+     */
+    @Override
+    public String toString()
+    {
+        StringBuffer buf = new StringBuffer();
+        buf.append( "\nRemoteHttpCacheServiceAttributes" );
+        buf.append( "\n cacheName = [" + this.getCacheName() + "]" );
+        buf.append( "\n allowClusterGet = [" + this.isAllowClusterGet() + "]" );
+        buf.append( "\n localClusterConsistency = [" + this.isLocalClusterConsistency() + "]" );
+        buf.append( "\n eventQueueType = [" + this.getEventQueueType() + "]" );
+        buf.append( "\n eventQueuePoolName = [" + this.getEventQueuePoolName() + "]" );
+        return buf.toString();
+    }
+}



Mime
View raw message