public interface IConnector extends IChannelMultiplexer, IUserAware, Closeable
IConnector
encapsulates the process of establishing and closing such connections and has a
location
of
CLIENT
or
SERVER
with respect to this process. Once a connection is
established either party can use its connector to open multiple IChannel
s to asynchronously exchange
IBuffer
s.
This interface is not intended to be implemented by clients. Providers of connectors for new physical connection types have to implement org.eclipse.internal.net4j.connector.InternalConnector.
ILocationAware.Location
IContainer.Modifiable<E>, IContainer.Persistable<E>, IContainer.Persistence<E>
Modifier and Type | Field and Description |
---|---|
static long |
NO_TIMEOUT |
DEFAULT_OPEN_CHANNEL_TIMEOUT, NO_CHANNEL_TIMEOUT
Modifier and Type | Method and Description |
---|---|
void |
connect()
Synchronous connect with infinite timeout value.
|
void |
connect(long timeout)
Synchronous connect.
|
void |
connectAsync()
Asynchronous connect.
|
ConnectorState |
getState()
Returns the current state of this connector.
|
String |
getURL() |
boolean |
isConnected()
Same as
. |
void |
waitForConnection(long timeout)
Blocks until
or the given timeout expired. |
getChannels, getOpenChannelTimeout, openChannel, openChannel, openChannel, setOpenChannelTimeout
getLocation, isClient, isServer
getElements, isEmpty
addListener, getListeners, hasListeners, removeListener
getUserID
static final long NO_TIMEOUT
String getURL()
ConnectorState getState()
boolean isConnected()
getState()
== ConnectorState.CONNECTED
.void connect() throws ConnectorException
connect(NO_TIMEOUT)
.ConnectorException
void connect(long timeout) throws ConnectorException
isConnected()
== true
or the given timeout expired.timeout
- The maximum number of milli seconds to block or NO_TIMEOUT
to block indefinetely in case no
connection occurs.ConnectorException
void connectAsync() throws ConnectorException
IConnector
in a state where isConnected()
== false
.ConnectorException
waitForConnection(long)
,
connect(long)
void waitForConnection(long timeout) throws ConnectorException
isConnected()
== true
or the given timeout expired.timeout
- The maximum number of milli seconds to block or NO_TIMEOUT
to block indefinetely in case no
connection occurs.ConnectorException
Copyright (c) 2011-2015 Eike Stepper (Berlin, Germany) and others.