Class Connector
java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.lifecycle.Lifecycle
org.eclipse.net4j.util.lifecycle.ShareableLifecycle
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, org.eclipse.net4j.util.collection.Closeable, org.eclipse.net4j.util.concurrent.IExecutorServiceProvider, org.eclipse.net4j.util.container.IContainer<IChannel>, org.eclipse.net4j.util.event.INotifier, org.eclipse.net4j.util.event.INotifier.INotifier2, org.eclipse.net4j.util.lifecycle.IDeactivateable, org.eclipse.net4j.util.lifecycle.ILifecycle, org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation, org.eclipse.net4j.util.properties.IPropertiesContainer, org.eclipse.net4j.util.security.INegotiatorAware, org.eclipse.net4j.util.security.IUserAware, InternalChannelMultiplexer, InternalConnector, InverseCloseable
- Direct Known Subclasses:
SchedulingConnector
Multiplexes Net4j channels over a physical connection and manages connection establishment, negotiation, authentication, and shutdown.
Concrete connectors provide the transport-specific connection mechanism.
- Since:
- 2.0
- Author:
- Eike Stepper
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.event.Notifier.CancelationNested classes/interfaces inherited from interface IBufferProvider
IBufferProvider.Introspection, IBufferProvider.NotificationNested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IContainer
org.eclipse.net4j.util.container.IContainer.Modifiable<E>, org.eclipse.net4j.util.container.IContainer.Persistable<E>, org.eclipse.net4j.util.container.IContainer.Persistence<E>Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivationNested classes/interfaces inherited from interface ILocationAware
ILocationAware.LocationNested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier
org.eclipse.net4j.util.event.INotifier.INotifier2Nested classes/interfaces inherited from interface InternalChannelMultiplexer
InternalChannelMultiplexer.BufferMultiplexer -
Field Summary
Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
USE_LABELFields inherited from interface IChannelMultiplexer
DEFAULT_OPEN_CHANNEL_TIMEOUT, NO_CHANNEL_TIMEOUTFields inherited from interface IConnector
NO_TIMEOUTFields inherited from interface InternalChannelMultiplexer
CONTEXT_MULTIPLEXER, RESERVED_CHANNEL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidconnect()Synchronous connect with infinite timeout value.voidconnect(long timeout) Synchronous connect.voidAsynchronous connect.protected abstract org.eclipse.net4j.util.security.INegotiationContextprotected voidderegisterChannelFromPeer(InternalChannel channel) protected voidprotected voidprotected voiddoBeforeOpenChannel(IProtocol<?> protocol) protected voidshortReturns the capacity, in bytes, of buffers returned byIBufferProvider.provideBuffer().org.eclipse.net4j.util.security.INegotiationContextprotected org.eclipse.net4j.util.security.NegotiationExceptionorg.eclipse.net4j.util.security.INegotiatorgetState()Returns the current state of this connector.getURL()protected voidinitChannel(InternalChannel channel, IProtocol<?> protocol) booleanisClient()booleanisClosed()booleanSame as.IConnector.getState()==ConnectorState.CONNECTEDbooleanbooleanbooleanbooleanbooleanisServer()protected voidProvides a buffer and transfers its current ownership to the caller.voidretainBuffer(IBuffer buffer) Accepts a buffer whose caller has relinquished ownership.protected voidsetNegotiationException(org.eclipse.net4j.util.security.NegotiationException negotiationException) voidsetNegotiator(org.eclipse.net4j.util.security.INegotiator negotiator) voidsetState(ConnectorState newState) voidvoidwaitForConnection(long timeout) Blocks untilor the given timeout expired.IConnector.isConnected()== trueMethods inherited from class ChannelMultiplexer
closeChannel, createChannel, createProtocol, createProtocolFactoryKey, getChannel, getChannels, getConfig, getElements, getExecutorService, getOpenChannelTimeout, inverseClose, inverseCloseChannel, inverseOpenChannel, inverseOpenChannel, isEmpty, needsBufferProvider, openChannel, openChannel, openChannel, properties, registerChannelWithPeer, setConfig, setOpenChannelTimeoutMethods inherited from class org.eclipse.net4j.util.container.Container
fireContainerEvent, fireContainerEvent, fireContainerEvent, fireElementAddedEvent, fireElementRemovedEvent, fireElementsAddedEvent, fireElementsRemovedEvent, fireEvent, newContainerEvent, newContainerEventMethods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeDeactivate, doCancelActivation, dump, getLifecycleState, isActive, toStringMethods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, addUniqueListener, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IChannelMultiplexer
getChannels, getOpenChannelTimeout, openChannel, openChannel, openChannel, setOpenChannelTimeoutMethods inherited from interface org.eclipse.net4j.util.container.IContainer
getElements, isEmptyMethods inherited from interface org.eclipse.net4j.util.event.INotifier
addListener, getListeners, hasListeners, removeListenerMethods inherited from interface InternalChannelMultiplexer
closeChannel, multiplexChannel, needsBufferProviderMethods inherited from interface org.eclipse.net4j.util.properties.IPropertiesContainer
propertiesMethods inherited from interface ITransportConfigAware
getConfig, setConfig
-
Constructor Details
-
Connector
public Connector()
-
-
Method Details
-
getNegotiator
public org.eclipse.net4j.util.security.INegotiator getNegotiator()- Specified by:
getNegotiatorin interfaceorg.eclipse.net4j.util.security.INegotiatorAware
-
setNegotiator
public void setNegotiator(org.eclipse.net4j.util.security.INegotiator negotiator) - Specified by:
setNegotiatorin interfaceorg.eclipse.net4j.util.security.INegotiatorAware
-
getNegotiationContext
public org.eclipse.net4j.util.security.INegotiationContext getNegotiationContext() -
isClient
public boolean isClient()Description copied from interface:ILocationAware- Specified by:
isClientin interfaceILocationAware
-
isServer
public boolean isServer()Description copied from interface:ILocationAware- Specified by:
isServerin interfaceILocationAware
-
getUserID
- Specified by:
getUserIDin interfaceorg.eclipse.net4j.util.security.IUserAware
-
setUserID
-
getState
Description copied from interface:IConnectorReturns the current state of this connector.- Specified by:
getStatein interfaceIConnector
-
setState
- Throws:
ConnectorException
-
isDisconnected
public boolean isDisconnected() -
isConnecting
public boolean isConnecting() -
isNegotiating
public boolean isNegotiating() -
isConnected
public boolean isConnected()Description copied from interface:IConnectorSame as.IConnector.getState()==ConnectorState.CONNECTED- Specified by:
isConnectedin interfaceIConnector
-
connectAsync
Description copied from interface:IConnectorAsynchronous connect. May leave thisIConnectorin a state where.IConnector.isConnected()== false- Specified by:
connectAsyncin interfaceIConnector- Throws:
ConnectorException- See Also:
-
waitForConnection
Description copied from interface:IConnectorBlocks untilor the given timeout expired.IConnector.isConnected()== true- Specified by:
waitForConnectionin interfaceIConnector- Parameters:
timeout- The maximum number of milli seconds to block orIConnector.NO_TIMEOUTto block indefinetely in case no connection occurs.- Throws:
ConnectorException- Since:
- 4.0
-
connect
Description copied from interface:IConnectorSynchronous connect. Blocks untilor the given timeout expired.IConnector.isConnected()== true- Specified by:
connectin interfaceIConnector- Parameters:
timeout- The maximum number of milliseconds to block orIConnector.NO_TIMEOUTto block indefinitely in case no connection occurs.- Throws:
ConnectorException- Since:
- 4.0
-
connect
Description copied from interface:IConnectorSynchronous connect with infinite timeout value. Same asconnect(NO_TIMEOUT).- Specified by:
connectin interfaceIConnector- Throws:
ConnectorException- Since:
- 4.0
-
close
public void close()- Specified by:
closein interfaceorg.eclipse.net4j.util.collection.Closeable
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceorg.eclipse.net4j.util.collection.Closeable
-
getBufferCapacity
public short getBufferCapacity()Description copied from interface:IBufferProviderReturns the capacity, in bytes, of buffers returned byIBufferProvider.provideBuffer().- Specified by:
getBufferCapacityin interfaceIBufferProvider
-
provideBuffer
Description copied from interface:IBufferProviderProvides a buffer and transfers its current ownership to the caller.- Specified by:
provideBufferin interfaceIBufferProvider
-
retainBuffer
Description copied from interface:IBufferProviderAccepts a buffer whose caller has relinquished ownership. Implementations may keep it for reuse or release its storage; callers must not use the buffer after handing it over.- Specified by:
retainBufferin interfaceIBufferProvider
-
leaveConnecting
protected void leaveConnecting() -
createNegotiationContext
protected abstract org.eclipse.net4j.util.security.INegotiationContext createNegotiationContext()- Specified by:
createNegotiationContextin classChannelMultiplexer
-
getNegotiationException
protected org.eclipse.net4j.util.security.NegotiationException getNegotiationException() -
setNegotiationException
protected void setNegotiationException(org.eclipse.net4j.util.security.NegotiationException negotiationException) -
initChannel
- Overrides:
initChannelin classChannelMultiplexer
-
deregisterChannelFromPeer
- Specified by:
deregisterChannelFromPeerin classChannelMultiplexer- Throws:
ChannelException
-
getLocation
Description copied from interface:ILocationAware- Specified by:
getLocationin interfaceILocationAware
-
getURL
- Specified by:
getURLin interfaceIConnector
-
isDeferredActivation
public boolean isDeferredActivation()- Specified by:
isDeferredActivationin interfaceorg.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation- Overrides:
isDeferredActivationin classorg.eclipse.net4j.util.lifecycle.Lifecycle- Since:
- 4.1
-
doBeforeOpenChannel
- Overrides:
doBeforeOpenChannelin classChannelMultiplexer
-
doBeforeActivate
-
doActivate
-
doDeactivate
- Overrides:
doDeactivatein classChannelMultiplexer- Throws:
Exception
-