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.Default
Nested classes/interfaces inherited from interface org.jgrapes.io.IOSubchannel
IOSubchannel.DefaultIOSubchannel
Nested classes/interfaces inherited from interface org.jgrapes.core.Subchannel
Subchannel.DefaultSubchannel
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this channel.Gets the down pipeline.void
handleOps
(int ops) Invoked by theNioDispatcher
when operations are pending.boolean
Checks if is purgeable.Returns the local address.Gets the nio channel.Returns the event that caused this connection to be opened.long
Gets the the time when the connection became purgeable.Gets the read buffers.void
registrationComplete
(NioRegistration.Registration registration) Invoked when registration has completed.Returns the remote address.toString()
void
write
(Output<ByteBuffer> event) Write the data on this channel.Methods inherited from class org.jgrapes.io.IOSubchannel.DefaultIOSubchannel
byteBufferPool, charBufferPool, responsePipeline, setByteBufferPool, setCharBufferPool
Methods inherited from class org.jgrapes.core.Subchannel.DefaultSubchannel
associated, mainChannel, setAssociated
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associated, associatedGet, setAssociated
Methods inherited from interface org.jgrapes.io.IOSubchannel
byteBufferPool, charBufferPool, respond, responsePipeline
Methods 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
null
if 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:SocketIOChannel
Returns the local address.- Specified by:
localAddress
in interfaceSocketIOChannel
- Returns:
- the socket address
-
remoteAddress
Description copied from interface:SocketIOChannel
Returns the remote address.- Specified by:
remoteAddress
in 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 theNioRegistration
event)
-
isPurgeable
Checks if is purgeable.- Specified by:
isPurgeable
in interfaceSocketIOChannel
- Returns:
- true, if is purgeable
-
purgeableSince
Gets the the time when the connection became purgeable.- Specified by:
purgeableSince
in interfaceSocketIOChannel
- Returns:
- the time
-
write
Write the data on this channel.- Parameters:
event
- the event- Throws:
InterruptedException
-
handleOps
Description copied from interface:NioHandler
Invoked by theNioDispatcher
when operations are pending.- Specified by:
handleOps
in 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:
toString
in classSubchannel.DefaultSubchannel
-