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
An abstract
IoSession serving of base for APR based sessions.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate final IoFilterChainprivate booleanprivate booleanprivate final InetSocketAddressprivate final IoProcessor<AprSession> private booleanprivate final InetSocketAddressprivate booleanFields inherited from class AbstractIoSession
CLOSE_REQUEST, config, MESSAGE_SENT_REQUEST -
Constructor Summary
ConstructorsConstructorDescriptionAprSession(IoService service, IoProcessor<AprSession> processor, long descriptor) Creates a new instance ofAprSession.AprSession(IoService service, IoProcessor<AprSession> processor, long descriptor, InetSocketAddress remoteAddress) Creates a new instance ofAprSession. -
Method Summary
Modifier and TypeMethodDescription(package private) longGet the socket descriptor @see Socket#create(int, int, int, long).(package private) booleanDoes this session needs to be registered for read events.(package private) booleanDoes this session needs to be registered for write events.(package private) booleanIs this session was tagged are readable after a call toSocket.pool(long).(package private) booleanIs 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 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, writeMethods inherited from interface IoSession
getTransportMetadata
-
Field Details
-
descriptor
private long descriptor -
processor
-
filterChain
-
remoteAddress
-
localAddress
-
readable
private boolean readable -
writable
private boolean writable -
interestedInRead
private boolean interestedInRead -
interestedInWrite
private boolean interestedInWrite
-
-
Constructor Details
-
AprSession
AprSession(IoService service, IoProcessor<AprSession> processor, long descriptor) throws 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:
Exception- exception produced during the setting of all the socket parameters.
-
AprSession
AprSession(IoService service, IoProcessor<AprSession> processor, long descriptor, InetSocketAddress remoteAddress) throws 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:
Exception- exception produced during the setting of all the socket parameters.
-
-
Method Details
-
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
- Specified by:
getProcessorin classAbstractIoSession- Returns:
- The associated IoProcessor for this session
-
getLocalAddress
- Returns:
- the socket address of local machine which is associated with this session.
-
getRemoteAddress
- Returns:
- the socket address of remote peer.
-
getFilterChain
- Returns:
- the filter chain that only affects this session.
-
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
-