Class AprSession
- java.lang.Object
-
- org.apache.mina.core.session.AbstractIoSession
-
- org.apache.mina.transport.socket.apr.AprSession
-
- All Implemented Interfaces:
IoSession
- Direct Known Subclasses:
AprDatagramSession,AprSocketSession
public abstract class AprSession extends AbstractIoSession
An abstractIoSessionserving of base for APR based sessions.
-
-
Field Summary
Fields Modifier and Type Field Description private longdescriptorprivate IoFilterChainfilterChainprivate booleaninterestedInReadprivate booleaninterestedInWriteprivate java.net.InetSocketAddresslocalAddressprivate IoProcessor<AprSession>processorprivate booleanreadableprivate java.net.InetSocketAddressremoteAddressprivate booleanwritable-
Fields inherited from class org.apache.mina.core.session.AbstractIoSession
CLOSE_REQUEST, config, MESSAGE_SENT_REQUEST
-
-
Constructor Summary
Constructors Constructor Description AprSession(IoService service, IoProcessor<AprSession> processor, long descriptor)Creates a new instance ofAprSession.AprSession(IoService service, IoProcessor<AprSession> processor, long descriptor, java.net.InetSocketAddress remoteAddress)Creates a new instance ofAprSession.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) longgetDescriptor()Get the socket descriptor @see Socket#create(int, int, int, long).IoFilterChaingetFilterChain()java.net.InetSocketAddressgetLocalAddress()IoProcessor<AprSession>getProcessor()java.net.InetSocketAddressgetRemoteAddress()java.net.InetSocketAddressgetServiceAddress()(package private) booleanisInterestedInRead()Does this session needs to be registered for read events.(package private) booleanisInterestedInWrite()Does this session needs to be registered for write events.(package private) booleanisReadable()Is this session was tagged are readable after a call toSocket.pool(long).(package private) booleanisWritable()Is this session is tagged writable after a call toSocket.pool(long).(package private) voidsetDescriptor(long desc)Set the socket descriptor.(package private) voidsetInterestedInRead(boolean isOpRead)Set if this session needs to be registered for read events.(package private) voidsetInterestedInWrite(boolean isOpWrite)Set if this session needs to be registered for write events.(package private) voidsetReadable(boolean readable)Set if this session is readable after a call toSocket.pool(long).(package private) voidsetWritable(boolean writable)Set if this session is writable after a call toSocket.pool(long).-
Methods inherited from class org.apache.mina.core.session.AbstractIoSession
close, close, closeNow, closeOnFlush, containsAttribute, decreaseReadBufferSize, decreaseScheduledBytesAndMessages, destroy, equals, getAttachment, getAttribute, getAttribute, getAttributeKeys, getAttributeMap, getBothIdleCount, getCloseFuture, getConfig, getCreationTime, getCurrentWriteMessage, getCurrentWriteRequest, getHandler, getId, getIdleCount, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getService, getWriteRequestQueue, getWriterIdleCount, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, hashCode, increaseIdleCount, increaseReadBufferSize, increaseReadBytes, increaseReadMessages, increaseScheduledWriteBytes, increaseScheduledWriteMessages, increaseWrittenBytes, increaseWrittenMessages, isActive, isBothIdle, isClosing, isConnected, isIdle, isReaderIdle, isReadSuspended, isScheduledForFlush, isSecured, isWriterIdle, isWriteSuspended, notifyIdleness, notifyIdleSession, offerClosedReadFuture, offerFailedReadFuture, offerReadFuture, read, removeAttribute, removeAttribute, replaceAttribute, resumeRead, resumeWrite, scheduledForFlush, setAttachment, setAttribute, setAttribute, setAttributeIfAbsent, setAttributeIfAbsent, setAttributeMap, setCurrentWriteRequest, setScheduledForFlush, setScheduledWriteBytes, setScheduledWriteMessages, setWriteRequestQueue, suspendRead, suspendWrite, toString, unscheduledForFlush, updateThroughput, write, write
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.mina.core.session.IoSession
getTransportMetadata
-
-
-
-
Field Detail
-
descriptor
private long descriptor
-
processor
private final IoProcessor<AprSession> processor
-
filterChain
private final IoFilterChain filterChain
-
remoteAddress
private final java.net.InetSocketAddress remoteAddress
-
localAddress
private final java.net.InetSocketAddress localAddress
-
readable
private boolean readable
-
writable
private boolean writable
-
interestedInRead
private boolean interestedInRead
-
interestedInWrite
private boolean interestedInWrite
-
-
Constructor Detail
-
AprSession
AprSession(IoService service, IoProcessor<AprSession> processor, long descriptor) throws java.lang.Exception
Creates a new instance ofAprSession. Need to be called by extending types- Parameters:
service- theIoServicecreating this session. Can beAprSocketAcceptororAprSocketConnectorprocessor- theAprIoProcessormanaging this session.descriptor- the low level APR socket descriptor for this socket. @see Socket#create(int, int, int, long)- Throws:
java.lang.Exception- exception produced during the setting of all the socket parameters.
-
AprSession
AprSession(IoService service, IoProcessor<AprSession> processor, long descriptor, java.net.InetSocketAddress remoteAddress) throws java.lang.Exception
Creates a new instance ofAprSession. Need to be called by extending types. The constructor add remote address for UDP based sessions.- Parameters:
service- theIoServicecreating this session. Can beAprSocketAcceptororAprSocketConnectorprocessor- theAprIoProcessormanaging this session.descriptor- the low level APR socket descriptor for this socket. @see Socket#create(int, int, int, long)remoteAddress- the remote end-point- Throws:
java.lang.Exception- exception produced during the setting of all the socket parameters.
-
-
Method Detail
-
getDescriptor
long getDescriptor()
Get the socket descriptor @see Socket#create(int, int, int, long).- Returns:
- the low level APR socket descriptor
-
setDescriptor
void setDescriptor(long desc)
Set the socket descriptor.- Parameters:
desc- the low level APR socket descriptor created by @see Socket#create(int, int, int, long)
-
getProcessor
public IoProcessor<AprSession> getProcessor()
- Specified by:
getProcessorin classAbstractIoSession- Returns:
- The associated IoProcessor for this session
-
getLocalAddress
public java.net.InetSocketAddress getLocalAddress()
- Returns:
- the socket address of local machine which is associated with this session.
-
getRemoteAddress
public java.net.InetSocketAddress getRemoteAddress()
- Returns:
- the socket address of remote peer.
-
getFilterChain
public IoFilterChain getFilterChain()
- Returns:
- the filter chain that only affects this session.
-
getServiceAddress
public java.net.InetSocketAddress getServiceAddress()
- Specified by:
getServiceAddressin interfaceIoSession- Overrides:
getServiceAddressin classAbstractIoSession- Returns:
- the socket address of the
IoServicelistens to to manage this session. If this session is managed byIoAcceptor, it returns theSocketAddresswhich is specified as a parameter ofIoAcceptor.bind(). If this session is managed byIoConnector, this method returns the same address with that ofIoSession.getRemoteAddress().
-
isReadable
boolean isReadable()
Is this session was tagged are readable after a call toSocket.pool(long).- Returns:
- true if this session is ready for read operations
-
setReadable
void setReadable(boolean readable)
Set if this session is readable after a call toSocket.pool(long).- Parameters:
readable- true for set this session ready for read operations
-
isWritable
boolean isWritable()
Is this session is tagged writable after a call toSocket.pool(long).- Returns:
- true if this session is ready for write operations
-
setWritable
void setWritable(boolean writable)
Set if this session is writable after a call toSocket.pool(long).- Parameters:
writable- true for set this session ready for write operations
-
isInterestedInRead
boolean isInterestedInRead()
Does this session needs to be registered for read events. Used for building poll set @see Poll.- Returns:
- true if registered
-
setInterestedInRead
void setInterestedInRead(boolean isOpRead)
Set if this session needs to be registered for read events. Used for building poll set @see Poll.- Parameters:
isOpRead- true if need to be registered
-
isInterestedInWrite
boolean isInterestedInWrite()
Does this session needs to be registered for write events. Used for building poll set @see Poll.- Returns:
- true if registered
-
setInterestedInWrite
void setInterestedInWrite(boolean isOpWrite)
Set if this session needs to be registered for write events. Used for building poll set @see Poll.- Parameters:
isOpWrite- true if need to be registered
-
-