本文整理了Java中io.netty.channel.socket.SocketChannel.eventLoop()
方法的一些代码示例,展示了SocketChannel.eventLoop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SocketChannel.eventLoop()
方法的具体详情如下:
包路径:io.netty.channel.socket.SocketChannel
类名称:SocketChannel
方法名:eventLoop
暂无
代码示例来源:origin: oracle/helidon
ch.eventLoop().execute(this::clearQueues);
代码示例来源:origin: line/armeria
@Override
public void initChannel(SocketChannel ch) throws Exception {
final ChannelPipeline p = ch.pipeline();
final Http2Connection conn = new DefaultHttp2Connection(false);
final HttpToHttp2ConnectionHandler connHandler = new HttpToHttp2ConnectionHandlerBuilder()
.connection(conn)
.frameListener(new DelegatingDecompressorFrameListener(
conn,
new InboundHttp2ToHttpAdapterBuilder(conn)
.maxContentLength(Integer.MAX_VALUE)
.propagateSettings(true).build()))
.build();
clientHandler = new THttp2ClientHandler(ch.eventLoop());
if (sslCtx != null) {
p.addLast(sslCtx.newHandler(p.channel().alloc()));
p.addLast(connHandler);
configureEndOfPipeline(p);
} else {
final Http1ClientCodec sourceCodec = new Http1ClientCodec();
final HttpClientUpgradeHandler upgradeHandler = new HttpClientUpgradeHandler(
sourceCodec, new Http2ClientUpgradeCodec(connHandler), 65536);
p.addLast(sourceCodec, upgradeHandler, new UpgradeRequestHandler());
}
}
代码示例来源:origin: dremio/dremio-oss
boolean inEventLoop() {
return channel.eventLoop().inEventLoop();
}
代码示例来源:origin: org.neo4j/neo4j-causal-clustering
private void scheduleTimeout( SocketChannel ch, HandshakeClient handshakeClient )
{
ch.eventLoop().schedule( () -> {
if ( handshakeClient.failIfNotDone( "Timed out after " + timeout ) )
{
log.warn( "Failed handshake after timeout" );
}
}, timeout.toMillis(), TimeUnit.MILLISECONDS );
}
代码示例来源:origin: org.projectreactor/reactor-tcp
@Override
protected <C> TcpConnection<IN, OUT> createConnection(C channel) {
SocketChannel ch = (SocketChannel)channel;
return new NettyTcpConnection<IN, OUT>(
env,
getCodec(),
new NettyEventLoopDispatcher(ch.eventLoop()),
eventsDispatcher,
ch,
connectAddress
);
}
代码示例来源:origin: org.projectreactor/reactor-tcp
@Override
protected <C> NettyTcpConnection<IN, OUT> createConnection(C channel) {
SocketChannel ch = (SocketChannel)channel;
return new NettyTcpConnection<IN, OUT>(
env,
getCodec(),
new NettyEventLoopDispatcher(ch.eventLoop()),
eventsDispatcher,
ch
);
}
代码示例来源:origin: org.projectreactor/reactor-net
@Override
protected <C> NetChannel<IN, OUT> createChannel(C ioChannel) {
SocketChannel ch = (SocketChannel) ioChannel;
int backlog = getEnvironment().getProperty("reactor.tcp.connectionReactorBacklog", Integer.class, 128);
return new NettyNetChannel<IN, OUT>(
getEnvironment(),
getCodec(),
new NettyEventLoopDispatcher(ch.eventLoop(), backlog),
getReactor(),
ch
);
}
代码示例来源:origin: io.helidon.webserver/helidon-webserver-netty
ch.eventLoop().execute(this::clearQueues);
代码示例来源:origin: org.neo4j/neo4j-causal-clustering
/**
* schedules the handshake initiation after the connection attempt
*/
private void scheduleHandshake( SocketChannel ch, HandshakeClient handshakeClient, TimeoutStrategy.Timeout handshakeDelay )
{
ch.eventLoop().schedule( () ->
{
if ( ch.isActive() )
{
initiateHandshake( ch, handshakeClient );
}
else if ( ch.isOpen() )
{
handshakeDelay.increment();
scheduleHandshake( ch, handshakeClient, handshakeDelay );
}
else
{
handshakeClient.failIfNotDone( "Channel closed" );
}
}, handshakeDelay.getMillis(), MILLISECONDS );
}
内容来源于网络,如有侵权,请联系作者删除!