org.eclipse.spi.net4j
Class Connector
java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.lifecycle.Lifecycle
org.eclipse.net4j.util.container.Container<IChannel>
org.eclipse.spi.net4j.ChannelMultiplexer
org.eclipse.spi.net4j.Connector
- All Implemented Interfaces:
- IBufferProvider, IChannelMultiplexer, IConnector, ILocationAware, ITransportConfigAware, Closeable, IContainer<IChannel>, INotifier, ILifecycle, ILifecycle.DeferrableActivation, INegotiatorAware, IUserAware, InternalChannelMultiplexer, InternalConnector
- public abstract class Connector
- extends ChannelMultiplexer
- implements InternalConnector
- Since:
- 2.0
Methods inherited from class org.eclipse.spi.net4j.ChannelMultiplexer |
closeChannel, createChannel, createProtocol, createProtocolFactoryKey, getChannel, getChannels, getConfig, getElements, getOpenChannelTimeout, inverseCloseChannel, inverseOpenChannel, isEmpty, openChannel, openChannel, openChannel, registerChannelWithPeer, setConfig, setOpenChannelTimeout |
Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle |
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, toString |
Connector
public Connector()
getNegotiator
public INegotiator getNegotiator()
- Specified by:
getNegotiator
in interface INegotiatorAware
setNegotiator
public void setNegotiator(INegotiator negotiator)
- Specified by:
setNegotiator
in interface INegotiatorAware
getNegotiationContext
public INegotiationContext getNegotiationContext()
isClient
public boolean isClient()
- Description copied from interface:
ILocationAware
- Same as
ILocationAware.getLocation()
== ILocationAware.Location.CLIENT
.
- Specified by:
isClient
in interface ILocationAware
isServer
public boolean isServer()
- Description copied from interface:
ILocationAware
- Same as
ILocationAware.getLocation()
== ILocationAware.Location.SERVER
.
- Specified by:
isServer
in interface ILocationAware
getUserID
public String getUserID()
- Specified by:
getUserID
in interface IUserAware
setUserID
public void setUserID(String userID)
getState
public ConnectorState getState()
- Description copied from interface:
IConnector
- Returns the current state of this connector.
- Specified by:
getState
in interface IConnector
setState
public void setState(ConnectorState newState)
throws ConnectorException
- Throws:
ConnectorException
isDisconnected
public boolean isDisconnected()
isConnecting
public boolean isConnecting()
isNegotiating
public boolean isNegotiating()
isConnected
public boolean isConnected()
- Description copied from interface:
IConnector
- Same as
IConnector.getState()
== ConnectorState.CONNECTED
.
- Specified by:
isConnected
in interface IConnector
connectAsync
public void connectAsync()
throws ConnectorException
- Description copied from interface:
IConnector
- Asynchronous connect. May leave this
IConnector
in a state where IConnector.isConnected()
== false
.
- Specified by:
connectAsync
in interface IConnector
- Throws:
ConnectorException
- See Also:
IConnector.waitForConnection(long)
,
IConnector.connect(long)
waitForConnection
public void waitForConnection(long timeout)
throws ConnectorException
- Description copied from interface:
IConnector
- Blocks until
IConnector.isConnected()
== true
or the given timeout expired.
- Specified by:
waitForConnection
in interface IConnector
- Parameters:
timeout
- The maximum number of milli seconds to block or IConnector.NO_TIMEOUT
to block indefinetely in case no
connection occurs.
- Throws:
ConnectorException
- Since:
- 4.0
connect
public void connect(long timeout)
throws ConnectorException
- Description copied from interface:
IConnector
- Synchronous connect. Blocks until
IConnector.isConnected()
== true
or the given timeout expired.
- Specified by:
connect
in interface IConnector
- Parameters:
timeout
- The maximum number of milli seconds to block or IConnector.NO_TIMEOUT
to block indefinetely in case no
connection occurs.
- Throws:
ConnectorException
- Since:
- 4.0
connect
public void connect()
throws ConnectorException
- Description copied from interface:
IConnector
- Synchronous connect with infinite timeout value. Same as
connect(NO_TIMEOUT)
.
- Specified by:
connect
in interface IConnector
- Throws:
ConnectorException
- Since:
- 4.0
close
public void close()
- Specified by:
close
in interface Closeable
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interface Closeable
getBufferCapacity
public short getBufferCapacity()
- Description copied from interface:
IBufferProvider
- Returns the capacity of the buffers provided by
IBufferProvider.provideBuffer()
.
- Specified by:
getBufferCapacity
in interface IBufferProvider
provideBuffer
public IBuffer provideBuffer()
- Description copied from interface:
IBufferProvider
- Provides a buffer from this
BufferProvider
.
- Specified by:
provideBuffer
in interface IBufferProvider
retainBuffer
public void retainBuffer(IBuffer buffer)
- Description copied from interface:
IBufferProvider
- Retains a buffer to this
BufferProvider
.
- Specified by:
retainBuffer
in interface IBufferProvider
leaveConnecting
protected void leaveConnecting()
createNegotiationContext
protected abstract INegotiationContext createNegotiationContext()
- Specified by:
createNegotiationContext
in class ChannelMultiplexer
getNegotiationException
protected NegotiationException getNegotiationException()
setNegotiationException
protected void setNegotiationException(NegotiationException negotiationException)
initChannel
protected void initChannel(InternalChannel channel,
IProtocol<?> protocol)
- Overrides:
initChannel
in class ChannelMultiplexer
deregisterChannelFromPeer
protected void deregisterChannelFromPeer(InternalChannel channel)
throws ChannelException
- Specified by:
deregisterChannelFromPeer
in class ChannelMultiplexer
- Throws:
ChannelException
getLocation
public ILocationAware.Location getLocation()
- Description copied from interface:
ILocationAware
- Returns the location of this object in a
client
/server
scenario.
- Specified by:
getLocation
in interface ILocationAware
getURL
public String getURL()
- Specified by:
getURL
in interface IConnector
isDeferredActivation
public boolean isDeferredActivation()
- Specified by:
isDeferredActivation
in interface ILifecycle.DeferrableActivation
- Overrides:
isDeferredActivation
in class Lifecycle
- Since:
- 4.1
doBeforeOpenChannel
protected void doBeforeOpenChannel(IProtocol<?> protocol)
- Overrides:
doBeforeOpenChannel
in class ChannelMultiplexer
doBeforeActivate
protected void doBeforeActivate()
throws Exception
- Overrides:
doBeforeActivate
in class Lifecycle
- Throws:
Exception
doActivate
protected void doActivate()
throws Exception
- Overrides:
doActivate
in class Lifecycle
- Throws:
Exception
doDeactivate
protected void doDeactivate()
throws Exception
- Overrides:
doDeactivate
in class ChannelMultiplexer
- Throws:
Exception
Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.