You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2020/04/13 14:04:31 UTC

[commons-jcs] branch master updated (e7d5336 -> 1f9ad7b)

This is an automated email from the ASF dual-hosted git repository.

tv pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git.


    from e7d5336  Fix log message
     new a842bfa  JCS-166 Specify interface to listen on
     new 1f9ad7b  Specify multicast interface

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 commons-jcs-core/pom.xml                           |  3 -
 .../lateral/socket/tcp/LateralTCPListener.java     | 28 +++++++---
 .../socket/tcp/TCPLateralCacheAttributes.java      | 28 +++++++++-
 .../tcp/behavior/ITCPLateralCacheAttributes.java   | 15 +++++
 .../utils/discovery/UDPDiscoveryAttributes.java    | 19 +++++++
 .../jcs/utils/discovery/UDPDiscoveryReceiver.java  | 65 +++++++++++++---------
 .../jcs/utils/discovery/UDPDiscoveryService.java   |  6 +-
 .../lateral/socket/tcp/TestTCPLateralUnitTest.java | 35 ++++++------
 .../discovery/UDPDiscoverySenderUnitTest.java      |  2 +-
 .../jcs/utils/discovery/UDPDiscoveryUnitTest.java  |  6 +-
 .../src/test/test-conf/TestTCPLateralCache.ccf     |  1 +
 xdocs/LateralTCPProperties.xml                     |  6 ++
 xdocs/LateralUDPDiscovery.xml                      | 23 ++++++++
 13 files changed, 178 insertions(+), 59 deletions(-)


[commons-jcs] 02/02: Specify multicast interface

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit 1f9ad7b9bc3ea9e7ab90eddd4b33cc6ae9955a55
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Mon Apr 13 16:04:19 2020 +0200

    Specify multicast interface
---
 commons-jcs-core/pom.xml                           |  3 -
 .../utils/discovery/UDPDiscoveryAttributes.java    | 19 +++++++
 .../jcs/utils/discovery/UDPDiscoveryReceiver.java  | 65 +++++++++++++---------
 .../jcs/utils/discovery/UDPDiscoveryService.java   |  6 +-
 .../discovery/UDPDiscoverySenderUnitTest.java      |  2 +-
 .../jcs/utils/discovery/UDPDiscoveryUnitTest.java  |  6 +-
 xdocs/LateralUDPDiscovery.xml                      | 23 ++++++++
 7 files changed, 90 insertions(+), 34 deletions(-)

diff --git a/commons-jcs-core/pom.xml b/commons-jcs-core/pom.xml
index be95c6d..66fc82d 100644
--- a/commons-jcs-core/pom.xml
+++ b/commons-jcs-core/pom.xml
@@ -129,9 +129,6 @@
                   Several of the test cases rely on background tasks that are timing
                   sensitive.
               -->
-              <!-- You need to manually run these test cases. -->
-              <exclude>**/TestTCPLateralUnitTest.java</exclude>
-              <exclude>**/UDPDiscoveryUnitTest.java</exclude>
               <!-- Causes hang in Continuum -->
               <exclude>**/UDPDiscoverySenderUnitTest.java</exclude>
             </excludes>
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryAttributes.java
index e89664e..8a8e58a 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryAttributes.java
@@ -52,6 +52,9 @@ public final class UDPDiscoveryAttributes
     /** udp discovery address */
     private String udpDiscoveryAddr = DEFAULT_UDP_DISCOVERY_ADDRESS;
 
+    /** udp discovery network interface */
+    private String udpDiscoveryInterface = null;
+
     /** udp discovery port */
     private int udpDiscoveryPort = DEFAULT_UDP_DISCOVERY_PORT;
 
@@ -132,6 +135,22 @@ public final class UDPDiscoveryAttributes
     }
 
     /**
+     * @param udpDiscoveryInterface The udpDiscoveryInterface to set.
+     */
+    public void setUdpDiscoveryInterface( String udpDiscoveryInterface )
+    {
+        this.udpDiscoveryInterface = udpDiscoveryInterface;
+    }
+
+    /**
+     * @return Returns the udpDiscoveryInterface.
+     */
+    public String getUdpDiscoveryInterface()
+    {
+        return udpDiscoveryInterface;
+    }
+
+    /**
      * @param udpDiscoveryPort The udpDiscoveryPort to set.
      */
     public void setUdpDiscoveryPort( int udpDiscoveryPort )
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java
index 0438ee3..7d2ea6a 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryReceiver.java
@@ -68,11 +68,8 @@ public class UDPDiscoveryReceiver
     /** Service to get cache names and handle request broadcasts */
     private final UDPDiscoveryService service;
 
-    /** Address */
-    private final String multicastAddressString;
-
-    /** The port */
-    private final int multicastPort;
+    /** Multicast address */
+    private final InetAddress multicastAddress;
 
     /** Is it shutdown. */
     private boolean shutdown = false;
@@ -83,16 +80,17 @@ public class UDPDiscoveryReceiver
      * We determine out own host using InetAddress
      *<p>
      * @param service
+     * @param multicastInterfaceString
      * @param multicastAddressString
      * @param multicastPort
      * @throws IOException
      */
-    public UDPDiscoveryReceiver( UDPDiscoveryService service, String multicastAddressString, int multicastPort )
+    public UDPDiscoveryReceiver( UDPDiscoveryService service, String multicastInterfaceString,
+            String multicastAddressString, int multicastPort )
         throws IOException
     {
         this.service = service;
-        this.multicastAddressString = multicastAddressString;
-        this.multicastPort = multicastPort;
+        this.multicastAddress = InetAddress.getByName( multicastAddressString );
 
         // create a small thread pool to handle a barrage
         this.pooledExecutor = ThreadPoolManager.getInstance().createPool(
@@ -100,41 +98,53 @@ public class UDPDiscoveryReceiver
         		        WhenBlockedPolicy.DISCARDOLDEST, maxPoolSize),
         		"JCS-UDPDiscoveryReceiver-", Thread.MIN_PRIORITY);
 
-        log.info( "Constructing listener, [{0}:{1}]",
-                this.multicastAddressString, this.multicastPort );
+        log.info( "Constructing listener, [{0}:{1}]", multicastAddress, multicastPort );
 
-        createSocket( this.multicastAddressString, this.multicastPort );
+        createSocket( multicastInterfaceString, multicastAddress, multicastPort );
     }
 
     /**
      * Creates the socket for this class.
      * <p>
-     * @param multicastAddressString
+     * @param multicastInterfaceString
+     * @param multicastAddress
      * @param multicastPort
      * @throws IOException
      */
-    private void createSocket( String multicastAddressString, int multicastPort )
+    private void createSocket( String multicastInterfaceString, InetAddress multicastAddress,
+            int multicastPort )
         throws IOException
     {
         try
         {
             mSocket = new MulticastSocket( multicastPort );
-            InetAddress multicastAddress = InetAddress.getByName( multicastAddressString );
             if (log.isInfoEnabled())
             {
                 log.info( "Joining Group: [{0}]", multicastAddress );
             }
-            NetworkInterface multicastInterface = HostNameUtil.getMulticastNetworkInterface();
+
+            // Use dedicated interface if specified
+            NetworkInterface multicastInterface = null;
+            if (multicastInterfaceString != null)
+            {
+                multicastInterface = NetworkInterface.getByName(multicastInterfaceString);
+            }
+            else
+            {
+                multicastInterface = HostNameUtil.getMulticastNetworkInterface();
+            }
             if (multicastInterface != null)
             {
+                log.info("Using network interface {0}", multicastInterface.getDisplayName());
                 mSocket.setNetworkInterface(multicastInterface);
             }
+
             mSocket.joinGroup( multicastAddress );
         }
         catch ( IOException e )
         {
-            log.error( "Could not bind to multicast address [{0}:{1}]",
-                    InetAddress.getByName( multicastAddressString ), multicastPort, e );
+            log.error( "Could not bind to multicast address [{0}:{1}]", multicastAddress,
+                    multicastPort, e );
             throw e;
         }
     }
@@ -338,16 +348,19 @@ public class UDPDiscoveryReceiver
     @Override
     public void shutdown()
     {
-        try
+        if (!shutdown)
         {
-            shutdown = true;
-            mSocket.leaveGroup( InetAddress.getByName( multicastAddressString ) );
-            mSocket.close();
-            pooledExecutor.shutdownNow();
-        }
-        catch ( IOException e )
-        {
-            log.error( "Problem closing socket" );
+            try
+            {
+                shutdown = true;
+                mSocket.leaveGroup( multicastAddress );
+                mSocket.close();
+                pooledExecutor.shutdownNow();
+            }
+            catch ( IOException e )
+            {
+                log.error( "Problem closing socket" );
+            }
         }
     }
 }
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
index 04ac502..107851a 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryService.java
@@ -94,8 +94,10 @@ public class UDPDiscoveryService
         try
         {
             // todo need some kind of recovery here.
-            receiver = new UDPDiscoveryReceiver( this, getUdpDiscoveryAttributes().getUdpDiscoveryAddr(),
-                                                 getUdpDiscoveryAttributes().getUdpDiscoveryPort() );
+            receiver = new UDPDiscoveryReceiver( this,
+                    getUdpDiscoveryAttributes().getUdpDiscoveryInterface(),
+                    getUdpDiscoveryAttributes().getUdpDiscoveryAddr(),
+                    getUdpDiscoveryAttributes().getUdpDiscoveryPort() );
         }
         catch ( IOException e )
         {
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
index c47b52e..e88930b 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoverySenderUnitTest.java
@@ -60,7 +60,7 @@ public class UDPDiscoverySenderUnitTest
         throws Exception
     {
         super.setUp();
-        receiver = new UDPDiscoveryReceiver( null, ADDRESS, PORT );
+        receiver = new UDPDiscoveryReceiver( null, null, ADDRESS, PORT );
         sender = new UDPDiscoverySender( ADDRESS, PORT );
     }
 
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryUnitTest.java
index 6a83885..c070a53 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/utils/discovery/UDPDiscoveryUnitTest.java
@@ -52,8 +52,10 @@ public class UDPDiscoveryUnitTest
         service.addDiscoveryListener( discoveryListener );
 
         // create a receiver with the service
-        UDPDiscoveryReceiver receiver = new UDPDiscoveryReceiver( service, attributes.getUdpDiscoveryAddr(), attributes
-            .getUdpDiscoveryPort() );
+        UDPDiscoveryReceiver receiver = new UDPDiscoveryReceiver( service,
+                null,
+                attributes.getUdpDiscoveryAddr(),
+                attributes.getUdpDiscoveryPort() );
         Thread t = new Thread( receiver );
         t.start();
 
diff --git a/xdocs/LateralUDPDiscovery.xml b/xdocs/LateralUDPDiscovery.xml
index cf41eee..b19dbc6 100644
--- a/xdocs/LateralUDPDiscovery.xml
+++ b/xdocs/LateralUDPDiscovery.xml
@@ -67,6 +67,29 @@ jcs.auxiliary.LTCP.attributes.UdpDiscoveryPort=6780
 jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=true
         ]]></source>
       </subsection>
+      <subsection name="Multi-homed hosts">
+        <p>
+          On machines that have several network interfaces, it might be
+          desirable to fix the interface that is used for multicast.
+          For this purpose, the network interface can be specified in the 
+          configuration (see below).
+        </p>
+        <p>
+          If the network interface is not specified, JCS tries to detect a 
+          suitable interface. The selected interface is logged on INFO level.
+          Search for the message "Using network interface" in your log file.
+        </p>
+        <source><![CDATA[
+jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
+jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
+jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
+jcs.auxiliary.LTCP.attributes.PutOnlyMode=true
+jcs.auxiliary.LTCP.attributes.UdpDiscoveryInterface=en0
+jcs.auxiliary.LTCP.attributes.UdpDiscoveryAddr=228.5.6.8
+jcs.auxiliary.LTCP.attributes.UdpDiscoveryPort=6780
+jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=true
+        ]]></source>
+      </subsection>
     </section>
   </body>
 </document>


[commons-jcs] 01/02: JCS-166 Specify interface to listen on

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit a842bfa0515f68ad9d3e225b7713cf772083c293
Author: Thomas Vandahl <tv...@apache.org>
AuthorDate: Mon Apr 13 16:03:19 2020 +0200

    JCS-166 Specify interface to listen on
---
 .../lateral/socket/tcp/LateralTCPListener.java     | 28 ++++++++++++-----
 .../socket/tcp/TCPLateralCacheAttributes.java      | 28 ++++++++++++++++-
 .../tcp/behavior/ITCPLateralCacheAttributes.java   | 15 ++++++++++
 .../lateral/socket/tcp/TestTCPLateralUnitTest.java | 35 +++++++++++-----------
 .../src/test/test-conf/TestTCPLateralCache.ccf     |  1 +
 xdocs/LateralTCPProperties.xml                     |  6 ++++
 6 files changed, 88 insertions(+), 25 deletions(-)

diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
index a2c2c36..e33e82e 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
@@ -25,8 +25,10 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
+import java.net.SocketAddress;
 import java.net.SocketException;
 import java.net.SocketTimeoutException;
 import java.util.Map;
@@ -76,9 +78,6 @@ public class LateralTCPListener<K, V>
     /** Configuration attributes */
     private ITCPLateralCacheAttributes tcpLateralCacheAttributes;
 
-    /** Listening port */
-    private int port;
-
     /** The processor. We should probably use an event queue here. */
     private ExecutorService pooledExecutor;
 
@@ -149,16 +148,31 @@ public class LateralTCPListener<K, V>
     {
         try
         {
-            this.port = getTcpLateralCacheAttributes().getTcpListenerPort();
+            int port = getTcpLateralCacheAttributes().getTcpListenerPort();
+            String host = getTcpLateralCacheAttributes().getTcpListenerHost();
 
             pooledExecutor = Executors.newCachedThreadPool(
                     new DaemonThreadFactory("JCS-LateralTCPListener-"));
             terminated = new AtomicBoolean(false);
             shutdown = new AtomicBoolean(false);
 
-            log.info( "Listening on port {0}", port );
-
-            ServerSocket serverSocket = new ServerSocket( port );
+            ServerSocket serverSocket;
+            if (host != null && host.length() > 0)
+            {
+                log.info( "Listening on {0}:{1}", host, port );
+                // Resolve host name
+                InetAddress inetAddress = InetAddress.getByName(host);
+                //Bind the SocketAddress with inetAddress and port
+                SocketAddress endPoint = new InetSocketAddress(inetAddress, port);
+
+                serverSocket = new ServerSocket();
+                serverSocket.bind(endPoint);
+            }
+            else
+            {
+                log.info( "Listening on port {0}", port );
+                serverSocket = new ServerSocket( port );
+            }
             serverSocket.setSoTimeout( acceptTimeOut );
 
             receiver = new ListenerThread(serverSocket);
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
index cac34db..26ed199 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TCPLateralCacheAttributes.java
@@ -66,9 +66,12 @@ public class TCPLateralCacheAttributes
     /** used to identify the service that this manager will be operating on */
     private String tcpServer = "";
 
-    /** The pot */
+    /** The port */
     private int tcpListenerPort = 0;
 
+    /** The host */
+    private String tcpListenerHost = "";
+
     /** udp discovery for tcp server */
     private String udpDiscoveryAddr = DEFAULT_UDP_DISCOVERY_ADDRESS;
 
@@ -163,6 +166,29 @@ public class TCPLateralCacheAttributes
     }
 
     /**
+     * Sets the tcpListenerHost attribute of the ILateralCacheAttributes object
+     * <p>
+     * @param val
+     *            The new tcpListenerHost value
+     */
+    @Override
+    public void setTcpListenerHost( String val )
+    {
+        this.tcpListenerHost = val;
+    }
+
+    /**
+     * Gets the tcpListenerHost attribute of the ILateralCacheAttributes object
+     * <p>
+     * @return The tcpListenerHost value
+     */
+    @Override
+    public String getTcpListenerHost()
+    {
+        return this.tcpListenerHost;
+    }
+
+    /**
      * 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.
      * <p>
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java
index db12800..7ffd3bc 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/behavior/ITCPLateralCacheAttributes.java
@@ -77,6 +77,21 @@ public interface ITCPLateralCacheAttributes
     int getTcpListenerPort();
 
     /**
+     * Sets the tcpListenerHost attribute of the ILateralCacheAttributes object
+     * <p>
+     * @param val
+     *            The new tcpListenerHost value
+     */
+    void setTcpListenerHost( String val );
+
+    /**
+     * Gets the tcpListenerHost attribute of the ILateralCacheAttributes object
+     * <p>
+     * @return The tcpListenerHost value
+     */
+    String getTcpListenerHost();
+
+    /**
      * 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.
diff --git a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
index 4f34f80..631ff0a 100644
--- a/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
+++ b/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
@@ -1,5 +1,22 @@
 package org.apache.commons.jcs.auxiliary.lateral.socket.tcp;
 
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.auxiliary.lateral.LateralCacheAttributes;
+import org.apache.commons.jcs.auxiliary.lateral.LateralCommand;
+import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor;
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+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.control.MockCompositeCacheManager;
+import org.apache.commons.jcs.engine.control.group.GroupAttrName;
+import org.apache.commons.jcs.engine.control.group.GroupId;
+import org.apache.commons.jcs.utils.timing.SleepUtil;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,22 +37,6 @@ package org.apache.commons.jcs.auxiliary.lateral.socket.tcp;
  */
 
 import junit.framework.TestCase;
-import org.apache.commons.jcs.JCS;
-import org.apache.commons.jcs.auxiliary.lateral.LateralCacheAttributes;
-import org.apache.commons.jcs.auxiliary.lateral.LateralCommand;
-import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor;
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-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.control.MockCompositeCacheManager;
-import org.apache.commons.jcs.engine.control.group.GroupAttrName;
-import org.apache.commons.jcs.engine.control.group.GroupId;
-import org.apache.commons.jcs.utils.timing.SleepUtil;
-
-import java.util.Map;
-import java.util.Set;
 
 /**
  * Basic unit tests for the sending and receiving portions of the lateral cache.
@@ -313,7 +314,7 @@ public class TestTCPLateralUnitTest
 
         // VERIFY
         assertNotNull( "Result should not be null.", result );
-        assertEquals( "Didn't get the correct object", "key", result.toArray()[0] );
+        assertEquals( "Didn't get the correct object", "key", result.iterator().next().attrName );
     }
 
     /**
diff --git a/commons-jcs-core/src/test/test-conf/TestTCPLateralCache.ccf b/commons-jcs-core/src/test/test-conf/TestTCPLateralCache.ccf
index 230c1cc..bf6e941 100644
--- a/commons-jcs-core/src/test/test-conf/TestTCPLateralCache.ccf
+++ b/commons-jcs-core/src/test/test-conf/TestTCPLateralCache.ccf
@@ -38,6 +38,7 @@ jcs.auxiliary.LTCP=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.LateralTC
 jcs.auxiliary.LTCP.attributes=org.apache.commons.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
 jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
 jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
+jcs.auxiliary.LTCP.attributes.TcpListenerHost=localhost
 jcs.auxiliary.LTCP.attributes.AllowGet=false
 jcs.auxiliary.LTCP.attributes.SocketTimeOut=1001
 jcs.auxiliary.LTCP.attributes.OpenTimeOut=2002
diff --git a/xdocs/LateralTCPProperties.xml b/xdocs/LateralTCPProperties.xml
index 9444d8e..7c265a0 100644
--- a/xdocs/LateralTCPProperties.xml
+++ b/xdocs/LateralTCPProperties.xml
@@ -37,6 +37,12 @@
 						<td>N</td>
 						<td>none</td>
 					</tr>
+                    <tr>
+                        <td>TcpListenerHost</td>
+                        <td> This is the host this cache should listen on (for multi-homed hosts).</td>
+                        <td>Y</td>
+                        <td>listen on all interfaces</td>
+                    </tr>
 					<tr>
 						<td>TcpListenerPort</td>
 						<td> This is the port this cache should listen on.</td>