Class Client
java.lang.Object
org.eclipse.ecf.provider.comm.tcp.Client
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable
,IAsynchConnection
,IConnection
,ISynchAsynchConnection
,ISynchConnection
-
Field Summary
Modifier and TypeFieldDescriptionprotected long
protected ID
static final long
static final int
static final int
static final int
static final int
protected ISynchAsynchEventHandler
protected ObjectInputStream
protected boolean
protected int
protected Thread
protected ObjectOutputStream
protected final Object
protected PingMessage
protected Object
protected PingResponseMessage
protected Map
static final String
protected SimpleFIFOQueue
protected Thread
protected Thread
protected Socket
protected boolean
-
Constructor Summary
ConstructorDescriptionClient
(Socket aSocket, ObjectInputStream iStream, ObjectOutputStream oStream, ISynchAsynchEventHandler handler) Client
(Socket aSocket, ObjectInputStream iStream, ObjectOutputStream oStream, ISynchAsynchEventHandler handler, int maxmsgs) Client
(ISynchAsynchEventHandler handler, int keepAlive) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add comm layer event listenerConnect to a remote processprotected Socket
createConnectSocket
(URI remote, int timeout) protected void
void
DisconnectgetAdapter
(Class clazz) Get local ID for this connectionGet properties for this connectionboolean
boolean
protected URI
parseRemoteID
(ID remote) void
queueObject
(ID recipient, Serializable obj) void
remove comm layer event listenervoid
sendAsynch
(ID recipient, byte[] obj) Send data asynchronously.void
sendAsynch
(ID recipient, Object obj) sendObject
(ID recipient, Serializable obj) Send data synchronously, blocking until a result is receivedvoid
setCloseTimeout
(long t) void
setProperties
(Map props) void
start()
Start connectionvoid
stop()
Stop connectionprotected void
traceStack
(String msg, Throwable e)
-
Field Details
-
PROTOCOL
- See Also:
-
DEFAULT_SNDR_PRIORITY
public static final int DEFAULT_SNDR_PRIORITY- See Also:
-
DEFAULT_RCVR_PRIORITY
public static final int DEFAULT_RCVR_PRIORITY- See Also:
-
DEFAULT_CLOSE_TIMEOUT
public static final long DEFAULT_CLOSE_TIMEOUT -
DEFAULT_MAX_BUFFER_MSG
public static final int DEFAULT_MAX_BUFFER_MSG -
DEFAULT_WAIT_INTERVAL
public static final int DEFAULT_WAIT_INTERVAL -
socket
-
outputStream
-
inputStream
-
handler
-
queue
-
keepAlive
protected int keepAlive -
sendThread
-
rcvThread
-
keepAliveThread
-
isClosing
protected boolean isClosing -
waitForPing
protected boolean waitForPing -
ping
-
pingResp
-
closeTimeout
protected long closeTimeout -
properties
-
containerID
-
pingLock
-
outputStreamLock
-
-
Constructor Details
-
Client
public Client(Socket aSocket, ObjectInputStream iStream, ObjectOutputStream oStream, ISynchAsynchEventHandler handler) throws IOException - Throws:
IOException
-
Client
public Client(Socket aSocket, ObjectInputStream iStream, ObjectOutputStream oStream, ISynchAsynchEventHandler handler, int maxmsgs) throws IOException - Throws:
IOException
-
Client
-
-
Method Details
-
getLocalID
Description copied from interface:IConnection
Get local ID for this connection- Specified by:
getLocalID
in interfaceIConnection
- Returns:
- ID associated with local instance
-
removeListener
Description copied from interface:IConnection
remove comm layer event listener- Specified by:
removeListener
in interfaceIConnection
- Parameters:
l
- the listener to remove
-
addListener
Description copied from interface:IConnection
Add comm layer event listener- Specified by:
addListener
in interfaceIConnection
- Parameters:
l
- the listener to add
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceIConnection
- Returns:
- true if the implementing class has been previously connected, false if not connected
-
isStarted
public boolean isStarted()- Specified by:
isStarted
in interfaceIConnection
- Returns:
- true if connection is started, false otherwise
-
createConnectSocket
- Parameters:
remote
- remote URItimeout
- timeout- Returns:
- Socket the created socket
- Throws:
ECFException
- if socket cannot be created for input parameters- Since:
- 4.4
-
parseRemoteID
- Parameters:
remote
- the remtoe ID- Returns:
- URI the parsed remote ID
- Throws:
ECFException
- if remote ID cannot be parsed- Since:
- 4.4
-
connect
Description copied from interface:IConnection
Connect to a remote process- Specified by:
connect
in 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:IConnection
Start connection- Specified by:
start
in interfaceIConnection
-
stop
public void stop()Description copied from interface:IConnection
Stop connection- Specified by:
stop
in interfaceIConnection
-
disconnect
public void disconnect()Description copied from interface:IConnection
Disconnect- Specified by:
disconnect
in interfaceIConnection
-
sendAsynch
Description copied from interface:IAsynchConnection
Send data asynchronously. Implementing classes should not block on sending the given data and return immediately.- Specified by:
sendAsynch
in 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
- Throws:
IOException
-
queueObject
- Throws:
IOException
-
sendObject
- Throws:
IOException
-
sendSynch
- Throws:
IOException
-
sendSynch
Description copied from interface:ISynchConnection
Send data synchronously, blocking until a result is received- Specified by:
sendSynch
in 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
Description copied from interface:IConnection
Get properties for this connection- Specified by:
getProperties
in interfaceIConnection
- Returns:
- Map the properties associated with this connection. May be null.
-
getAdapter
- Specified by:
getAdapter
in interfaceorg.eclipse.core.runtime.IAdaptable
-
debug
-
traceStack
-
setProperties
-
getOutputStreamLock
- Returns:
- Object the output stream lock
- Since:
- 4.6
-