本文整理了Java中java.nio.channels.SocketChannel.getOption()
方法的一些代码示例,展示了SocketChannel.getOption()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SocketChannel.getOption()
方法的具体详情如下:
包路径:java.nio.channels.SocketChannel
类名称:SocketChannel
方法名:getOption
暂无
代码示例来源:origin: apache/nifi
final int actualSendBufSize = channel.getOption(StandardSocketOptions.SO_SNDBUF);
if (actualSendBufSize < maxSendBufferSize) {
logger.warn("Attempted to set Socket Send Buffer Size to " + maxSendBufferSize
代码示例来源:origin: jitsi/ice4j
/**
* {@inheritDoc}
*
* Forwards to {@link #delegate}.
*/
@Override
public <U> U getOption(SocketOption<U> name)
throws IOException
{
return delegate.getOption(name);
}
代码示例来源:origin: kg.apc/jmeter-plugins-common-io
@Override
public <T> T getOption(SocketOption<T> socketOption) throws IOException {
return socketChannel.getOption(socketOption);
}
代码示例来源:origin: undera/jmeter-plugins
@Override
public <T> T getOption(SocketOption<T> socketOption) throws IOException {
return socketChannel.getOption(socketOption);
}
代码示例来源:origin: worstcase/gumshoe
public <T> T getOption(SocketOption<T> name) throws IOException { return delegate.getOption(name); }
public Set<SocketOption<?>> supportedOptions() { return delegate.supportedOptions(); }
代码示例来源:origin: oci-pronghorn/Pronghorn
private void checkBuffers(int i, Pipe<NetPayloadSchema> pipe, SocketChannel socketChannel) {
if (!bufferChecked[i]) {
try {
int minBufSize = Math.max(workingBuffers.length>8 ? pipe.maxVarLen*4 : pipe.sizeOfBlobRing,
socketChannel.getOption(StandardSocketOptions.SO_SNDBUF));
if (null==workingBuffers[i] || workingBuffers[i].capacity()<minBufSize) {
workingBuffers[i] = ByteBuffer.allocateDirect(minBufSize);
}
bufferChecked[i] = true;
} catch (ClosedChannelException cce) {
if (null==workingBuffers[i]) {
workingBuffers[i] = ByteBuffer.allocateDirect(workingBuffers.length>8 ? pipe.maxVarLen*4 : pipe.sizeOfBlobRing);
}
bufferChecked[i] = true;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: oci-pronghorn/Pronghorn
private ClientConnection checkBuffers(int i, Pipe<NetPayloadSchema> pipe, ClientConnection cc) {
if (!bufferChecked[i]) {
if (null!=cc) {
SocketChannel sc = cc.getSocketChannel();
if (null!=sc) {
try {
int minBufSize = Math.max(pipe.sizeOfBlobRing/4, //buffer should be as large as the full pipe so more can accumulate
sc.getOption(StandardSocketOptions.SO_SNDBUF));
if (null!=buffers[i]) {
logger.trace("buffer is {} and must be at least {}",buffers[i].capacity(), minBufSize);
}
if (null==buffers[i] || buffers[i].capacity()<minBufSize) {
//logger.info("new direct buffer of size {} created old one was too small.",minBufSize);
buffers[i] = ByteBuffer.allocateDirect(minBufSize);
}
bufferChecked[i] = true;
} catch (IOException e) {
return null;
}
}
}
}
return cc;
}
代码示例来源:origin: org.jppf/jppf-common
/**
* Open the underlying socket connection.
* @throws ConnectException if the socket fails to connect.
* @throws IOException if the underlying input and output streams raise an error.
*/
@Override
public void open() throws ConnectException, IOException {
channel = SocketChannel.open();
channel.setOption(StandardSocketOptions.SO_RCVBUF, IO.SOCKET_BUFFER_SIZE);
channel.setOption(StandardSocketOptions.SO_SNDBUF, IO.SOCKET_BUFFER_SIZE);
channel.setOption(StandardSocketOptions.TCP_NODELAY, IO.SOCKET_TCP_NODELAY);
channel.setOption(StandardSocketOptions.SO_KEEPALIVE, IO.SOCKET_KEEPALIVE);
final InetSocketAddress address = new InetSocketAddress(host, port);
channel.connect(address);
if (!blocking) {
while (!channel.finishConnect()) {
try {
Thread.sleep(1L);
} catch (@SuppressWarnings("unused") final InterruptedException e) {
}
}
}
opened = true;
if (debugEnabled) log.debug("getReceiveBufferSize() = {}", channel.getOption(StandardSocketOptions.SO_RCVBUF));
}
代码示例来源:origin: oci-pronghorn/Pronghorn
receiveBufferSize = 1+testChannel.getOption(StandardSocketOptions.SO_RCVBUF);
代码示例来源:origin: oci-pronghorn/Pronghorn
this.recBufferSize = this.getSocketChannel().getOption(StandardSocketOptions.SO_RCVBUF);
内容来源于网络,如有侵权,请联系作者删除!