Class Client

    • Field Detail

      • 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

        protected Socket socket
      • keepAlive

        protected int keepAlive
      • sendThread

        protected Thread sendThread
      • rcvThread

        protected Thread rcvThread
      • keepAliveThread

        protected Thread keepAliveThread
      • isClosing

        protected boolean isClosing
      • waitForPing

        protected boolean waitForPing
      • closeTimeout

        protected long closeTimeout
      • properties

        protected Map properties
      • containerID

        protected ID containerID
      • pingLock

        protected Object pingLock
      • outputStreamLock

        protected final Object outputStreamLock
    • Method Detail

      • getLocalID

        public ID getLocalID()
        Description copied from interface: IConnection
        Get local ID for this connection
        Specified by:
        getLocalID in interface IConnection
        Returns:
        ID associated with local instance
      • isConnected

        public boolean isConnected()
        Specified by:
        isConnected in interface IConnection
        Returns:
        true if the implementing class has been previously connected, false if not connected
      • isStarted

        public boolean isStarted()
        Specified by:
        isStarted in interface IConnection
        Returns:
        true if connection is started, false otherwise
      • createConnectSocket

        protected Socket createConnectSocket​(URI remote,
                                             int timeout)
                                      throws ECFException
        Parameters:
        remote - remote URI
        timeout - timeout
        Returns:
        Socket the created socket
        Throws:
        ECFException - if socket cannot be created for input parameters
        Since:
        4.4
      • parseRemoteID

        protected URI parseRemoteID​(ID remote)
                             throws ECFException
        Parameters:
        remote - the remtoe ID
        Returns:
        URI the parsed remote ID
        Throws:
        ECFException - if remote ID cannot be parsed
        Since:
        4.4
      • connect

        public Object connect​(ID remote,
                              Object data,
                              int timeout)
                       throws ECFException
        Description copied from interface: IConnection
        Connect to a remote process
        Specified by:
        connect in interface IConnection
        Parameters:
        remote - the identity of the remote to connect to. Must not be null.
        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 interface IConnection
      • stop

        public void stop()
        Description copied from interface: IConnection
        Stop connection
        Specified by:
        stop in interface IConnection
      • sendAsynch

        public void sendAsynch​(ID recipient,
                               byte[] obj)
                        throws IOException
        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 interface IAsynchConnection
        Parameters:
        recipient - the ID of the intended receiver
        obj - the data to send
        Throws:
        IOException - thrown if data cannot be sent (e.g. disconnected)
      • sendSynch

        public Object sendSynch​(ID rec,
                                byte[] obj)
                         throws IOException
        Description copied from interface: ISynchConnection
        Send data synchronously, blocking until a result is received
        Specified by:
        sendSynch in interface ISynchConnection
        Parameters:
        rec - the receiver to receive the synchronous request
        obj - 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: IConnection
        Get properties for this connection
        Specified by:
        getProperties in interface IConnection
        Returns:
        Map the properties associated with this connection. May be null.
      • getAdapter

        public Object getAdapter​(Class clazz)
        Specified by:
        getAdapter in interface org.eclipse.core.runtime.IAdaptable
      • debug

        protected void debug​(String msg)
      • setProperties

        public void setProperties​(Map props)
      • getOutputStreamLock

        public Object getOutputStreamLock()
        Returns:
        Object the output stream lock
        Since:
        4.6