org.apache.jcs.auxiliary.lateral.socket.tcp
Class LateralTCPSender

java.lang.Object
  extended by org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPSender

public class LateralTCPSender
extends java.lang.Object

This class is based on the log4j SocketAppender class. I'm using a differnet repair structure, so it is significantly different.


Constructor Summary
LateralTCPSender(ITCPLateralCacheAttributes lca)
          Constructor for the LateralTCPSender object.
 
Method Summary
 void dispose(java.lang.String cache)
          Closes connection used by all LateralTCPSenders for this lateral conneciton.
 java.lang.String getRemoteHost()
           
 ITCPLateralCacheAttributes getTcpLateralCacheAttributes()
           
protected  void init(java.lang.String host, int port)
          Creates a connection to a TCP server.
 void send(LateralElementDescriptor led)
          Sends commands to the lateral cache listener.
 java.lang.Object sendAndReceive(LateralElementDescriptor led)
          Sends commands to the lateral cache listener and gets a response.
 void setRemoteHost(java.lang.String remoteHost)
           
 void setTcpLateralCacheAttributes(ITCPLateralCacheAttributes tcpLateralCacheAttributes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LateralTCPSender

public LateralTCPSender(ITCPLateralCacheAttributes lca)
                 throws java.io.IOException
Constructor for the LateralTCPSender object.

Parameters:
lca -
Throws:
java.io.IOException
Method Detail

init

protected void init(java.lang.String host,
                    int port)
             throws java.io.IOException
Creates a connection to a TCP server.

Parameters:
host -
port -
Throws:
java.io.IOException

send

public void send(LateralElementDescriptor led)
          throws java.io.IOException
Sends commands to the lateral cache listener.

Parameters:
led -
Throws:
java.io.IOException

sendAndReceive

public java.lang.Object sendAndReceive(LateralElementDescriptor led)
                                throws java.io.IOException
Sends commands to the lateral cache listener and gets a response. I'm afraid that we could get into a pretty bad blocking situation here. This needs work. I just wanted to get some form of get working. However, get 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.

Parameters:
led -
Returns:
ICacheElement
Throws:
java.io.IOException

dispose

public void dispose(java.lang.String cache)
             throws java.io.IOException
Closes connection used by all LateralTCPSenders for this lateral 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.

Parameters:
cache -
Throws:
java.io.IOException

setTcpLateralCacheAttributes

public void setTcpLateralCacheAttributes(ITCPLateralCacheAttributes tcpLateralCacheAttributes)
Parameters:
tcpLateralCacheAttributes - The tcpLateralCacheAttributes to set.

getTcpLateralCacheAttributes

public ITCPLateralCacheAttributes getTcpLateralCacheAttributes()
Returns:
Returns the tcpLateralCacheAttributes.

setRemoteHost

public void setRemoteHost(java.lang.String remoteHost)
Parameters:
remoteHost - The remoteHost to set.

getRemoteHost

public java.lang.String getRemoteHost()
Returns:
Returns the remoteHost.


Copyright © 2002-2010 Apache Software Foundation. All Rights Reserved.