Package org.apache.tomcat.util.net
Class NioEndpoint.NioSocketWrapper
java.lang.Object
org.apache.tomcat.util.net.SocketWrapperBase<NioChannel>
org.apache.tomcat.util.net.NioEndpoint.NioSocketWrapper
- Enclosing class:
- NioEndpoint
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.tomcat.util.net.SocketWrapperBase
SocketWrapperBase.BlockingMode, SocketWrapperBase.CompletionCheck, SocketWrapperBase.CompletionHandlerCall, SocketWrapperBase.CompletionState, SocketWrapperBase.OperationState<A>, SocketWrapperBase.VectoredIOCompletionHandler<A>
-
Field Summary
Fields inherited from class org.apache.tomcat.util.net.SocketWrapperBase
bufferedWriteSize, closed, COMPLETE_READ, COMPLETE_READ_WITH_COMPLETION, COMPLETE_WRITE, COMPLETE_WRITE_WITH_COMPLETION, localAddr, localName, localPort, nonBlockingWriteBuffer, previousIOException, READ_DATA, readOperation, readPending, remoteAddr, remoteHost, remotePort, sm, socketBufferHandler, writeOperation, writePending
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateSendfileData
(String filename, long pos, long length) void
doClientAuth
(SSLSupport sslSupport) Require the client to perform CLIENT-CERT authentication if it hasn't already done so.protected void
doClose()
Perform the actual close.protected void
doWrite
(boolean block, ByteBuffer buffer) Write the contents of the ByteBuffer to the socket.protected boolean
Writes as much data as possible from any that remains in the buffers.long
long
Obtain an SSLSupport instance for this socket.int
int
interestOps
(int ops) boolean
interestOpsHas
(int targetOp) boolean
protected <A> SocketWrapperBase<NioChannel>.OperationState<A>
newOperationState
(boolean read, ByteBuffer[] buffers, int offset, int length, SocketWrapperBase.BlockingMode block, long timeout, TimeUnit unit, A attachment, SocketWrapperBase.CompletionCheck check, CompletionHandler<Long, ? super A> handler, Semaphore semaphore, SocketWrapperBase<NioChannel>.VectoredIOCompletionHandler<A> completion) protected void
protected void
protected void
protected void
protected void
protected void
processSendfile
(SendfileDataBase sendfileData) Starts the sendfile process.int
read
(boolean block, byte[] b, int off, int len) int
read
(boolean block, ByteBuffer to) void
void
void
void
void
void
Methods inherited from class org.apache.tomcat.util.net.SocketWrapperBase
awaitReadComplete, awaitWriteComplete, buffersArrayHasRemaining, canWrite, checkError, close, decrementKeepAlive, doWrite, execute, flush, flushBlocking, getCurrentProcessor, getEndpoint, getError, getLocalAddr, getLocalName, getLocalPort, getLock, getNegotiatedProtocol, getReadTimeout, getRemoteAddr, getRemoteHost, getRemotePort, getSocket, getSocketBufferHandler, getSslSupport, getWriteTimeout, hasAsyncIO, hasDataToRead, hasDataToWrite, hasPerOperationTimeout, isClosed, isReadPending, isReadyForWrite, isSecure, isUpgraded, isWritePending, needSemaphores, populateReadBuffer, populateReadBuffer, processSocket, read, read, read, reset, setCurrentProcessor, setError, setKeepAliveLeft, setNegotiatedProtocol, setReadTimeout, setSecure, setUpgraded, setWriteTimeout, takeCurrentProcessor, toString, transfer, transfer, unRead, vectoredOperation, write, write, write, write, write, writeBlocking, writeBlocking, writeNonBlocking, writeNonBlocking, writeNonBlockingInternal
-
Constructor Details
-
NioSocketWrapper
-
-
Method Details
-
getPoller
-
interestOps
public int interestOps() -
interestOps
public int interestOps(int ops) -
interestOpsHas
public boolean interestOpsHas(int targetOp) -
setSendfileData
-
getSendfileData
-
updateLastWrite
public void updateLastWrite() -
getLastWrite
public long getLastWrite() -
updateLastRead
public void updateLastRead() -
getLastRead
public long getLastRead() -
isReadyForRead
- Specified by:
isReadyForRead
in classSocketWrapperBase<NioChannel>
- Throws:
IOException
-
read
- Specified by:
read
in classSocketWrapperBase<NioChannel>
- Throws:
IOException
-
read
- Specified by:
read
in classSocketWrapperBase<NioChannel>
- Throws:
IOException
-
doClose
protected void doClose()Description copied from class:SocketWrapperBase
Perform the actual close. The closed atomic boolean guarantees this will be called only once per wrapper.- Specified by:
doClose
in classSocketWrapperBase<NioChannel>
-
flushNonBlocking
Description copied from class:SocketWrapperBase
Writes as much data as possible from any that remains in the buffers.- Specified by:
flushNonBlocking
in classSocketWrapperBase<NioChannel>
- Returns:
true
if data remains to be flushed after this method completes, otherwisefalse
.- Throws:
IOException
- If an IO error occurs during the write
-
doWrite
Description copied from class:SocketWrapperBase
Write the contents of the ByteBuffer to the socket. For blocking writes either then entire contents of the buffer will be written or an IOException will be thrown. Partial blocking writes will not occur.- Specified by:
doWrite
in classSocketWrapperBase<NioChannel>
- Parameters:
block
- Should the write be blocking or not?buffer
- the ByteBuffer containing the data to be written- Throws:
IOException
- If an I/O error such as a timeout occurs during the write
-
registerReadInterest
public void registerReadInterest()- Specified by:
registerReadInterest
in classSocketWrapperBase<NioChannel>
-
registerWriteInterest
public void registerWriteInterest()- Specified by:
registerWriteInterest
in classSocketWrapperBase<NioChannel>
-
createSendfileData
- Specified by:
createSendfileData
in classSocketWrapperBase<NioChannel>
-
processSendfile
Description copied from class:SocketWrapperBase
Starts the sendfile process. It is expected that if the sendfile process does not complete during this call and does not report an error, that the caller will not add the socket to the poller (or equivalent). That is the responsibility of this method.- Specified by:
processSendfile
in classSocketWrapperBase<NioChannel>
- Parameters:
sendfileData
- Data representing the file to send- Returns:
- The state of the sendfile process after the first write.
-
populateRemoteAddr
protected void populateRemoteAddr()- Specified by:
populateRemoteAddr
in classSocketWrapperBase<NioChannel>
-
populateRemoteHost
protected void populateRemoteHost()- Specified by:
populateRemoteHost
in classSocketWrapperBase<NioChannel>
-
populateRemotePort
protected void populateRemotePort()- Specified by:
populateRemotePort
in classSocketWrapperBase<NioChannel>
-
populateLocalName
protected void populateLocalName()- Specified by:
populateLocalName
in classSocketWrapperBase<NioChannel>
-
populateLocalAddr
protected void populateLocalAddr()- Specified by:
populateLocalAddr
in classSocketWrapperBase<NioChannel>
-
populateLocalPort
protected void populateLocalPort()- Specified by:
populateLocalPort
in classSocketWrapperBase<NioChannel>
-
getSslSupport
Description copied from class:SocketWrapperBase
Obtain an SSLSupport instance for this socket.- Specified by:
getSslSupport
in classSocketWrapperBase<NioChannel>
- Returns:
- An SSLSupport instance for this socket.
-
doClientAuth
Description copied from class:SocketWrapperBase
Require the client to perform CLIENT-CERT authentication if it hasn't already done so.- Specified by:
doClientAuth
in classSocketWrapperBase<NioChannel>
- Parameters:
sslSupport
- The SSL/TLS support instance currently being used by the connection that may need updating after the client authentication- Throws:
IOException
- If authentication is required then there will be I/O with the client and this exception will be thrown if that goes wrong
-
setAppReadBufHandler
- Specified by:
setAppReadBufHandler
in classSocketWrapperBase<NioChannel>
-
newOperationState
protected <A> SocketWrapperBase<NioChannel>.OperationState<A> newOperationState(boolean read, ByteBuffer[] buffers, int offset, int length, SocketWrapperBase.BlockingMode block, long timeout, TimeUnit unit, A attachment, SocketWrapperBase.CompletionCheck check, CompletionHandler<Long, ? super A> handler, Semaphore semaphore, SocketWrapperBase<NioChannel>.VectoredIOCompletionHandler<A> completion) - Specified by:
newOperationState
in classSocketWrapperBase<NioChannel>
-