Package org.apache.mina.transport.vmpipe
Class VmPipeAcceptor
- java.lang.Object
-
- org.apache.mina.core.service.AbstractIoService
-
- org.apache.mina.core.service.AbstractIoAcceptor
-
- org.apache.mina.transport.vmpipe.VmPipeAcceptor
-
- All Implemented Interfaces:
IoAcceptor,IoService
public final class VmPipeAcceptor extends AbstractIoAcceptor
Binds the specifiedIoHandlerto the specifiedVmPipeAddress.- Author:
- Apache MINA Project
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.mina.core.service.AbstractIoAcceptor
AbstractIoAcceptor.AcceptorOperationFuture
-
Nested classes/interfaces inherited from class org.apache.mina.core.service.AbstractIoService
AbstractIoService.ServiceOperationFuture
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static Map<VmPipeAddress,VmPipe>boundHandlers-
Fields inherited from class org.apache.mina.core.service.AbstractIoAcceptor
bindLock
-
Fields inherited from class org.apache.mina.core.service.AbstractIoService
disposalLock, LOGGER, sessionConfig
-
-
Constructor Summary
Constructors Constructor Description VmPipeAcceptor()Creates a new instance.VmPipeAcceptor(Executor executor)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<SocketAddress>bindInternal(List<? extends SocketAddress> localAddresses)Starts the acceptor, and register the given addressesprotected voiddispose0()Implement this method to release any acquired resources.(package private) voiddoFinishSessionInitialization(IoSession session, IoFuture future)VmPipeAddressgetDefaultLocalAddress()Returns the default local address to bind when no argument is specified inIoAcceptor.bind()method.VmPipeAddressgetLocalAddress()Returns the local address which is bound currently.VmPipeSessionConfiggetSessionConfig()TransportMetadatagetTransportMetadata()IoSessionnewSession(SocketAddress remoteAddress, SocketAddress localAddress)(Optional) Returns anIoSessionthat is bound to the specifiedlocalAddressand the specifiedremoteAddresswhich reuses the local address that is already bound by this service.voidsetDefaultLocalAddress(VmPipeAddress localAddress)Sets the local Address for this acceptorprotected voidunbind0(List<? extends SocketAddress> localAddresses)Implement this method to perform the actual unbind operation.-
Methods inherited from class org.apache.mina.core.service.AbstractIoAcceptor
bind, bind, bind, bind, bind, getDefaultLocalAddresses, getLocalAddresses, isCloseOnDeactivation, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, toString, unbind, unbind, unbind, unbind
-
Methods inherited from class org.apache.mina.core.service.AbstractIoService
addListener, broadcast, dispose, dispose, executeWorker, executeWorker, finishSessionInitialization0, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getListeners, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, initSession, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.mina.core.service.IoService
addListener, broadcast, dispose, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory
-
-
-
-
Field Detail
-
boundHandlers
static final Map<VmPipeAddress,VmPipe> boundHandlers
-
-
Constructor Detail
-
VmPipeAcceptor
public VmPipeAcceptor()
Creates a new instance.
-
VmPipeAcceptor
public VmPipeAcceptor(Executor executor)
Creates a new instance.- Parameters:
executor- The executor to use
-
-
Method Detail
-
getTransportMetadata
public TransportMetadata getTransportMetadata()
- Returns:
- the
TransportMetadatathat this service runs on.
-
getSessionConfig
public VmPipeSessionConfig getSessionConfig()
- Returns:
- the default configuration of the new
IoSessions created by this service.
-
getLocalAddress
public VmPipeAddress getLocalAddress()
Returns the local address which is bound currently. If more than one address are bound, only one of them will be returned, but it's not necessarily the firstly bound address.- Specified by:
getLocalAddressin interfaceIoAcceptor- Overrides:
getLocalAddressin classAbstractIoAcceptor- Returns:
- The bound LocalAddress
-
getDefaultLocalAddress
public VmPipeAddress getDefaultLocalAddress()
Returns the default local address to bind when no argument is specified inIoAcceptor.bind()method. Please note that the default will not be used if any local address is specified. If more than one address are set, only one of them will be returned, but it's not necessarily the firstly specified address inIoAcceptor.setDefaultLocalAddresses(List).- Specified by:
getDefaultLocalAddressin interfaceIoAcceptor- Overrides:
getDefaultLocalAddressin classAbstractIoAcceptor- Returns:
- The default bound LocalAddress
-
setDefaultLocalAddress
public void setDefaultLocalAddress(VmPipeAddress localAddress)
Sets the local Address for this acceptor- Parameters:
localAddress- The local address to use
-
dispose0
protected void dispose0() throws ExceptionImplement this method to release any acquired resources. This method is invoked only once byAbstractIoService.dispose().- Specified by:
dispose0in classAbstractIoService- Throws:
Exception- If the dispose failed
-
bindInternal
protected Set<SocketAddress> bindInternal(List<? extends SocketAddress> localAddresses) throws IOException
Starts the acceptor, and register the given addresses- Specified by:
bindInternalin classAbstractIoAcceptor- Parameters:
localAddresses- The address to bind to- Returns:
- the
Setof the local addresses which is bound actually - Throws:
IOException
-
unbind0
protected void unbind0(List<? extends SocketAddress> localAddresses)
Description copied from class:AbstractIoAcceptorImplement this method to perform the actual unbind operation.- Specified by:
unbind0in classAbstractIoAcceptor- Parameters:
localAddresses- The address to unbind from
-
newSession
public IoSession newSession(SocketAddress remoteAddress, SocketAddress localAddress)
(Optional) Returns anIoSessionthat is bound to the specifiedlocalAddressand the specifiedremoteAddresswhich reuses the local address that is already bound by this service.This operation is optional. Please throw
UnsupportedOperationExceptionif the transport type doesn't support this operation. This operation is usually implemented for connectionless transport types.- Parameters:
remoteAddress- The remote address bound to the servicelocalAddress- The local address the session will be bound to- Returns:
- The session bound to the the given localAddress and remote address
-
-