Package io.netty.channel.nio
Class NioIoHandler.DefaultNioRegistration
- java.lang.Object
-
- io.netty.channel.nio.NioIoHandler.DefaultNioRegistration
-
- All Implemented Interfaces:
IoRegistration
- Enclosing class:
- NioIoHandler
final class NioIoHandler.DefaultNioRegistration extends java.lang.Object implements IoRegistration
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBooleancanceledprivate NioIoHandlehandleprivate java.nio.channels.SelectionKeykey
-
Constructor Summary
Constructors Constructor Description DefaultNioRegistration(ThreadAwareExecutor executor, NioIoHandle handle, NioIoOps initialOps, java.nio.channels.Selector selector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tattachment()Implementation specific attachment, which might benull.booleancancel()Cancel the registration.(package private) voidclose()(package private) NioIoHandlehandle()(package private) voidhandle(int ready)booleanisValid()Returnstrueif the registration is still valid.(package private) voidregister(java.nio.channels.Selector selector)longsubmit(IoOps ops)Submit theIoOpsto the registration.
-
-
-
Field Detail
-
canceled
private final java.util.concurrent.atomic.AtomicBoolean canceled
-
handle
private final NioIoHandle handle
-
key
private volatile java.nio.channels.SelectionKey key
-
-
Constructor Detail
-
DefaultNioRegistration
DefaultNioRegistration(ThreadAwareExecutor executor, NioIoHandle handle, NioIoOps initialOps, java.nio.channels.Selector selector) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
handle
NioIoHandle handle()
-
register
void register(java.nio.channels.Selector selector) throws java.io.IOException- Throws:
java.io.IOException
-
attachment
public <T> T attachment()
Description copied from interface:IoRegistrationImplementation specific attachment, which might benull.- Specified by:
attachmentin interfaceIoRegistration- Returns:
- attachment.
-
isValid
public boolean isValid()
Description copied from interface:IoRegistrationReturnstrueif the registration is still valid. OnceIoRegistration.cancel()is called this will returnfalse.- Specified by:
isValidin interfaceIoRegistration- Returns:
- valid.
-
submit
public long submit(IoOps ops)
Description copied from interface:IoRegistrationSubmit theIoOpsto the registration.- Specified by:
submitin interfaceIoRegistration- Parameters:
ops- ops.- Returns:
- an identifier for the operation, which might be unique or not (depending on the implementation).
-
cancel
public boolean cancel()
Description copied from interface:IoRegistrationCancel the registration.- Specified by:
cancelin interfaceIoRegistration- Returns:
trueif cancellation was successful,falseotherwise.
-
close
void close()
-
handle
void handle(int ready)
-
-