Class SSLClient
- java.lang.Object
-
- org.eclipse.ecf.provider.comm.tcp.SSLClient
-
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable,IAsynchConnection,IConnection,ISynchAsynchConnection,ISynchConnection
public final class SSLClient extends Object implements ISynchAsynchConnection
- Since:
- 4.3
-
-
Field Summary
Fields Modifier and Type Field Description protected longcloseTimeoutprotected IDcontainerIDstatic longDEFAULT_CLOSE_TIMEOUTstatic intDEFAULT_MAX_BUFFER_MSGstatic intDEFAULT_RCVR_PRIORITYstatic intDEFAULT_SNDR_PRIORITYstatic intDEFAULT_WAIT_INTERVALprotected ISynchAsynchEventHandlerhandlerprotected ObjectInputStreaminputStreamprotected booleanisClosingprotected intkeepAliveprotected ThreadkeepAliveThreadprotected ObjectOutputStreamoutputStreamprotected ObjectoutputStreamLockprotected PingMessagepingprotected ObjectpingLockprotected PingResponseMessagepingRespprotected Mappropertiesstatic StringPROTOCOLprotected SimpleFIFOQueuequeueprotected ThreadrcvThreadprotected ThreadsendThreadprotected Socketsocketprotected booleanwaitForPing
-
Constructor Summary
Constructors Constructor Description SSLClient(Socket aSocket, ObjectInputStream iStream, ObjectOutputStream oStream, ISynchAsynchEventHandler handler)SSLClient(Socket aSocket, ObjectInputStream iStream, ObjectOutputStream oStream, ISynchAsynchEventHandler handler, int maxmsgs)SSLClient(ISynchAsynchEventHandler handler, int keepAlive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(IConnectionListener l)Add comm layer event listenerObjectconnect(ID remote, Object data, int timeout)Connect to a remote processprotected voiddebug(String msg)voiddisconnect()DisconnectObjectgetAdapter(Class clazz)IDgetLocalID()Get local ID for this connectionMapgetProperties()Get properties for this connectionbooleanisConnected()booleanisStarted()voidqueueObject(ID recipient, Serializable obj)voidremoveListener(IConnectionListener l)remove comm layer event listenervoidsendAsynch(ID recipient, byte[] obj)Send data asynchronously.voidsendAsynch(ID recipient, Object obj)SerializablesendObject(ID recipient, Serializable obj)ObjectsendSynch(ID rec, byte[] obj)Send data synchronously, blocking until a result is receivedObjectsendSynch(ID rec, Object obj)voidsetCloseTimeout(long t)voidsetProperties(Map props)voidstart()Start connectionvoidstop()Stop connectionprotected voidtraceStack(String msg, Throwable e)
-
-
-
Field Detail
-
PROTOCOL
public static final String PROTOCOL
- See Also:
- Constant Field Values
-
DEFAULT_SNDR_PRIORITY
public static final int DEFAULT_SNDR_PRIORITY
- See Also:
- Constant Field Values
-
DEFAULT_RCVR_PRIORITY
public static final int DEFAULT_RCVR_PRIORITY
- See Also:
- Constant Field Values
-
DEFAULT_CLOSE_TIMEOUT
public static final long DEFAULT_CLOSE_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_MAX_BUFFER_MSG
public static final int DEFAULT_MAX_BUFFER_MSG
- See Also:
- Constant Field Values
-
DEFAULT_WAIT_INTERVAL
public static final int DEFAULT_WAIT_INTERVAL
- See Also:
- Constant Field Values
-
socket
protected Socket socket
-
outputStream
protected ObjectOutputStream outputStream
-
inputStream
protected ObjectInputStream inputStream
-
handler
protected ISynchAsynchEventHandler handler
-
queue
protected SimpleFIFOQueue queue
-
keepAlive
protected int keepAlive
-
sendThread
protected Thread sendThread
-
rcvThread
protected Thread rcvThread
-
keepAliveThread
protected Thread keepAliveThread
-
isClosing
protected boolean isClosing
-
waitForPing
protected boolean waitForPing
-
ping
protected PingMessage ping
-
pingResp
protected PingResponseMessage pingResp
-
closeTimeout
protected long closeTimeout
-
properties
protected Map properties
-
containerID
protected ID containerID
-
pingLock
protected Object pingLock
-
outputStreamLock
protected final Object outputStreamLock
-
-
Constructor Detail
-
SSLClient
public SSLClient(Socket aSocket, ObjectInputStream iStream, ObjectOutputStream oStream, ISynchAsynchEventHandler handler) throws IOException
- Throws:
IOException
-
SSLClient
public SSLClient(Socket aSocket, ObjectInputStream iStream, ObjectOutputStream oStream, ISynchAsynchEventHandler handler, int maxmsgs) throws IOException
- Throws:
IOException
-
SSLClient
public SSLClient(ISynchAsynchEventHandler handler, int keepAlive)
-
-
Method Detail
-
getLocalID
public ID getLocalID()
Description copied from interface:IConnectionGet local ID for this connection- Specified by:
getLocalIDin interfaceIConnection- Returns:
- ID associated with local instance
-
removeListener
public void removeListener(IConnectionListener l)
Description copied from interface:IConnectionremove comm layer event listener- Specified by:
removeListenerin interfaceIConnection- Parameters:
l- the listener to remove
-
addListener
public void addListener(IConnectionListener l)
Description copied from interface:IConnectionAdd comm layer event listener- Specified by:
addListenerin interfaceIConnection- Parameters:
l- the listener to add
-
isConnected
public boolean isConnected()
- Specified by:
isConnectedin interfaceIConnection- Returns:
- true if the implementing class has been previously connected, false if not connected
-
isStarted
public boolean isStarted()
- Specified by:
isStartedin interfaceIConnection- Returns:
- true if connection is started, false otherwise
-
connect
public Object connect(ID remote, Object data, int timeout) throws ECFException
Description copied from interface:IConnectionConnect to a remote process- Specified by:
connectin interfaceIConnection- Parameters:
remote- the identity of the remote to connect to. Must not benull.data- any data to send with the connection request (e.g. password or other authentication data)timeout- the timeout (in ms) for the connection to occur- Returns:
- a result object that is of type specific to provider implementation
- Throws:
ECFException- thrown if some problem with connect
-
setCloseTimeout
public void setCloseTimeout(long t)
-
start
public void start()
Description copied from interface:IConnectionStart connection- Specified by:
startin interfaceIConnection
-
stop
public void stop()
Description copied from interface:IConnectionStop connection- Specified by:
stopin interfaceIConnection
-
disconnect
public void disconnect()
Description copied from interface:IConnectionDisconnect- Specified by:
disconnectin interfaceIConnection
-
sendAsynch
public void sendAsynch(ID recipient, byte[] obj) throws IOException
Description copied from interface:IAsynchConnectionSend data asynchronously. Implementing classes should not block on sending the given data and return immediately.- Specified by:
sendAsynchin interfaceIAsynchConnection- Parameters:
recipient- the ID of the intended receiverobj- the data to send- Throws:
IOException- thrown if data cannot be sent (e.g. disconnected)
-
sendAsynch
public void sendAsynch(ID recipient, Object obj) throws IOException
- Throws:
IOException
-
queueObject
public void queueObject(ID recipient, Serializable obj) throws IOException
- Throws:
IOException
-
sendObject
public Serializable sendObject(ID recipient, Serializable obj) throws IOException
- Throws:
IOException
-
sendSynch
public Object sendSynch(ID rec, Object obj) throws IOException
- Throws:
IOException
-
sendSynch
public Object sendSynch(ID rec, byte[] obj) throws IOException
Description copied from interface:ISynchConnectionSend data synchronously, blocking until a result is received- Specified by:
sendSynchin interfaceISynchConnection- Parameters:
rec- the receiver to receive the synchronous requestobj- the data to send- Returns:
- the data received. The return type will be specific to the provider implementation.
- Throws:
IOException- thrown if sending cannot occur (e.g. not connected)
-
getProperties
public Map getProperties()
Description copied from interface:IConnectionGet properties for this connection- Specified by:
getPropertiesin interfaceIConnection- Returns:
- Map the properties associated with this connection. May be null.
-
getAdapter
public Object getAdapter(Class clazz)
- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable
-
debug
protected void debug(String msg)
-
setProperties
public void setProperties(Map props)
-
-