Package org.jgrapes.net
Class SocketConnectionManager.SocketChannelImpl
java.lang.Object
org.jgrapes.core.Subchannel.DefaultSubchannel
org.jgrapes.io.IOSubchannel.DefaultIOSubchannel
org.jgrapes.net.SocketConnectionManager.SocketChannelImpl
- All Implemented Interfaces:
Associator,Channel,Eligible,Subchannel,IOSubchannel,NioHandler,SocketIOChannel
- Enclosing class:
SocketConnectionManager
protected class SocketConnectionManager.SocketChannelImpl
extends IOSubchannel.DefaultIOSubchannel
implements NioHandler, SocketIOChannel
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.DefaultNested classes/interfaces inherited from interface org.jgrapes.io.IOSubchannel
IOSubchannel.DefaultIOSubchannelNested classes/interfaces inherited from interface org.jgrapes.core.Subchannel
Subchannel.DefaultSubchannel -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this channel.Gets the down pipeline.voidhandleOps(int ops) Invoked by theNioDispatcherwhen operations are pending.booleanChecks if is purgeable.Returns the local address.Gets the nio channel.Returns the event that caused this connection to be opened.longGets the the time when the connection became purgeable.Gets the read buffers.voidregistrationComplete(NioRegistration.Registration registration) Invoked when registration has completed.Returns the remote address.toString()voidwrite(Output<ByteBuffer> event) Write the data on this channel.Methods inherited from class org.jgrapes.io.IOSubchannel.DefaultIOSubchannel
byteBufferPool, charBufferPool, responsePipeline, setByteBufferPool, setCharBufferPoolMethods inherited from class org.jgrapes.core.Subchannel.DefaultSubchannel
associated, mainChannel, setAssociatedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associated, associatedGet, setAssociatedMethods inherited from interface org.jgrapes.io.IOSubchannel
byteBufferPool, charBufferPool, respond, responsePipelineMethods inherited from interface org.jgrapes.core.Subchannel
defaultCriterion, isEligibleFor, mainChannel
-
Constructor Details
-
SocketChannelImpl
public SocketChannelImpl(OpenSocketConnection openEvent, SocketChannel nioChannel) throws IOException - Parameters:
nioChannel- the channel- Throws:
IOException- if an I/O error occurred
-
-
Method Details
-
openEvent
Returns the event that caused this connection to be opened.May be
nullif the channel was created in response to a client connecting to the server.- Returns:
- the event
-
nioChannel
Gets the nio channel.- Returns:
- the nioChannel
-
localAddress
Description copied from interface:SocketIOChannelReturns the local address.- Specified by:
localAddressin interfaceSocketIOChannel- Returns:
- the socket address
-
remoteAddress
Description copied from interface:SocketIOChannelReturns the remote address.- Specified by:
remoteAddressin interfaceSocketIOChannel- Returns:
- the socket address
-
readBuffers
Gets the read buffers.- Returns:
- the readBuffers
-
downPipeline
Gets the down pipeline.- Returns:
- the downPipeline
-
registrationComplete
Invoked when registration has completed.- Parameters:
registration- the registration (result from theNioRegistrationevent)
-
isPurgeable
Checks if is purgeable.- Specified by:
isPurgeablein interfaceSocketIOChannel- Returns:
- true, if is purgeable
-
purgeableSince
Gets the the time when the connection became purgeable.- Specified by:
purgeableSincein interfaceSocketIOChannel- Returns:
- the time
-
write
Write the data on this channel.- Parameters:
event- the event- Throws:
InterruptedException
-
handleOps
Description copied from interface:NioHandlerInvoked by theNioDispatcherwhen operations are pending.- Specified by:
handleOpsin interfaceNioHandler- Parameters:
ops- the pending operations as or’ed constants defined bySelectionKey- Throws:
InterruptedException
-
close
Closes this channel.- Throws:
IOException- if an error occursInterruptedException- if the execution was interrupted
-
toString
- Overrides:
toStringin classSubchannel.DefaultSubchannel
-