@SuppressWarnings("unchecked") @Override public <T> T getOption(ChannelOption<T> option) { if (option == DOMAIN_SOCKET_READ_MODE) { return (T) getReadMode(); } return super.getOption(option); }
@Override @SuppressWarnings("deprecation") public Map<ChannelOption<?>, Object> getOptions() { return getOptions( super.getOptions(), SO_BROADCAST, SO_RCVBUF, SO_SNDBUF, SO_REUSEADDR, IP_MULTICAST_LOOP_DISABLED, IP_MULTICAST_ADDR, IP_MULTICAST_IF, IP_MULTICAST_TTL, IP_TOS, DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, SO_REUSEPORT); }
@Override public void reset(ChannelConfig config) { overrideGuess = ((KQueueChannelConfig) config).getRcvAllocTransportProvidesGuess(); delegate.reset(config); }
@Override public KQueueSocketChannelConfig setAllocator(ByteBufAllocator allocator) { super.setAllocator(allocator); return this; }
/** * Write bytes form the given {@link ByteBuf} to the underlying {@link java.nio.channels.Channel}. * @param in the collection which contains objects to write. * @param buf the {@link ByteBuf} from which the bytes should be written * @return The value that should be decremented from the write quantum which starts at * {@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows: * <ul> * <li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content) * is encountered</li> * <li>1 - if a single call to write data was made to the OS</li> * <li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no * data was accepted</li> * </ul> */ private int writeBytes(ChannelOutboundBuffer in, ByteBuf buf) throws Exception { int readableBytes = buf.readableBytes(); if (readableBytes == 0) { in.remove(); return 0; } if (buf.hasMemoryAddress() || buf.nioBufferCount() == 1) { return doWriteBytes(in, buf); } else { ByteBuffer[] nioBuffers = buf.nioBuffers(); return writeBytesMultiple(in, nioBuffers, nioBuffers.length, readableBytes, config().getMaxBytesPerGatheringWrite()); } }
@Override public KQueueDomainSocketChannelConfig setAutoRead(boolean autoRead) { super.setAutoRead(autoRead); return this; }
@Override public KQueueDomainSocketChannelConfig setAutoClose(boolean autoClose) { super.setAutoClose(autoClose); return this; }
@Override public void run() { if (!unsafe.readPending && !config().isAutoRead()) { // Still no read triggered so clear it now unsafe.clearReadFilter0(); } } });
@Override protected void doWrite(ChannelOutboundBuffer in) throws Exception { int writeSpinCount = config().getWriteSpinCount(); do { final int msgCount = in.size();
int connectTimeoutMillis = config().getConnectTimeoutMillis(); if (connectTimeoutMillis > 0) { connectTimeoutFuture = eventLoop().schedule(new Runnable() {
@Override public KQueueDomainSocketChannelConfig setAllocator(ByteBufAllocator allocator) { super.setAllocator(allocator); return this; }
/** * Write bytes form the given {@link ByteBuf} to the underlying {@link java.nio.channels.Channel}. * @param in the collection which contains objects to write. * @param buf the {@link ByteBuf} from which the bytes should be written * @return The value that should be decremented from the write quantum which starts at * {@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows: * <ul> * <li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content) * is encountered</li> * <li>1 - if a single call to write data was made to the OS</li> * <li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no * data was accepted</li> * </ul> */ private int writeBytes(ChannelOutboundBuffer in, ByteBuf buf) throws Exception { int readableBytes = buf.readableBytes(); if (readableBytes == 0) { in.remove(); return 0; } if (buf.hasMemoryAddress() || buf.nioBufferCount() == 1) { return doWriteBytes(in, buf); } else { ByteBuffer[] nioBuffers = buf.nioBuffers(); return writeBytesMultiple(in, nioBuffers, nioBuffers.length, readableBytes, config().getMaxBytesPerGatheringWrite()); } }
@Override public KQueueSocketChannelConfig setAutoRead(boolean autoRead) { super.setAutoRead(autoRead); return this; }
@Override public KQueueSocketChannelConfig setAutoClose(boolean autoClose) { super.setAutoClose(autoClose); return this; }
@Override public void run() { if (!unsafe.readPending && !config().isAutoRead()) { // Still no read triggered so clear it now unsafe.clearReadFilter0(); } } });
@Override protected void doWrite(ChannelOutboundBuffer in) throws Exception { int writeSpinCount = config().getWriteSpinCount(); do { final int msgCount = in.size();
int connectTimeoutMillis = config().getConnectTimeoutMillis(); if (connectTimeoutMillis > 0) { connectTimeoutFuture = eventLoop().schedule(new Runnable() {
@SuppressWarnings("unchecked") @Override public <T> T getOption(ChannelOption<T> option) { if (option == DOMAIN_SOCKET_READ_MODE) { return (T) getReadMode(); } return super.getOption(option); }
@Override @SuppressWarnings("deprecation") public Map<ChannelOption<?>, Object> getOptions() { return getOptions(super.getOptions(), RCV_ALLOC_TRANSPORT_PROVIDES_GUESS); }
@Override public KQueueServerChannelConfig setAllocator(ByteBufAllocator allocator) { super.setAllocator(allocator); return this; }