public abstract class Connector extends ChannelMultiplexer implements InternalConnector
ILocationAware.Location
IContainer.Modifiable<E>, IContainer.Persistable<E>, IContainer.Persistence<E>
IBufferProvider.Introspection
ILifecycle.DeferrableActivation
NO_TIMEOUT
CONTEXT_MULTIPLEXER, RESERVED_CHANNEL
DEFAULT_OPEN_CHANNEL_TIMEOUT, NO_CHANNEL_TIMEOUT
Constructor and Description |
---|
Connector() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
connect()
Synchronous connect with infinite timeout value.
|
void |
connect(long timeout)
Synchronous connect.
|
void |
connectAsync()
Asynchronous connect.
|
protected abstract INegotiationContext |
createNegotiationContext() |
protected void |
deregisterChannelFromPeer(InternalChannel channel) |
protected void |
doActivate() |
protected void |
doBeforeActivate() |
protected void |
doBeforeOpenChannel(IProtocol<?> protocol) |
protected void |
doDeactivate() |
short |
getBufferCapacity()
Returns the capacity of the buffers provided by
IBufferProvider.provideBuffer() . |
ILocationAware.Location |
getLocation()
|
INegotiationContext |
getNegotiationContext() |
protected NegotiationException |
getNegotiationException() |
INegotiator |
getNegotiator() |
ConnectorState |
getState()
Returns the current state of this connector.
|
String |
getURL() |
String |
getUserID() |
protected void |
initChannel(InternalChannel channel,
IProtocol<?> protocol) |
boolean |
isClient()
|
boolean |
isClosed() |
boolean |
isConnected()
Same as
. |
boolean |
isConnecting() |
boolean |
isDeferredActivation() |
boolean |
isDisconnected() |
boolean |
isNegotiating() |
boolean |
isServer()
|
protected void |
leaveConnecting() |
IBuffer |
provideBuffer()
Provides a buffer from this
BufferProvider . |
void |
retainBuffer(IBuffer buffer)
Retains a buffer to this
BufferProvider . |
protected void |
setNegotiationException(NegotiationException negotiationException) |
void |
setNegotiator(INegotiator negotiator) |
void |
setState(ConnectorState newState) |
void |
setUserID(String userID) |
void |
waitForConnection(long timeout)
Blocks until
or the given timeout expired. |
closeChannel, createChannel, createProtocol, createProtocolFactoryKey, getChannel, getChannels, getConfig, getElements, getOpenChannelTimeout, inverseCloseChannel, inverseOpenChannel, inverseOpenChannel, isEmpty, openChannel, openChannel, openChannel, registerChannelWithPeer, setConfig, setOpenChannelTimeout
fireContainerEvent, fireContainerEvent, fireContainerEvent, fireElementAddedEvent, fireElementRemovedEvent, fireElementsAddedEvent, fireElementsRemovedEvent, fireEvent, newContainerEvent, newContainerEvent
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, toString
addListener, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
closeChannel, multiplexChannel
getChannels, getOpenChannelTimeout, openChannel, openChannel, openChannel, setOpenChannelTimeout
getElements, isEmpty
addListener, getListeners, hasListeners, removeListener
getConfig, setConfig
public INegotiator getNegotiator()
getNegotiator
in interface INegotiatorAware
public void setNegotiator(INegotiator negotiator)
setNegotiator
in interface INegotiatorAware
public INegotiationContext getNegotiationContext()
public boolean isClient()
ILocationAware
isClient
in interface ILocationAware
public boolean isServer()
ILocationAware
isServer
in interface ILocationAware
public String getUserID()
getUserID
in interface IUserAware
public void setUserID(String userID)
public ConnectorState getState()
IConnector
getState
in interface IConnector
public void setState(ConnectorState newState) throws ConnectorException
ConnectorException
public boolean isDisconnected()
public boolean isConnecting()
public boolean isNegotiating()
public boolean isConnected()
IConnector
IConnector.getState()
== ConnectorState.CONNECTED
.isConnected
in interface IConnector
public void connectAsync() throws ConnectorException
IConnector
IConnector
in a state where IConnector.isConnected()
== false
.connectAsync
in interface IConnector
ConnectorException
IConnector.waitForConnection(long)
,
IConnector.connect(long)
public void waitForConnection(long timeout) throws ConnectorException
IConnector
IConnector.isConnected()
== true
or the given timeout expired.waitForConnection
in interface IConnector
timeout
- The maximum number of milli seconds to block or IConnector.NO_TIMEOUT
to block indefinetely in case no
connection occurs.ConnectorException
public void connect(long timeout) throws ConnectorException
IConnector
IConnector.isConnected()
== true
or the given timeout expired.connect
in interface IConnector
timeout
- The maximum number of milli seconds to block or IConnector.NO_TIMEOUT
to block indefinetely in case no
connection occurs.ConnectorException
public void connect() throws ConnectorException
IConnector
connect(NO_TIMEOUT)
.connect
in interface IConnector
ConnectorException
public short getBufferCapacity()
IBufferProvider
IBufferProvider.provideBuffer()
.getBufferCapacity
in interface IBufferProvider
public IBuffer provideBuffer()
IBufferProvider
BufferProvider
.provideBuffer
in interface IBufferProvider
public void retainBuffer(IBuffer buffer)
IBufferProvider
BufferProvider
.retainBuffer
in interface IBufferProvider
protected void leaveConnecting()
protected abstract INegotiationContext createNegotiationContext()
createNegotiationContext
in class ChannelMultiplexer
protected NegotiationException getNegotiationException()
protected void setNegotiationException(NegotiationException negotiationException)
protected void initChannel(InternalChannel channel, IProtocol<?> protocol)
initChannel
in class ChannelMultiplexer
protected void deregisterChannelFromPeer(InternalChannel channel) throws ChannelException
deregisterChannelFromPeer
in class ChannelMultiplexer
ChannelException
public ILocationAware.Location getLocation()
ILocationAware
getLocation
in interface ILocationAware
public String getURL()
getURL
in interface IConnector
public boolean isDeferredActivation()
isDeferredActivation
in interface ILifecycle.DeferrableActivation
isDeferredActivation
in class Lifecycle
protected void doBeforeOpenChannel(IProtocol<?> protocol)
doBeforeOpenChannel
in class ChannelMultiplexer
protected void doBeforeActivate() throws Exception
doBeforeActivate
in class Lifecycle
Exception
protected void doActivate() throws Exception
doActivate
in class Lifecycle
Exception
protected void doDeactivate() throws Exception
doDeactivate
in class ChannelMultiplexer
Exception
Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html