equip.net
Class ConnectionSap

java.lang.Object
  extended byequip.net.ConnectionSap
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
ConnectionSapJcp, ConnectionSapTcp

public abstract class ConnectionSap
extends java.lang.Object
implements java.lang.Runnable

Abstract base class for a connection service access point (i.e. a network connection). A connection sap is specifically connected to another such in another process.

NB returns without having called start() on keepAliveThread - must be released to allow it to run).


Nested Class Summary
protected static class ConnectionSap.KeepAliveThreadData
          Internal class holding connection keep-alive data
 
Field Summary
protected  boolean connectedFlag
           
protected  boolean connectionTimeoutFlag
           
protected  int connectionTimeoutMs
           
protected  boolean DEBUG_TCP
           
protected  java.lang.Thread keepAliveThread
           
protected  ConnectionSap.KeepAliveThreadData keepAliveThreadData
           
protected  int keepAliveTimeMs
           
protected  int lastNewSendTimeMs
           
protected  int lastResponseTimeMs
           
protected  int lastSendTimeMs
           
protected  int localAddress
           
protected  short localPort
           
protected  java.lang.Object lock
           
protected  int nextObjectId
           
protected  int probingIntervalMs
           
protected  int recvBufSize
           
protected  int recvTimeoutMs
           
protected  int remoteAddress
           
protected  short remotePort
           
protected  int sendBufSize
           
protected  boolean slowResponseFlag
           
protected  int slowResponseTimeMs
           
protected  int status
           
 
Constructor Summary
protected ConnectionSap()
           
 
Method Summary
abstract  int cancelObject(int object_id)
           
 void close()
           
abstract  void close(boolean flushFlag)
           
 boolean getConnectedFlag()
           
 float getConnectionStrength()
           
 int getConnectionTimeout()
           
 boolean getConnectionTimeoutFlag()
           
 int getKeepAliveTime()
           
 int getLocalAddress()
           
 short getLocalPort()
           
 int getProbingInterval()
           
abstract  int getProtocol()
           
 int getRecvBufSize()
           
 int getRecvTimeout()
           
 int getRemoteAddress()
           
 short getRemotePort()
           
 int getSendBufSize()
           
 boolean getSlowResponseFlag()
           
 int getSlowResponseTime()
           
 int getStatus()
           
protected  void keepAliveThreadFn(ConnectionSap.KeepAliveThreadData data)
           
protected  void noteReceivedObject(ValueBase object)
           
abstract  ValueBase readObject()
           
 int resetConnectionTimeoutFlag()
           
 void run()
           
 void setConnectionTimeout(int timeMs)
           
 void setKeepAliveTime(int timeMs)
           
 void setProbingInterval(int timeMs)
           
 void setRecvBufSize(int size)
           
 void setRecvTimeout(int timeoutMs)
           
 void setSendBufSize(int size)
           
 void setSlowResponseTime(int timeMs)
           
abstract  int waitUntilConnected()
           
 int writeObject(ValueBase object)
           
 int writeObject(ValueBase object, boolean reliableFlag, int[] object_id, int priority)
           
protected abstract  int writeObjectLocked(ValueBase object, boolean reliableFlag, int[] object_id, int priority)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localAddress

protected int localAddress

remoteAddress

protected int remoteAddress

localPort

protected short localPort

remotePort

protected short remotePort

status

protected int status

connectedFlag

protected boolean connectedFlag

sendBufSize

protected int sendBufSize

recvBufSize

protected int recvBufSize

recvTimeoutMs

protected int recvTimeoutMs

keepAliveTimeMs

protected int keepAliveTimeMs

slowResponseTimeMs

protected int slowResponseTimeMs

slowResponseFlag

protected boolean slowResponseFlag

lastNewSendTimeMs

protected int lastNewSendTimeMs

lastResponseTimeMs

protected int lastResponseTimeMs

connectionTimeoutMs

protected int connectionTimeoutMs

connectionTimeoutFlag

protected boolean connectionTimeoutFlag

probingIntervalMs

protected int probingIntervalMs

nextObjectId

protected int nextObjectId

lock

protected java.lang.Object lock

keepAliveThread

protected java.lang.Thread keepAliveThread

keepAliveThreadData

protected ConnectionSap.KeepAliveThreadData keepAliveThreadData

lastSendTimeMs

protected int lastSendTimeMs

DEBUG_TCP

protected boolean DEBUG_TCP
Constructor Detail

ConnectionSap

protected ConnectionSap()
Method Detail

getLocalPort

public short getLocalPort()

getLocalAddress

public int getLocalAddress()

getRemotePort

public short getRemotePort()

getRemoteAddress

public int getRemoteAddress()

getProtocol

public abstract int getProtocol()

getStatus

public int getStatus()

getConnectedFlag

public boolean getConnectedFlag()

getSlowResponseFlag

public boolean getSlowResponseFlag()

getConnectionTimeoutFlag

public boolean getConnectionTimeoutFlag()

getConnectionStrength

public float getConnectionStrength()

waitUntilConnected

public abstract int waitUntilConnected()

close

public void close()

close

public abstract void close(boolean flushFlag)

writeObject

public int writeObject(ValueBase object)
                throws java.io.IOException
Throws:
java.io.IOException

writeObject

public int writeObject(ValueBase object,
                       boolean reliableFlag,
                       int[] object_id,
                       int priority)
                throws java.io.IOException
Throws:
java.io.IOException

readObject

public abstract ValueBase readObject()
                              throws java.io.IOException
Throws:
java.io.IOException

cancelObject

public abstract int cancelObject(int object_id)

setSendBufSize

public void setSendBufSize(int size)

getSendBufSize

public int getSendBufSize()

setRecvBufSize

public void setRecvBufSize(int size)

getRecvBufSize

public int getRecvBufSize()

setRecvTimeout

public void setRecvTimeout(int timeoutMs)

getRecvTimeout

public int getRecvTimeout()

setKeepAliveTime

public void setKeepAliveTime(int timeMs)

getKeepAliveTime

public int getKeepAliveTime()

setSlowResponseTime

public void setSlowResponseTime(int timeMs)

getSlowResponseTime

public int getSlowResponseTime()

setConnectionTimeout

public void setConnectionTimeout(int timeMs)

getConnectionTimeout

public int getConnectionTimeout()

resetConnectionTimeoutFlag

public int resetConnectionTimeoutFlag()

setProbingInterval

public void setProbingInterval(int timeMs)

getProbingInterval

public int getProbingInterval()

writeObjectLocked

protected abstract int writeObjectLocked(ValueBase object,
                                         boolean reliableFlag,
                                         int[] object_id,
                                         int priority)
                                  throws java.io.IOException
Throws:
java.io.IOException

run

public void run()
Specified by:
run in interface java.lang.Runnable

keepAliveThreadFn

protected void keepAliveThreadFn(ConnectionSap.KeepAliveThreadData data)

noteReceivedObject

protected void noteReceivedObject(ValueBase object)