You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by as...@apache.org on 2005/09/16 06:37:49 UTC

svn commit: r289379 [1/2] - in /jakarta/jcs/trunk: auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/ auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/ auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/l...

Author: asmuts
Date: Thu Sep 15 21:37:26 2005
New Revision: 289379

URL: http://svn.apache.org/viewcvs?rev=289379&view=rev
Log:
Finshed refactoring tcp lateral to use its own attributes, factory and manager.
I added allowGet, allowPut, issueRemoveOnPut, and filterRemoveByHashCode attributes
for TCP lateral, as discussed on the user list.  I Added unit test for all new features.
I will add documentation on the new features later.
I still need to get the jgroups factory in order after the lateral refactoring.

Added:
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java
    jakarta/jcs/trunk/src/test-conf/TestTCPLateralIssueRemoveCache.ccf
    jakarta/jcs/trunk/src/test-conf/TestTCPLateralRemoveFilter.ccf
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestLateralTCPFilterRemoveHashCode.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestLateralTCPIssueRemoveOnPut.java
Modified:
    jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.java
    jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java
    jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGCacheManager.java
    jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/IJGConstants.java
    jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/ILateralCacheJGListener.java
    jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils/JGRpcOpener.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryMessage.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java
    jakarta/jcs/trunk/src/test-conf/TestTCPLateralCache.ccf
    jakarta/jcs/trunk/src/test-conf/TestTCPLateralCacheConcurrent.ccf
    jakarta/jcs/trunk/src/test-conf/TestUDPDiscovery.ccf
    jakarta/jcs/trunk/src/test-conf/log4j.properties
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestLateralTCPConcurrentRandom.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateral.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/TestUDPDiscovery.java

Modified: jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.java (original)
+++ jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheFactory.java Thu Sep 15 21:37:26 2005
@@ -25,9 +25,6 @@
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.javagroups.LateralCacheJGListener;
-import org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPListener;
-import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryManager;
-import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryService;
 import org.apache.jcs.engine.behavior.ICache;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 
@@ -37,7 +34,9 @@
  * canl have multiple caches. The remote relationships are consolidated and
  * restored via these managers. The facade provides a front to the composite
  * cache so the implmenetation is transparent.
- *  
+ * 
+ * This can no longer create TCP laterals
+ * 
  * @deprecated use the new TYPE specific lateral factories.
  */
 public class LateralCacheFactory
@@ -76,40 +75,7 @@
             {
                 noWaits.add( ic );
             }
-        }
-
-        // for each server listed get the manager for that server.
-        // from that manager get the cache for this region name.
-        else if ( lac.getTransmissionType() == LateralCacheAttributes.TCP )
-        {
 
-            //pars up the tcp servers and set the tcpServer value and
-            // get the manager and then get the cache
-            StringTokenizer it = new StringTokenizer( lac.tcpServers, "," );
-            if ( log.isDebugEnabled() )
-            {
-                log.debug( "Configured for " + it.countTokens() + "  servers." );
-            }
-            while ( it.hasMoreElements() )
-            {
-                String server = (String) it.nextElement();
-                if ( log.isDebugEnabled() )
-                {
-                    log.debug( "tcp server = " + server );
-                }
-                LateralCacheAttributes lacC = (LateralCacheAttributes) lac.copy();
-                lacC.setTcpServer( server );
-                LateralCacheManager lcm = LateralCacheManager.getInstance( lacC, cacheMgr );
-                ICache ic = lcm.getCache( lacC.getCacheName() );
-                if ( ic != null )
-                {
-                    noWaits.add( ic );
-                }
-                else
-                {
-                    log.debug( "noWait is null, no lateral connection made" );
-                }
-            }
         }
         else if ( lac.getTransmissionType() == LateralCacheAttributes.XMLRPC )
         {
@@ -161,14 +127,14 @@
         LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( (LateralCacheNoWait[]) noWaits
             .toArray( new LateralCacheNoWait[0] ), iaca.getCacheName() );
 
-        createDiscoveryService( lac, lcnwf, cacheMgr );
-
         return lcnwf;
     }
 
     /*
-     *  (non-Javadoc)
-     * @see org.apache.jcs.auxiliary.lateral.LateralCacheAbstractFactory#createListener(org.apache.jcs.auxiliary.lateral.LateralCacheAttributes, org.apache.jcs.engine.behavior.ICompositeCacheManager)
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.LateralCacheAbstractFactory#createListener(org.apache.jcs.auxiliary.lateral.LateralCacheAttributes,
+     *      org.apache.jcs.engine.behavior.ICompositeCacheManager)
      */
     public void createListener( LateralCacheAttributes lac, ICompositeCacheManager cacheMgr )
     {
@@ -183,12 +149,7 @@
 
             try
             {
-                if ( lac.getTransmissionType() == ILateralCacheAttributes.TCP )
-                {
-                    // make a listener. if one doesn't exist
-                    LateralTCPListener.getInstance( lac, cacheMgr );
-                }
-                else if ( lac.getTransmissionType() == ILateralCacheAttributes.JAVAGROUPS )
+                if ( lac.getTransmissionType() == ILateralCacheAttributes.JAVAGROUPS )
                 {
                     LateralCacheJGListener.getInstance( lac, cacheMgr );
                 }
@@ -206,45 +167,6 @@
                 log.debug( "Not creating a listener since we are not receiving." );
             }
         }
-    }
-
-    /**
-     * Creates the discovery service. Only creates this for tcp laterals right
-     * now.
-     * 
-     * @param lac
-     * @param lcnwf
-     * @param cacheMgr
-     * @return null if none is created.
-     */
-    private UDPDiscoveryService createDiscoveryService( LateralCacheAttributes lac, LateralCacheNoWaitFacade lcnwf,
-                                                       ICompositeCacheManager cacheMgr )
-    {
-        UDPDiscoveryService discovery = null;
-
-        //      create the UDP discovery for the TCP lateral
-        if ( lac.isUdpDiscoveryEnabled() )
-        {
-            if ( lac.getTransmissionType() != LateralCacheAttributes.TCP )
-            {
-                log
-                    .warn( "UdpDiscoveryEnabled is set to true, but the Lateral cache type is not TCP.  Discovery will not be enabled." );
-            }
-            else
-            {
-                // need a factory for this so it doesn't
-                // get dereferenced, also we don't want one for every region.
-                discovery = UDPDiscoveryManager.getInstance().getService( lac, cacheMgr );
-
-                discovery.addNoWaitFacade( lcnwf, lac.getCacheName() );
-
-                if ( log.isInfoEnabled() )
-                {
-                    log.info( "Created UDPDiscoveryService for TCP lateral cache." );
-                }
-            }
-        }
-        return discovery;
     }
 
     /**

Modified: jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java (original)
+++ jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java Thu Sep 15 21:37:26 2005
@@ -146,14 +146,7 @@
 
         try
         {
-            if ( this.lca.getTransmissionType() == ILateralCacheAttributes.TCP )
-            {
-                log.debug( "Creating TCP service" );
-                log.info( "Creating TCP service, lca = " + this.lca );
-
-                this.lateralService = new LateralTCPService( this.lca );
-            }
-            else if ( this.lca.getTransmissionType() == ILateralCacheAttributes.JAVAGROUPS )
+            if ( this.lca.getTransmissionType() == ILateralCacheAttributes.JAVAGROUPS )
             {
                 log.debug( "Creating JAVAGROUPS service" );
 
@@ -255,11 +248,7 @@
         {
             try
             {
-                if ( this.lca.getTransmissionType() == ILateralCacheAttributes.TCP )
-                {
-                    addLateralCacheListener( cacheName, LateralTCPListener.getInstance( this.lca, cacheMgr ) );
-                }
-                else if ( this.lca.getTransmissionType() == ILateralCacheAttributes.JAVAGROUPS )
+                if ( this.lca.getTransmissionType() == ILateralCacheAttributes.JAVAGROUPS )
                 {
                     addLateralCacheListener( cacheName, LateralCacheJGListener.getInstance( this.lca, cacheMgr ) );
                 }
@@ -359,10 +348,7 @@
         Object service = null;
         try
         {
-            if ( lca.getTransmissionType() == lca.TCP )
-            {
-                service = new LateralTCPService( lca );                
-            }
+            // no op
         }
         catch ( Exception ex )
         {

Modified: jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGCacheManager.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGCacheManager.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGCacheManager.java (original)
+++ jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/LateralJGCacheManager.java Thu Sep 15 21:37:26 2005
@@ -35,7 +35,6 @@
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
-import org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPService;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 
 /**
@@ -112,13 +111,11 @@
             }
         }
 
-        
         createMonitor( ins );
-        
+
         return ins;
     }
 
-    
     /**
      * The monitor needs reference to one instance, acutally just a type.
      * 
@@ -128,7 +125,7 @@
      */
     private static synchronized void createMonitor( ILateralCacheManager instance )
     {
-//      only want one monitor per lateral type
+        //      only want one monitor per lateral type
         // Fires up the monitoring daemon.
         if ( monitor == null )
         {
@@ -143,7 +140,7 @@
         }
 
     }
-    
+
     /**
      * Constructor for the LateralCacheManager object
      * 
@@ -165,14 +162,7 @@
 
         try
         {
-            if ( this.lca.getTransmissionType() == ILateralCacheAttributes.TCP )
-            {
-                log.debug( "Creating TCP service" );
-                log.info( "Creating TCP service, lca = " + this.lca );
-
-                this.lateralService = new LateralTCPService( this.lca );
-            }
-            else if ( this.lca.getTransmissionType() == ILateralCacheAttributes.JAVAGROUPS )
+            if ( this.lca.getTransmissionType() == ILateralCacheAttributes.JAVAGROUPS )
             {
                 log.debug( "Creating JAVAGROUPS service" );
 
@@ -211,7 +201,7 @@
 
             // Notify the cache monitor about the error, and kick off
             // the recovery process.
-            
+
             createMonitor( this );
             monitor.notifyError();
         }
@@ -312,8 +302,9 @@
         return instances;
     }
 
-
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager#fixService()
      */
     public Object fixService()

Modified: jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/IJGConstants.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/IJGConstants.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/IJGConstants.java (original)
+++ jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/IJGConstants.java Thu Sep 15 21:37:26 2005
@@ -5,7 +5,7 @@
  * 
  * Licensed 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
+ * the License at 
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 

Modified: jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/ILateralCacheJGListener.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/ILateralCacheJGListener.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/ILateralCacheJGListener.java (original)
+++ jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/behavior/ILateralCacheJGListener.java Thu Sep 15 21:37:26 2005
@@ -23,7 +23,7 @@
 
 /**
  * Listens for lateral cache event notification.
- * 
+ *  
  * @version $Id: ILateralCacheJGListener.java 224346 2005-06-04 02:01:59Z asmuts $
  */
 public interface ILateralCacheJGListener

Modified: jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils/JGRpcOpener.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils/JGRpcOpener.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils/JGRpcOpener.java (original)
+++ jakarta/jcs/trunk/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/lateral/javagroups/utils/JGRpcOpener.java Thu Sep 15 21:37:26 2005
@@ -47,12 +47,15 @@
 
     private ILateralCacheAttributes ilca;
 
-    /** Constructor for the SocketOpener object 
+    /**
+     * Constructor for the SocketOpener object
+     * 
      * @param ilcl
      * @param ilca
      * @param timeOut
      * @param groupName
-     * @return*/
+     * @return
+     */
     public static RpcDispatcher openSocket( ILateralCacheJGListener ilcl, ILateralCacheAttributes ilca, int timeOut,
                                            String groupName )
     {
@@ -72,10 +75,11 @@
 
     /**
      * Constructor for the SocketOpener object
+     * 
      * @param ilcl
      * @param ilca
      * @param groupName
-     * 
+     *  
      */
     public JGRpcOpener( ILateralCacheJGListener ilcl, ILateralCacheAttributes ilca, String groupName )
     {
@@ -103,7 +107,7 @@
             {
                 log.info( "Is Connected = " + rpcCh.isConnected() );
             }
-            
+
         }
         catch ( Exception e )
         {
@@ -111,8 +115,11 @@
         }
     }
 
-    /** Gets the socket attribute of the SocketOpener object 
-     * @return*/
+    /**
+     * Gets the socket attribute of the SocketOpener object
+     * 
+     * @return
+     */
     public RpcDispatcher getSocket()
     {
         return disp;

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java Thu Sep 15 21:37:26 2005
@@ -31,6 +31,9 @@
     extends AbstractAuxiliaryCacheAttributes
     implements Serializable, ILateralCacheAttributes
 {
+    
+    private static final boolean DEFAULT_RECEIVE = true;
+    
     String transmissionTypeName = "UDP";
 
     int transmissionType = UDP;
@@ -51,21 +54,6 @@
 
     int httpListenerPort = 8080;
 
-    // TCP --------------------------------------------
-    String tcpServers = "";
-
-    // used to identify the service that this manager will be
-    // operating on
-    String tcpServer = "";
-
-    int tcpListenerPort = 0;
-
-    // udp discovery for tcp server
-    private String udpDiscoveryAddr = "228.5.6.7";
-
-    private int udpDiscoveryPort = 6789;
-
-    private boolean udpDiscoveryEnabled = true;
 
     // JAVAGROUPS -------------------------
     private String jgChannelProperties = null;
@@ -76,7 +64,7 @@
 
     // do we receive and broadcast or only broadcast
     // this is useful when you don't want to get any notifications
-    private boolean receive = true;
+    private boolean receive = DEFAULT_RECEIVE;
 
     /**
      * Sets the httpServer attribute of the LateralCacheAttributes object
@@ -99,26 +87,7 @@
         return httpServer;
     }
 
-    /**
-     * Sets the tcpServers attribute of the LateralCacheAttributes object
-     * 
-     * @param val
-     *            The new tcpServers value
-     */
-    public void setTcpServers( String val )
-    {
-        tcpServers = val;
-    }
 
-    /**
-     * Gets the tcpServers attribute of the LateralCacheAttributes object
-     * 
-     * @return The tcpServers value
-     */
-    public String getTcpServers()
-    {
-        return tcpServers;
-    }
 
     /**
      * Sets the httpServers attribute of the LateralCacheAttributes object
@@ -141,47 +110,7 @@
         return httpServers;
     }
 
-    /**
-     * Sets the tcpServer attribute of the LateralCacheAttributes object
-     * 
-     * @param val
-     *            The new tcpServer value
-     */
-    public void setTcpServer( String val )
-    {
-        tcpServer = val;
-    }
-
-    /**
-     * Gets the tcpServer attribute of the LateralCacheAttributes object
-     * 
-     * @return The tcpServer value
-     */
-    public String getTcpServer()
-    {
-        return tcpServer;
-    }
-
-    /**
-     * Sets the tcpListenerPort attribute of the LateralCacheAttributes object
-     * 
-     * @param val
-     *            The new tcpListenerPort value
-     */
-    public void setTcpListenerPort( int val )
-    {
-        this.tcpListenerPort = val;
-    }
-
-    /**
-     * Gets the tcpListenerPort attribute of the LateralCacheAttributes object
-     * 
-     * @return The tcpListenerPort value
-     */
-    public int getTcpListenerPort()
-    {
-        return this.tcpListenerPort;
-    }
+    
 
     /**
      * Sets the httpListenerPort attribute of the ILateralCacheAttributes object
@@ -380,40 +309,8 @@
         return this;
     }
 
-    /**
-     * @param udpDiscoveryAddr
-     *            The udpDiscoveryAddr to set.
-     */
-    public void setUdpDiscoveryAddr( String udpDiscoveryAddr )
-    {
-        this.udpDiscoveryAddr = udpDiscoveryAddr;
-    }
-
-    /**
-     * @return Returns the udpDiscoveryAddr.
-     */
-    public String getUdpDiscoveryAddr()
-    {
-        return udpDiscoveryAddr;
-    }
-
-    /**
-     * @param udpDiscoveryPort
-     *            The udpDiscoveryPort to set.
-     */
-    public void setUdpDiscoveryPort( int udpDiscoveryPort )
-    {
-        this.udpDiscoveryPort = udpDiscoveryPort;
-    }
-
-    /**
-     * @return Returns the udpDiscoveryPort.
-     */
-    public int getUdpDiscoveryPort()
-    {
-        return udpDiscoveryPort;
-    }
-
+    
+    
     /**
      * @param receive
      *            The receive to set.
@@ -431,22 +328,7 @@
         return receive;
     }
 
-    /**
-     * @param udpDiscoveryEnabled
-     *            The udpDiscoveryEnabled to set.
-     */
-    public void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled )
-    {
-        this.udpDiscoveryEnabled = udpDiscoveryEnabled;
-    }
-
-    /**
-     * @return Returns the udpDiscoveryEnabled.
-     */
-    public boolean isUdpDiscoveryEnabled()
-    {
-        return udpDiscoveryEnabled;
-    }
+    
 
     /*
      * (non-Javadoc)
@@ -461,8 +343,7 @@
         //buf.append( "transmissionTypeName=" + transmissionTypeName + "\n" );
         //buf.append( "transmissionType=" + transmissionType + "\n" );
         //buf.append( "tcpServer=" + tcpServer + "\n" );
-        buf.append( transmissionTypeName + httpServer + udpMulticastAddr + String.valueOf( udpMulticastPort )
-            + tcpServer );
+        buf.append( transmissionTypeName + httpServer + udpMulticastAddr + String.valueOf( udpMulticastPort ) );
         return buf.toString();
     }
 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralElementDescriptor.java Thu Sep 15 21:37:26 2005
@@ -21,7 +21,7 @@
 import org.apache.jcs.engine.behavior.ICacheElement;
 
 /**
- * Description of the Class
+ * This class wraps command to other laterals.
  *  
  */
 public class LateralElementDescriptor
@@ -53,6 +53,8 @@
     /** Description of the Field */
     public int command = UPDATE;
 
+    public int valHashCode = -1;
+    
     // for update command
     /** Constructor for the LateralElementDescriptor object */
     public LateralElementDescriptor()

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java Thu Sep 15 21:37:26 2005
@@ -21,7 +21,12 @@
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 
 /**
- * Description of the Interface
+ * This interface defines configuration options common to lateral cache
+ * plugins.  
+ * 
+ * TODO it needs to be trimmed down.  The old version had features for
+ * every lateral.  Now, the individual laterals have their own specific
+ * attributes interfaces.
  *  
  */
 public interface ILateralCacheAttributes
@@ -53,51 +58,7 @@
      */
     public String getHttpServer();
 
-    /**
-     * Sets the tcpServer attribute of the ILateralCacheAttributes object
-     * 
-     * @param val
-     *            The new tcpServer value
-     */
-    public void setTcpServer( String val );
-
-    /**
-     * Gets the tcpServer attribute of the ILateralCacheAttributes object
-     * 
-     * @return The tcpServer value
-     */
-    public String getTcpServer();
-
-    /**
-     * Sets the tcpServers attribute of the ILateralCacheAttributes object
-     * 
-     * @param val
-     *            The new tcpServers value
-     */
-    public void setTcpServers( String val );
-
-    /**
-     * Gets the tcpServers attribute of the ILateralCacheAttributes object
-     * 
-     * @return The tcpServers value
-     */
-    public String getTcpServers();
-
-    /**
-     * Sets the tcpListenerPort attribute of the ILateralCacheAttributes object
-     * 
-     * @param val
-     *            The new tcpListenerPort value
-     */
-    public void setTcpListenerPort( int val );
-
-    /**
-     * Gets the tcpListenerPort attribute of the ILateralCacheAttributes object
-     * 
-     * @return The tcpListenerPort value
-     */
-    public int getTcpListenerPort();
-
+    
     /**
      * Sets the httpListenerPort attribute of the ILateralCacheAttributes object
      * 
@@ -242,51 +203,5 @@
      */
     public boolean isReceive();
 
-    /**
-     * Can setup UDP Discovery. This only works for TCp laterals right now. It
-     * allows TCP laterals to find each other by broadcasting to a multicast
-     * port.
-     * 
-     * @param udpDiscoveryEnabled
-     *            The udpDiscoveryEnabled to set.
-     */
-    public void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled );
-
-    /**
-     * Whether or not TCP laterals can try to find each other by multicast
-     * communication.
-     * 
-     * @return Returns the udpDiscoveryEnabled.
-     */
-    public boolean isUdpDiscoveryEnabled();
-
-    /**
-     * The port to use if UDPDiscovery is enabled.
-     * 
-     * @return Returns the udpDiscoveryPort.
-     */
-    public int getUdpDiscoveryPort();
-
-    /**
-     * Sets the port to use if UDPDiscovery is enabled.
-     * 
-     * @param udpDiscoveryPort
-     *            The udpDiscoveryPort to set.
-     */
-    public void setUdpDiscoveryPort( int udpDiscoveryPort );
-
-    /**
-     * The address to broadcast to if UDPDiscovery is enabled.
-     * 
-     * @return Returns the udpDiscoveryAddr.
-     */
-    public String getUdpDiscoveryAddr();
-
-    /**
-     * Sets the address to broadcast to if UDPDiscovery is enabled.
-     * 
-     * @param udpDiscoveryAddr
-     *            The udpDiscoveryAddr to set.
-     */
-    public void setUdpDiscoveryAddr( String udpDiscoveryAddr );
+    
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java Thu Sep 15 21:37:26 2005
@@ -27,6 +27,7 @@
 import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
 import org.apache.jcs.auxiliary.lateral.LateralCacheNoWaitFacade;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryManager;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryService;
 import org.apache.jcs.engine.behavior.ICache;
@@ -54,7 +55,7 @@
     public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr )
     {
 
-        LateralCacheAttributes lac = (LateralCacheAttributes) iaca;
+        ITCPLateralCacheAttributes lac = (ITCPLateralCacheAttributes) iaca;
         ArrayList noWaits = new ArrayList();
 
         //pars up the tcp servers and set the tcpServer value and
@@ -74,14 +75,14 @@
                 {
                     log.debug( "tcp server = " + server );
                 }
-                LateralCacheAttributes lacC = (LateralCacheAttributes) lac.copy();
+                ITCPLateralCacheAttributes lacC = (ITCPLateralCacheAttributes) lac.copy();
                 lacC.setTcpServer( server );
                 LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lacC, cacheMgr );
                 ICache ic = lcm.getCache( lacC.getCacheName() );
                 if ( ic != null )
                 {
                     noWaits.add( ic );
-                }
+                } 
                 else
                 {
                     log.debug( "noWait is null, no lateral connection made" );
@@ -89,7 +90,7 @@
             }
         }
 
-        createListener( lac, cacheMgr );
+        createListener( (LateralCacheAttributes)iaca, cacheMgr );
 
         // create the no wait facade.
         LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( (LateralCacheNoWait[]) noWaits
@@ -109,8 +110,10 @@
      */
     public void createListener( LateralCacheAttributes lac, ICompositeCacheManager cacheMgr )
     {
+        
+        ITCPLateralCacheAttributes attr = (ITCPLateralCacheAttributes)lac;
         // don't create a listener if we are not receiving.
-        if ( lac.isReceive() )
+        if ( attr.isReceive() )
         {
 
             if ( log.isInfoEnabled() )
@@ -122,7 +125,7 @@
             {
 
                 // make a listener. if one doesn't exist
-                LateralTCPListener.getInstance( lac, cacheMgr );
+                LateralTCPListener.getInstance( attr, cacheMgr );
 
             }
             catch ( Exception e )
@@ -143,12 +146,12 @@
      * Creates the discovery service. Only creates this for tcp laterals right
      * now.
      * 
-     * @param lac
+     * @param lac ITCPLateralCacheAttributes
      * @param lcnwf
      * @param cacheMgr
      * @return null if none is created.
      */
-    private UDPDiscoveryService createDiscoveryService( LateralCacheAttributes lac, LateralCacheNoWaitFacade lcnwf,
+    private UDPDiscoveryService createDiscoveryService( ITCPLateralCacheAttributes lac, LateralCacheNoWaitFacade lcnwf,
                                                        ICompositeCacheManager cacheMgr )
     {
         UDPDiscoveryService discovery = null;

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheManager.java Thu Sep 15 21:37:26 2005
@@ -31,10 +31,10 @@
 import org.apache.jcs.auxiliary.lateral.LateralCacheWatchRepairable;
 import org.apache.jcs.auxiliary.lateral.ZombieLateralCacheService;
 import org.apache.jcs.auxiliary.lateral.ZombieLateralCacheWatch;
-import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 
 /**
@@ -60,9 +60,9 @@
     protected static Map instances = new HashMap();
 
     /**
-     * Description of the Field
+     * ITCPLateralCacheAttributes
      */
-    protected ILateralCacheAttributes lca;
+    protected ITCPLateralCacheAttributes lca;
 
     private int clients;
 
@@ -88,7 +88,7 @@
      *            this allows the auxiliary to be passed a cache manager.
      * @return
      */
-    public static LateralTCPCacheManager getInstance( ILateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
+    public static LateralTCPCacheManager getInstance( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
     {
         LateralTCPCacheManager ins = (LateralTCPCacheManager) instances.get( lca.toString() );
         synchronized ( instances )
@@ -145,7 +145,7 @@
      * @param lcaA
      * @param cacheMgr
      */
-    private LateralTCPCacheManager( ILateralCacheAttributes lcaA, ICompositeCacheManager cacheMgr )
+    private LateralTCPCacheManager( ITCPLateralCacheAttributes lcaA, ICompositeCacheManager cacheMgr )
     {
         this.lca = lcaA;
 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java Thu Sep 15 21:37:26 2005
@@ -29,8 +29,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.lateral.LateralCacheInfo;
 import org.apache.jcs.auxiliary.lateral.LateralElementDescriptor;
-import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 import org.apache.jcs.engine.control.CompositeCache;
@@ -62,7 +62,7 @@
     /** The socket listener */
     private ListenerThread receiver;
 
-    private ILateralCacheAttributes ilca;
+    private ITCPLateralCacheAttributes tcpLateralCacheAttributes;
 
     private int port;
 
@@ -84,9 +84,11 @@
      * Gets the instance attribute of the LateralCacheTCPListener class.
      * 
      * @param ilca
+     *            ITCPLateralCacheAttributes
+     * @param cacheMgr
      * @return The instance value
      */
-    public synchronized static ILateralCacheListener getInstance( ILateralCacheAttributes ilca,
+    public synchronized static ILateralCacheListener getInstance( ITCPLateralCacheAttributes ilca,
                                                                  ICompositeCacheManager cacheMgr )
     {
         ILateralCacheListener ins = (ILateralCacheListener) instances.get( String.valueOf( ilca.getTcpListenerPort() ) );
@@ -118,9 +120,9 @@
      * 
      * @param ilca
      */
-    protected LateralTCPListener( ILateralCacheAttributes ilca )
+    protected LateralTCPListener( ITCPLateralCacheAttributes ilca )
     {
-        this.ilca = ilca;
+        this.setTcpLateralCacheAttributes( ilca );
     }
 
     /**
@@ -130,7 +132,7 @@
     {
         try
         {
-            this.port = ilca.getTcpListenerPort();
+            this.port = getTcpLateralCacheAttributes().getTcpListenerPort();
 
             receiver = new ListenerThread();
             receiver.setDaemon( true );
@@ -201,7 +203,8 @@
         {
             if ( getPutCnt() % 100 == 0 )
             {
-                log.info( "Put Count (port " + ilca.getTcpListenerPort() + ") = " + getPutCnt() );
+                log.info( "Put Count (port " + getTcpLateralCacheAttributes().getTcpListenerPort() + ") = "
+                    + getPutCnt() );
             }
         }
 
@@ -353,6 +356,23 @@
     }
 
     /**
+     * @param tcpLateralCacheAttributes
+     *            The tcpLateralCacheAttributes to set.
+     */
+    public void setTcpLateralCacheAttributes( ITCPLateralCacheAttributes tcpLateralCacheAttributes )
+    {
+        this.tcpLateralCacheAttributes = tcpLateralCacheAttributes;
+    }
+
+    /**
+     * @return Returns the tcpLateralCacheAttributes.
+     */
+    public ITCPLateralCacheAttributes getTcpLateralCacheAttributes()
+    {
+        return tcpLateralCacheAttributes;
+    }
+
+    /**
      * Processes commands from the server socket. There should be one listener
      * for each configured TCP lateral.
      */
@@ -506,6 +526,34 @@
             }
             else if ( led.command == LateralElementDescriptor.REMOVE )
             {
+                // if a hashcode was given and filtering is on
+                // check to see if they are the same
+                // if so, then don't remvoe, otherwise issue a remove
+                if ( led.valHashCode != -1 )
+                {
+                    if ( getTcpLateralCacheAttributes().isFilterRemoveByHashCode() )
+                    {
+                        ICacheElement test = getCache( cacheName ).localGet( key );
+                        if ( test != null )
+                        {
+                            if ( test.getVal().hashCode() == led.valHashCode )
+                            {
+                                if ( log.isDebugEnabled() )
+                                {
+                                    log.debug( "Filtering detected identical hashCode [" + led.valHashCode + "], not issuing a remove for led " + led );
+                                }                                
+                                return;
+                            }
+                            else
+                            {
+                                if ( log.isDebugEnabled() )
+                                {
+                                    log.debug( "Different hashcodes, in cache [" + test.getVal().hashCode() + "] sent [" + led.valHashCode + "]" );
+                                }
+                            }
+                        }
+                    }        
+                }
                 handleRemove( cacheName, key );
             }
             else if ( led.command == LateralElementDescriptor.REMOVEALL )

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPSender.java Thu Sep 15 21:37:26 2005
@@ -27,7 +27,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.lateral.LateralElementDescriptor;
-import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.utils.SocketOpener;
 import org.apache.jcs.engine.CacheElement;
 import org.apache.jcs.engine.behavior.ICacheElement;
@@ -42,7 +42,7 @@
 {
     private final static Log log = LogFactory.getLog( LateralTCPSender.class );
 
-    private ILateralCacheAttributes ilca;
+    private ITCPLateralCacheAttributes tcpLateralCacheAttributes;
 
     private String remoteHost;
 
@@ -80,10 +80,10 @@
      * @param lca
      * @exception IOException
      */
-    public LateralTCPSender( ILateralCacheAttributes lca )
+    public LateralTCPSender( ITCPLateralCacheAttributes lca )
         throws IOException
     {
-        this.ilca = lca;
+        this.setTcpLateralCacheAttributes( lca );
 
         String p1 = lca.getTcpServer();
         if ( p1 != null )
@@ -110,14 +110,14 @@
      * 
      * @param host
      * @param port
-     * @throws IOException 
+     * @throws IOException
      */
     protected void init( String host, int port )
         throws IOException
     {
         this.port = port;
         this.address = getAddressByName( host );
-        this.remoteHost = host;
+        this.setRemoteHost( host );
 
         try
         {
@@ -128,7 +128,7 @@
 
             if ( socket == null )
             {
-                throw new IOException( "Socket is null, cannot connect to " + host + ":" + port  );
+                throw new IOException( "Socket is null, cannot connect to " + host + ":" + port );
             }
 
             socket.setSoTimeout( LateralTCPSender.timeOut );
@@ -153,7 +153,10 @@
     /**
      * Gets the addressByName attribute of the LateralTCPSender object
      * 
+     * @param host
+     * 
      * @return The addressByName value
+     * @throws IOException
      */
     private InetAddress getAddressByName( String host )
         throws IOException
@@ -169,7 +172,10 @@
         }
     }
 
-    /** Sends commands to the lateral cache listener. */
+    /** Sends commands to the lateral cache listener. 
+     * @param led
+     * @throws IOException
+     */
     public void send( LateralElementDescriptor led )
         throws IOException
     {
@@ -226,6 +232,10 @@
      * is not recommended for performance reasons. If you have 10 laterals, then
      * you have to make 10 failed gets to find out none of the caches have the
      * item.
+     * 
+     * @param led
+     * @return
+     * @throws IOException
      */
     public ICacheElement sendAndReceive( LateralElementDescriptor led )
         throws IOException
@@ -324,6 +334,8 @@
      * conneciton. Dispose request should come into the facade and be sent to
      * all lateral cache sevices. The lateral cache service will then call this
      * method.
+     * @param cache
+     * @throws IOException
      */
     public void dispose( String cache )
         throws IOException
@@ -332,7 +344,40 @@
         oos.close();
     }
 
-    /** Description of the Method */
+    /**
+     * @param tcpLateralCacheAttributes The tcpLateralCacheAttributes to set.
+     */
+    public void setTcpLateralCacheAttributes( ITCPLateralCacheAttributes tcpLateralCacheAttributes )
+    {
+        this.tcpLateralCacheAttributes = tcpLateralCacheAttributes;
+    }
+
+    /**
+     * @return Returns the tcpLateralCacheAttributes.
+     */
+    public ITCPLateralCacheAttributes getTcpLateralCacheAttributes()
+    {
+        return tcpLateralCacheAttributes;
+    }
+
+    /**
+     * @param remoteHost The remoteHost to set.
+     */
+    public void setRemoteHost( String remoteHost )
+    {
+        this.remoteHost = remoteHost;
+    }
+
+    /**
+     * @return Returns the remoteHost.
+     */
+    public String getRemoteHost()
+    {
+        return remoteHost;
+    }
+
+    /** testing Method 
+     * @param args*/
     public static void main( String args[] )
     {
         try

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java Thu Sep 15 21:37:26 2005
@@ -17,27 +17,22 @@
  */
 
 import java.io.BufferedReader;
-import java.io.InputStreamReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.Serializable;
 import java.util.Set;
 
-import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.lateral.LateralCacheInfo;
 import org.apache.jcs.auxiliary.lateral.LateralElementDescriptor;
-
-import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheObserver;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
-
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.engine.CacheElement;
-
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICacheListener;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 /**
  * A lateral cache service implementation. Does not implement getGroupKey
  * 
@@ -48,7 +43,7 @@
 {
     private final static Log log = LogFactory.getLog( LateralTCPService.class );
 
-    private ILateralCacheAttributes ilca;
+    private ITCPLateralCacheAttributes tcpLateralCacheAttributes;
 
     private LateralTCPSender sender;
 
@@ -56,20 +51,21 @@
      * use the vmid by default
      */
     private long listenerId = LateralCacheInfo.listenerId;
-    
+
     /**
      * Constructor for the LateralTCPService object
      * 
      * @param lca
+     *            ITCPLateralCacheAttributes
      * @exception IOException
      */
-    public LateralTCPService( ILateralCacheAttributes lca )
+    public LateralTCPService( ITCPLateralCacheAttributes lca )
         throws IOException
     {
-        this.ilca = lca;
+        this.setTcpLateralCacheAttributes( lca );
         try
         {
-            log.debug( "creating sender, attributes = " + ilca );
+            log.debug( "creating sender, attributes = " + getTcpLateralCacheAttributes() );
 
             sender = new LateralTCPSender( lca );
 
@@ -91,7 +87,7 @@
     /**
      * @param item
      * @throws IOException
-     * 
+     *  
      */
     public void update( ICacheElement item )
         throws IOException
@@ -108,10 +104,41 @@
     public void update( ICacheElement item, long requesterId )
         throws IOException
     {
-        LateralElementDescriptor led = new LateralElementDescriptor( item );
-        led.requesterId = requesterId;
-        led.command = LateralElementDescriptor.UPDATE;
-        sender.send( led );
+        
+        // if we don't allow put, see if we should remove on put
+        if ( !this.getTcpLateralCacheAttributes().isAllowPut() )
+        {
+            // if we can't remove on put, and we can't put then return
+            if ( !this.getTcpLateralCacheAttributes().isIssueRemoveOnPut() )
+            {
+                return;
+            }
+        }
+
+        // if we shouldn't remove on put, then put
+        if ( !this.getTcpLateralCacheAttributes().isIssueRemoveOnPut() )
+        {
+            LateralElementDescriptor led = new LateralElementDescriptor( item );
+            led.requesterId = requesterId;
+            led.command = LateralElementDescriptor.UPDATE;
+            sender.send( led );
+        }
+        // else issue a remove with the hashcode for remove check on
+        // on the other end, this will be a server config option
+        else
+        {            
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Issuing a remvoe for a put" );
+            }
+            // set the value to null so we don't send the item
+            CacheElement ce = new CacheElement( item.getCacheName(), item.getKey(), null );
+            LateralElementDescriptor led = new LateralElementDescriptor( ce );
+            led.requesterId = requesterId;
+            led.command = LateralElementDescriptor.REMOVE;
+            led.valHashCode = item.getVal().hashCode();
+            sender.send( led );
+        }
     }
 
     /*
@@ -153,7 +180,9 @@
         // nothing needs to be done
     }
 
-    /** Will close the connection. 
+    /**
+     * Will close the connection.
+     * 
      * @param cache
      * @throws IOException
      */
@@ -184,18 +213,26 @@
     public ICacheElement get( String cacheName, Serializable key )
         throws IOException
     {
-        CacheElement ce = new CacheElement( cacheName, key, null );
-        LateralElementDescriptor led = new LateralElementDescriptor( ce );
-        //led.requesterId = requesterId; // later
-        led.command = LateralElementDescriptor.GET;
-        return sender.sendAndReceive( led );
-        //return null;
-        // nothing needs to be done
+        // if get is not allowed return
+        if ( this.getTcpLateralCacheAttributes().isAllowGet() )
+        {
+            CacheElement ce = new CacheElement( cacheName, key, null );
+            LateralElementDescriptor led = new LateralElementDescriptor( ce );
+            //led.requesterId = requesterId; // later
+            led.command = LateralElementDescriptor.GET;
+            return sender.sendAndReceive( led );            
+        }
+        else
+        {
+            // nothing needs to be done
+            return null;            
+        }
     }
 
     /**
      * Gets the set of keys of objects currently in the group throws
      * UnsupportedOperationException
+     * 
      * @param cacheName
      * @param group
      * @return Set
@@ -244,7 +281,7 @@
     {
         try
         {
-            LateralTCPSender sender = new LateralTCPSender( new LateralCacheAttributes() );
+            LateralTCPSender sender = new LateralTCPSender( new TCPLateralCacheAttributes() );
 
             // process user input till done
             boolean notDone = true;
@@ -318,7 +355,8 @@
     }
 
     /**
-     * @param listernId The listernId to set.
+     * @param listernId
+     *            The listernId to set.
      */
     protected void setListenerId( long listernId )
     {
@@ -331,6 +369,23 @@
     protected long getListenerId()
     {
         return listenerId;
+    }
+
+    /**
+     * @param tcpLateralCacheAttributes
+     *            The tcpLateralCacheAttributes to set.
+     */
+    public void setTcpLateralCacheAttributes( ITCPLateralCacheAttributes tcpLateralCacheAttributes )
+    {
+        this.tcpLateralCacheAttributes = tcpLateralCacheAttributes;
+    }
+
+    /**
+     * @return Returns the tcpLateralCacheAttributes.
+     */
+    public ITCPLateralCacheAttributes getTcpLateralCacheAttributes()
+    {
+        return tcpLateralCacheAttributes;
     }
 
 }

Added: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java?rev=289379&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java Thu Sep 15 21:37:26 2005
@@ -0,0 +1,302 @@
+package org.apache.jcs.auxiliary.lateral.socket.tcp;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
+
+/**
+ * This interface defines functions that are particular to the TCP Lateral Cache
+ * plugin. It extends the generic LateralCacheAttributes interface which in turn
+ * extends the AuxiliaryCache interface.
+ * 
+ * @author Aaron Smuts
+ *  
+ */
+public class TCPLateralCacheAttributes
+    extends LateralCacheAttributes
+    implements ITCPLateralCacheAttributes
+{
+
+    private static final String DEFAULT_UDP_DISCOVERY_ADDRESS = "228.5.6.7";
+
+    private static final int DEFAULT_UDP_DISCOVERY_PORT = 6789;
+
+    private static final boolean DEFAULT_UDP_DISCOVERY_ENABLED = true;
+
+    private static final boolean DEFAULT_ALLOW_GET = true;
+
+    private static final boolean DEFAULT_ALLOW_PUT = true;
+
+    private static final boolean DEFAULT_ISSUE_REMOVE_FOR_PUT = false;
+
+    private static final boolean DEFAULT_FILTER_REMOVE_BY_HASH_CODE = true;
+
+    // TCP --------------------------------------------
+    private String tcpServers = "";
+
+    // used to identify the service that this manager will be
+    // operating on
+    private String tcpServer = "";
+
+    private int tcpListenerPort = 0;
+
+    // udp discovery for tcp server
+    private String udpDiscoveryAddr = DEFAULT_UDP_DISCOVERY_ADDRESS;
+
+    private int udpDiscoveryPort = DEFAULT_UDP_DISCOVERY_PORT;
+
+    private boolean udpDiscoveryEnabled = DEFAULT_UDP_DISCOVERY_ENABLED;
+
+    private boolean allowPut = DEFAULT_ALLOW_GET;
+
+    private boolean allowGet = DEFAULT_ALLOW_PUT;
+
+    private boolean issueRemoveOnPut = DEFAULT_ISSUE_REMOVE_FOR_PUT;
+
+    private boolean filterRemoveByHashCode = DEFAULT_FILTER_REMOVE_BY_HASH_CODE;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setTcpServer(java.lang.String)
+     */
+    public void setTcpServer( String val )
+    {
+        this.tcpServer = val;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getTcpServer()
+     */
+    public String getTcpServer()
+    {
+        return this.tcpServer;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setTcpServers(java.lang.String)
+     */
+    public void setTcpServers( String val )
+    {
+        this.tcpServers = val;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getTcpServers()
+     */
+    public String getTcpServers()
+    {
+        return this.tcpServers;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setTcpListenerPort(int)
+     */
+    public void setTcpListenerPort( int val )
+    {
+        this.tcpListenerPort = val;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getTcpListenerPort()
+     */
+    public int getTcpListenerPort()
+    {
+        return this.tcpListenerPort;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setUdpDiscoveryEnabled(boolean)
+     */
+    public void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled )
+    {
+        this.udpDiscoveryEnabled = udpDiscoveryEnabled;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#isUdpDiscoveryEnabled()
+     */
+    public boolean isUdpDiscoveryEnabled()
+    {
+        return this.udpDiscoveryEnabled;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getUdpDiscoveryPort()
+     */
+    public int getUdpDiscoveryPort()
+    {
+        return this.udpDiscoveryPort;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setUdpDiscoveryPort(int)
+     */
+    public void setUdpDiscoveryPort( int udpDiscoveryPort )
+    {
+        this.udpDiscoveryPort = udpDiscoveryPort;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getUdpDiscoveryAddr()
+     */
+    public String getUdpDiscoveryAddr()
+    {
+        return this.udpDiscoveryAddr;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setUdpDiscoveryAddr(java.lang.String)
+     */
+    public void setUdpDiscoveryAddr( String udpDiscoveryAddr )
+    {
+        this.udpDiscoveryAddr = udpDiscoveryAddr;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setAllowGet(boolean)
+     */
+    public void setAllowGet( boolean allowGet )
+    {
+        this.allowGet = allowGet;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isAllowGet()
+     */
+    public boolean isAllowGet()
+    {
+        return this.allowGet;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setAllowPut(boolean)
+     */
+    public void setAllowPut( boolean allowPut )
+    {
+        this.allowPut = allowPut;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isAllowPut()
+     */
+    public boolean isAllowPut()
+    {
+        return this.allowPut;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setIssueRemoveOnPut(boolean)
+     */
+    public void setIssueRemoveOnPut( boolean issueRemoveOnPut )
+    {
+        this.issueRemoveOnPut = issueRemoveOnPut;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isIssueRemoveOnPut()
+     */
+    public boolean isIssueRemoveOnPut()
+    {
+        return this.issueRemoveOnPut;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#copy()
+     */
+    public AuxiliaryCacheAttributes copy()
+    {
+        try
+        {
+            return (AuxiliaryCacheAttributes) this.clone();
+        }
+        catch ( Exception e )
+        {
+            //noop
+        }
+        return this;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isFilterRemoveByHashCode()
+     */
+    public boolean isFilterRemoveByHashCode()
+    {
+        return this.filterRemoveByHashCode;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setFilterRemoveByHashCode(boolean)
+     */
+    public void setFilterRemoveByHashCode( boolean filter )
+    {
+        this.filterRemoveByHashCode = filter;
+    }
+
+    /**
+     * Used to key the instance TODO create another method for this and use
+     * toString for debugging only.
+     * 
+     * @return String
+     */
+    public String toString()
+    {
+        return this.getTcpServer() + ":" + this.getTcpListenerPort();
+    }
+
+}

Added: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java?rev=289379&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java Thu Sep 15 21:37:26 2005
@@ -0,0 +1,200 @@
+package org.apache.jcs.auxiliary.lateral.socket.tcp.behavior;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
+
+/**
+ * This interface defines functions that are particular to the
+ * TCP Lateral Cache plugin.  It extends the generic LateralCacheAttributes interface
+ * which in turn extends the AuxiliaryCache interface.
+ * 
+ * @author Aaron Smuts
+ */
+public interface ITCPLateralCacheAttributes
+    extends ILateralCacheAttributes
+{
+
+    /**
+     * Sets the tcpServer attribute of the ILateralCacheAttributes object
+     * 
+     * @param val
+     *            The new tcpServer value
+     */
+    public void setTcpServer( String val );
+
+    /**
+     * Gets the tcpServer attribute of the ILateralCacheAttributes object
+     * 
+     * @return The tcpServer value
+     */
+    public String getTcpServer();
+
+    /**
+     * Sets the tcpServers attribute of the ILateralCacheAttributes object
+     * 
+     * @param val
+     *            The new tcpServers value
+     */
+    public void setTcpServers( String val );
+
+    /**
+     * Gets the tcpServers attribute of the ILateralCacheAttributes object
+     * 
+     * @return The tcpServers value
+     */
+    public String getTcpServers();
+
+    /**
+     * Sets the tcpListenerPort attribute of the ILateralCacheAttributes object
+     * 
+     * @param val
+     *            The new tcpListenerPort value
+     */
+    public void setTcpListenerPort( int val );
+
+    /**
+     * Gets the tcpListenerPort attribute of the ILateralCacheAttributes object
+     * 
+     * @return The tcpListenerPort value
+     */
+    public int getTcpListenerPort();
+    
+    /**
+     * Can setup UDP Discovery. This only works for TCp laterals right now. It
+     * allows TCP laterals to find each other by broadcasting to a multicast
+     * port.
+     * 
+     * @param udpDiscoveryEnabled
+     *            The udpDiscoveryEnabled to set.
+     */
+    public void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled );
+
+    /**
+     * Whether or not TCP laterals can try to find each other by multicast
+     * communication.
+     * 
+     * @return Returns the udpDiscoveryEnabled.
+     */
+    public boolean isUdpDiscoveryEnabled();
+
+    /**
+     * The port to use if UDPDiscovery is enabled.
+     * 
+     * @return Returns the udpDiscoveryPort.
+     */
+    public int getUdpDiscoveryPort();
+
+    /**
+     * Sets the port to use if UDPDiscovery is enabled.
+     * 
+     * @param udpDiscoveryPort
+     *            The udpDiscoveryPort to set.
+     */
+    public void setUdpDiscoveryPort( int udpDiscoveryPort );
+
+    /**
+     * The address to broadcast to if UDPDiscovery is enabled.
+     * 
+     * @return Returns the udpDiscoveryAddr.
+     */
+    public String getUdpDiscoveryAddr();
+
+    /**
+     * Sets the address to broadcast to if UDPDiscovery is enabled.
+     * 
+     * @param udpDiscoveryAddr
+     *            The udpDiscoveryAddr to set.
+     */
+    public void setUdpDiscoveryAddr( String udpDiscoveryAddr );
+    
+    
+    /**
+     * Is the lateral allowed to try and get from other laterals.
+     * <p>
+     * This replaces the old putOnlyMode
+     * 
+     * @param allowGet
+     */
+    public void setAllowGet( boolean allowGet );
+    
+    /**
+     * Is the lateral allowed to try and get from other laterals.
+     * 
+     * @return true if the lateral will try to get
+     */
+    public boolean isAllowGet();
+    
+    /**
+     * Is the lateral allowed to put objects to other laterals.
+     * 
+     * @param allowPut
+     */
+    public void setAllowPut( boolean allowPut );
+    
+    /**
+     * Is the lateral allowed to put objects to other laterals.
+     * 
+     * @return true if puts are allowed
+     */
+    public boolean isAllowPut();
+
+    /**
+     * Should the client send a remove command rather than a put when
+     * update is called.  This is a client option, not a receiver option.
+     * This allows you to prevent the lateral from serializing objects.
+     * 
+     * @param issueRemoveOnPut
+     */
+    public void setIssueRemoveOnPut( boolean issueRemoveOnPut );
+    
+    /**
+     * Should the client send a remove command rather than a put when
+     * update is called.  This is a client option, not a receiver option.
+     * This allows you to prevent the lateral from serializing objects.
+     * 
+     * @return true if updates will result in a remove command being sent.
+     */
+    public boolean isIssueRemoveOnPut();
+
+    
+    /**
+     * Should the receiver try to match hashcodes.
+     * If true, the receiver will see if the client supplied a hshcode.  
+     * If it did, then it will try to get the item locally.  If the item
+     * exists, then it will compare the hashcode.  if they are
+     * the same, it will not remove.  This isn't perfect since different objects can
+     * have the same hashcode, but it is unlikely of objects of the same
+     * type.
+     * 
+     * @return
+     */
+    public boolean isFilterRemoveByHashCode();
+    
+    /**
+     * Should the receiver try to match hashcodes.
+     * If true, the receiver will see if the client supplied a hshcode.  
+     * If it did, then it will try to get the item locally.  If the item
+     * exists, then it will compare the hashcode.  if they are
+     * the same, it will not remove.  This isn't perfect since different objects can
+     * have the same hashcode, but it is unlikely of objects of the same
+     * type.
+     * @param filter
+     */
+    public void setFilterRemoveByHashCode( boolean filter );
+    
+}

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryManager.java Thu Sep 15 21:37:26 2005
@@ -5,7 +5,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 
 /**
@@ -43,9 +43,11 @@
      * Returns the UDP Discovery service associated with this instance.
      * 
      * @param lca
+     *            ITCPLateralCacheAttributes
+     * @param cacheMgr
      * @return
      */
-    public synchronized UDPDiscoveryService getService( LateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
+    public synchronized UDPDiscoveryService getService( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
     {
         String key = lca.getTcpServer() + ":" + lca.getTcpListenerPort();
 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryMessage.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryMessage.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryMessage.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryMessage.java Thu Sep 15 21:37:26 2005
@@ -34,7 +34,7 @@
     /** Description of the Field */
     private long requesterId;
 
-    private ArrayList cacheNames = new ArrayList();;
+    private ArrayList cacheNames = new ArrayList();
 
     /**
      * @param port

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java Thu Sep 15 21:37:26 2005
@@ -31,6 +31,8 @@
 import org.apache.jcs.auxiliary.lateral.LateralCacheInfo;
 import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheManager;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.engine.behavior.ICache;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 import org.apache.jcs.engine.behavior.ShutdownObserver;
@@ -307,14 +309,14 @@
                     // get a cache and add it to the no waits
                     // the add method should not add the same.
                     // we need the listener port from the original config.
-                    LateralCacheAttributes lca = null;
-                    if ( service.getLca() != null )
+                    ITCPLateralCacheAttributes lca = null;
+                    if ( service.getTcpLateralCacheAttributes() != null )
                     {
-                        lca = (LateralCacheAttributes) service.getLca().copy();
+                        lca = (ITCPLateralCacheAttributes) service.getTcpLateralCacheAttributes().copy();
                     }
                     else
                     {
-                        lca = new LateralCacheAttributes();
+                        lca = new TCPLateralCacheAttributes();
                     }
                     lca.setTransmissionType( LateralCacheAttributes.TCP );
                     lca.setTcpServer( message.getHost() + ":" + message.getPort() );

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java Thu Sep 15 21:37:26 2005
@@ -100,6 +100,7 @@
     
     /**
      * Just being careful about closing the socket.
+     * @throws Throwable
      */
     public void finalize()
     throws Throwable

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java Thu Sep 15 21:37:26 2005
@@ -10,9 +10,9 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
 import org.apache.jcs.auxiliary.lateral.LateralCacheNoWaitFacade;
+import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 import org.apache.jcs.engine.behavior.ShutdownObservable;
 import org.apache.jcs.engine.behavior.ShutdownObserver;
@@ -33,43 +33,45 @@
  * @author Aaron Smuts
  *  
  */
-public class UDPDiscoveryService implements ShutdownObserver
+public class UDPDiscoveryService
+    implements ShutdownObserver
 {
 
     private final static Log log = LogFactory.getLog( UDPDiscoveryService.class );
 
-     //The background broadcaster.
+    //The background broadcaster.
     private static ClockDaemon senderDaemon;
 
     // thread that listens for messages
     private Thread udpReceiverThread;
-    
+
     // the runanble that the receiver thread runs
     private UDPDiscoveryReceiver receiver;
 
     private Map facades = new HashMap();
 
-    private LateralCacheAttributes lca = null;
+    private ITCPLateralCacheAttributes tcpLateralCacheAttributes = null;
 
     // the runanble that sends messages via the clock daemon
     private UDPDiscoverySenderThread sender = null;
-    
+
     private String hostAddress = "unknown";
-    
+
     /**
      * 
      * @param facade
      * @param lca
+     *            ITCPLateralCacheAttributes
      * @param cacheMgr
      * @param receivingPort
      */
-    public UDPDiscoveryService( LateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
+    public UDPDiscoveryService( ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr )
     {
         // register for shutdown notification
-        ((ShutdownObservable)cacheMgr).registerShutdownObserver( this );
+        ( (ShutdownObservable) cacheMgr ).registerShutdownObserver( this );
+
+        this.setTcpLateralCacheAttributes( lca );
 
-        this.setLca( lca );
-        
         try
         {
             // todo, you should be able to set this
@@ -88,8 +90,8 @@
         {
             // todo need some kind of recovery here.
             receiver = new UDPDiscoveryReceiver( this, lca.getUdpDiscoveryAddr(), lca.getUdpDiscoveryPort(), cacheMgr );
-            udpReceiverThread = new Thread(receiver);
-            udpReceiverThread.setDaemon(true);
+            udpReceiverThread = new Thread( receiver );
+            udpReceiverThread.setDaemon( true );
             //udpReceiverThread.setName( t.getName() + "--UDPReceiver" );
             udpReceiverThread.start();
         }
@@ -105,11 +107,11 @@
             senderDaemon = new ClockDaemon();
             senderDaemon.setThreadFactory( new MyThreadFactory() );
         }
-        
+
         // create a sender thread
-        sender = new UDPDiscoverySenderThread( lca.getUdpDiscoveryAddr(), lca
-                                      .getUdpDiscoveryPort(), hostAddress, lca.getTcpListenerPort(), this.getCacheNames() );
-        
+        sender = new UDPDiscoverySenderThread( lca.getUdpDiscoveryAddr(), lca.getUdpDiscoveryPort(), hostAddress, lca
+            .getTcpListenerPort(), this.getCacheNames() );
+
         senderDaemon.executePeriodically( 30 * 1000, sender, false );
     }
 
@@ -127,8 +129,8 @@
      */
     public synchronized boolean addNoWaitFacade( LateralCacheNoWaitFacade facade, String cacheName )
     {
-        boolean isNew = !facades.containsKey(cacheName);
-        
+        boolean isNew = !facades.containsKey( cacheName );
+
         // override or put anew, it doesn't matter
         facades.put( cacheName, facade );
 
@@ -137,10 +139,10 @@
             if ( sender != null )
             {
                 // need to reset the cache names since we have a new one
-                sender.setCacheNames( this.getCacheNames() );                            
+                sender.setCacheNames( this.getCacheNames() );
             }
         }
-        
+
         return isNew;
 
     }
@@ -179,10 +181,11 @@
     }
 
     /**
-     * Send a passive broadcast in response to a request broadcast.  Never send a request for a request.
-     * We can respond to our own reques, since a request broadcast is not intended as a connection request.
-     * We might want to only send messages, so we would send a request, but never a passive broadcast.
-     *
+     * Send a passive broadcast in response to a request broadcast. Never send a
+     * request for a request. We can respond to our own reques, since a request
+     * broadcast is not intended as a connection request. We might want to only
+     * send messages, so we would send a request, but never a passive broadcast.
+     *  
      */
     protected void serviceRequestBroadcast()
     {
@@ -191,9 +194,11 @@
         {
             // create this connection each time.
             // more robust
-            sender = new UDPDiscoverySender( getLca().getUdpDiscoveryAddr(), getLca().getUdpDiscoveryPort() );
+            sender = new UDPDiscoverySender( getTcpLateralCacheAttributes().getUdpDiscoveryAddr(),
+                                             getTcpLateralCacheAttributes().getUdpDiscoveryPort() );
 
-            sender.passiveBroadcast( hostAddress, getLca().getTcpListenerPort(), this.getCacheNames() );
+            sender.passiveBroadcast( hostAddress, getTcpLateralCacheAttributes().getTcpListenerPort(), this
+                .getCacheNames() );
 
             // todo we should consider sending a request broadcast every so
             // often.
@@ -207,23 +212,23 @@
         catch ( Exception e )
         {
             log.error( "Problem calling the UDP Discovery Sender", e );
-        }      
+        }
         finally
         {
             try
             {
                 if ( sender != null )
                 {
-                    sender.destroy();                                    
+                    sender.destroy();
                 }
             }
             catch ( Exception e )
             {
                 log.error( "Problem closing Passive Broadcast sender, while servicing a request broadcast.", e );
             }
-        }        
+        }
     }
-    
+
     /**
      * Get all the cache names we have facades for.
      * 
@@ -243,19 +248,20 @@
     }
 
     /**
-     * @param lca The lca to set.
+     * @param lca
+     *            The lca to set.
      */
-    public void setLca( LateralCacheAttributes lca )
+    public void setTcpLateralCacheAttributes( ITCPLateralCacheAttributes lca )
     {
-        this.lca = lca;
+        this.tcpLateralCacheAttributes = lca;
     }
 
     /**
      * @return Returns the lca.
      */
-    public LateralCacheAttributes getLca()
+    public ITCPLateralCacheAttributes getTcpLateralCacheAttributes()
     {
-        return lca;
+        return tcpLateralCacheAttributes;
     }
 
     /**
@@ -283,21 +289,23 @@
 
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.jcs.engine.behavior.ShutdownObserver#shutdown()
      */
     public void shutdown()
-    {   
+    {
         if ( log.isInfoEnabled() )
         {
             log.info( "Shutting down UDP discovery service receiver." );
         }
-        
+
         try
         {
             // no good way to do this right now.
-            receiver.shutdown();                        
-            udpReceiverThread.interrupt();    
+            receiver.shutdown();
+            udpReceiverThread.interrupt();
         }
         catch ( Exception e )
         {
@@ -308,9 +316,9 @@
         {
             log.info( "Shutting down UDP discovery service sender." );
         }
-        
+
         try
-        {            
+        {
             // interrupt all the threads.
             senderDaemon.shutDown();
         }
@@ -318,6 +326,6 @@
         {
             log.error( "Problem shutting down UDP sender." );
         }
-        
+
     }
 }

Modified: jakarta/jcs/trunk/src/test-conf/TestTCPLateralCache.ccf
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test-conf/TestTCPLateralCache.ccf?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test-conf/TestTCPLateralCache.ccf (original)
+++ jakarta/jcs/trunk/src/test-conf/TestTCPLateralCache.ccf Thu Sep 15 21:37:26 2005
@@ -19,10 +19,10 @@
 
 # simple Lateral TCP auxiliary
 jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
-jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
+jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
 jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
 jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
-jcs.auxiliary.LTCP.attributes.PutOnlyMode=true
+jcs.auxiliary.LTCP.attributes.AllowGet=false
 
 ##############################################################
 ################## THREAD POOL CONFIGURATION ###################

Modified: jakarta/jcs/trunk/src/test-conf/TestTCPLateralCacheConcurrent.ccf
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test-conf/TestTCPLateralCacheConcurrent.ccf?rev=289379&r1=289378&r2=289379&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test-conf/TestTCPLateralCacheConcurrent.ccf (original)
+++ jakarta/jcs/trunk/src/test-conf/TestTCPLateralCacheConcurrent.ccf Thu Sep 15 21:37:26 2005
@@ -6,10 +6,10 @@
 ##### AUXILIARY CACHES
 # simple Lateral TCP auxiliary
 jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
-jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
+jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
 jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
 #jcs.auxiliary.LTCP.attributes.TcpServers=
 jcs.auxiliary.LTCP.attributes.TcpListenerPort=1102
-jcs.auxiliary.LTCP.attributes.PutOnlyMode=true
+jcs.auxiliary.LTCP.attributes.AllowGet=false
 
 

Added: jakarta/jcs/trunk/src/test-conf/TestTCPLateralIssueRemoveCache.ccf
URL: http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test-conf/TestTCPLateralIssueRemoveCache.ccf?rev=289379&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test-conf/TestTCPLateralIssueRemoveCache.ccf (added)
+++ jakarta/jcs/trunk/src/test-conf/TestTCPLateralIssueRemoveCache.ccf Thu Sep 15 21:37:26 2005
@@ -0,0 +1,56 @@
+# Cache configuration for the 'TestDiskCache' test. The memory cache has a
+# a maximum of 100 objects, so objects should get pushed into the disk cache
+
+jcs.default=LTCP
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=10000
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+
+##### CACHE REGIONS FOR TEST
+
+jcs.region.testTcpRegion1=LTCP
+jcs.region.testTcpRegion1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.region.testTcpRegion1.cacheattributes.MaxObjects=10000
+jcs.region.testTcpRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+
+##### AUXILIARY CACHES
+
+# simple Lateral TCP auxiliary
+jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
+jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
+jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
+jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
+jcs.auxiliary.LTCP.attributes.AllowGet=false
+jcs.auxiliary.LTCP.attributes.IssueRemoveOnPut=true
+
+
+##############################################################
+################## THREAD POOL CONFIGURATION ###################
+# Default thread pool config
+thread_pool.default.boundarySize=2000
+thread_pool.default.maximumPoolSize=150
+thread_pool.default.minimumPoolSize=4
+thread_pool.default.keepAliveTime=350000
+#RUN ABORT WAIT BLOCK DISCARDOLDEST
+thread_pool.default.whenBlockedPolicy=RUN
+thread_pool.default.startUpSize=4
+
+# Default Cache Event Queue thread pool config, used by auxiliaries
+thread_pool.cache_event_queue.useBoundary=false
+#thread_pool.cache_event_queue.boundarySize=2000
+#thread_pool.cache_event_queue.maximumPoolSize=10
+thread_pool.cache_event_queue.minimumPoolSize=5
+thread_pool.cache_event_queue.keepAliveTime=3500
+#thread_pool.cache_event_queue.whenBlockedPolicy=RUN
+thread_pool.cache_event_queue.startUpSize=5
+
+# Remote cache client thread pool config
+thread_pool.remote_cache_client.boundarySize=75
+thread_pool.remote_cache_client.maximumPoolSize=150
+thread_pool.remote_cache_client.minimumPoolSize=4
+thread_pool.remote_cache_client.keepAliveTime=350000
+thread_pool.remote_cache_client.whenBlockedPolicy=RUN
+thread_pool.remote_cache_client.startUpSize=4
+



---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org