本文整理了Java中io.netty.channel.EventLoop.inEventLoop()
方法的一些代码示例,展示了EventLoop.inEventLoop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EventLoop.inEventLoop()
方法的具体详情如下:
包路径:io.netty.channel.EventLoop
类名称:EventLoop
方法名:inEventLoop
暂无
代码示例来源:origin: netty/netty
@Override
public ChannelFuture shutdownOutput(final ChannelPromise promise) {
EventLoop loop = eventLoop();
if (loop.inEventLoop()) {
shutdownOutput0(promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
shutdownOutput0(promise);
}
});
}
return promise;
}
代码示例来源:origin: netty/netty
@Override
public ChannelFuture shutdownInput(final ChannelPromise promise) {
EventLoop loop = eventLoop();
if (loop.inEventLoop()) {
shutdownInput0(promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
shutdownInput0(promise);
}
});
}
return promise;
}
代码示例来源:origin: netty/netty
@Override
public ChannelFuture shutdownInput(final ChannelPromise promise) {
EventLoop loop = eventLoop();
if (loop.inEventLoop()) {
shutdownInput0(promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
shutdownInput0(promise);
}
});
}
return promise;
}
代码示例来源:origin: line/armeria
@Override
public void release() {
if (!eventLoop.inEventLoop()) {
eventLoop.execute(this::doRelease);
} else {
doRelease();
}
}
代码示例来源:origin: ReactiveX/RxNetty
@Override
public void call() {
if (channel.eventLoop().inEventLoop()) {
run();
} else {
channel.eventLoop().execute(this);
}
}
}
代码示例来源:origin: netty/netty
/**
* Set read pending to {@code false}.
*/
protected final void clearReadPending() {
if (isRegistered()) {
EventLoop eventLoop = eventLoop();
if (eventLoop.inEventLoop()) {
readPending = false;
} else {
eventLoop.execute(clearReadPendingRunnable);
}
} else {
// Best effort if we are not registered yet clear readPending. This happens during channel initialization.
readPending = false;
}
}
}
代码示例来源:origin: netty/netty
/**
* @deprecated Use {@link #clearReadPending()} if appropriate instead.
* No longer supported.
*/
@Deprecated
protected void setReadPending(final boolean readPending) {
if (isRegistered()) {
EventLoop eventLoop = eventLoop();
if (eventLoop.inEventLoop()) {
this.readPending = readPending;
} else {
eventLoop.execute(new Runnable() {
@Override
public void run() {
AbstractOioChannel.this.readPending = readPending;
}
});
}
} else {
this.readPending = readPending;
}
}
代码示例来源:origin: redisson/redisson
private void addToSpliceQueue(final SpliceInTask task) {
EventLoop eventLoop = eventLoop();
if (eventLoop.inEventLoop()) {
addToSpliceQueue0(task);
} else {
eventLoop.execute(new Runnable() {
@Override
public void run() {
addToSpliceQueue0(task);
}
});
}
}
代码示例来源:origin: redisson/redisson
@Override
public ChannelFuture shutdownOutput(final ChannelPromise promise) {
EventLoop loop = eventLoop();
if (loop.inEventLoop()) {
shutdownOutput0(promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
shutdownOutput0(promise);
}
});
}
return promise;
}
代码示例来源:origin: redisson/redisson
@Override
public ChannelFuture shutdownInput(final ChannelPromise promise) {
EventLoop loop = eventLoop();
if (loop.inEventLoop()) {
shutdownInput0(promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
shutdownInput0(promise);
}
});
}
return promise;
}
代码示例来源:origin: redisson/redisson
@Override
public ChannelFuture shutdownInput(final ChannelPromise promise) {
EventLoop loop = eventLoop();
if (loop.inEventLoop()) {
shutdownInput0(promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
shutdownInput0(promise);
}
});
}
return promise;
}
代码示例来源:origin: redisson/redisson
@Override
public ChannelFuture shutdownInput(final ChannelPromise promise) {
EventLoop loop = eventLoop();
if (loop.inEventLoop()) {
shutdownInput0(promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
shutdownInput0(promise);
}
});
}
return promise;
}
代码示例来源:origin: redisson/redisson
/**
* Set read pending to {@code false}.
*/
protected final void clearReadPending() {
if (isRegistered()) {
EventLoop eventLoop = eventLoop();
if (eventLoop.inEventLoop()) {
readPending = false;
} else {
eventLoop.execute(clearReadPendingRunnable);
}
} else {
// Best effort if we are not registered yet clear readPending. This happens during channel initialization.
readPending = false;
}
}
}
代码示例来源:origin: netty/netty
@Override
public ChannelFuture shutdownOutput(final ChannelPromise promise) {
final EventLoop loop = eventLoop();
if (loop.inEventLoop()) {
((AbstractUnsafe) unsafe()).shutdownOutput(promise);
} else {
loop.execute(new Runnable() {
@Override
public void run() {
((AbstractUnsafe) unsafe()).shutdownOutput(promise);
}
});
}
return promise;
}
代码示例来源:origin: line/armeria
@Override
public void close(Throwable cause) {
requireNonNull(cause, "cause");
if (cause instanceof CancelledSubscriptionException) {
throw new IllegalArgumentException("cause: " + cause + " (must use Subscription.cancel())");
}
if (eventLoop.inEventLoop()) {
doClose(cause);
} else {
eventLoop.execute(() -> doClose(cause));
}
}
代码示例来源:origin: redisson/redisson
/**
* @deprecated Use {@link #clearReadPending()} if appropriate instead.
* No longer supported.
*/
@Deprecated
protected void setReadPending(final boolean readPending) {
if (isRegistered()) {
EventLoop eventLoop = eventLoop();
if (eventLoop.inEventLoop()) {
this.readPending = readPending;
} else {
eventLoop.execute(new Runnable() {
@Override
public void run() {
AbstractOioChannel.this.readPending = readPending;
}
});
}
} else {
this.readPending = readPending;
}
}
代码示例来源:origin: netty/netty
/**
* Set read pending to {@code false}.
*/
protected final void clearReadPending() {
if (isRegistered()) {
EventLoop eventLoop = eventLoop();
if (eventLoop.inEventLoop()) {
clearReadPending0();
} else {
eventLoop.execute(clearReadPendingRunnable);
}
} else {
// Best effort if we are not registered yet clear readPending. This happens during channel initialization.
// NB: We only set the boolean field instead of calling clearReadPending0(), because the SelectionKey is
// not set yet so it would produce an assertion failure.
readPending = false;
}
}
代码示例来源:origin: line/armeria
@Override
void addObject(T obj) {
wroteAny = true;
if (eventLoop.inEventLoop()) {
doAddObject(obj);
} else {
eventLoop.execute(() -> doAddObject(obj));
}
}
代码示例来源:origin: netty/netty
/**
* @deprecated Use {@link #clearReadPending()} if appropriate instead.
* No longer supported.
*/
@Deprecated
protected void setReadPending(final boolean readPending) {
if (isRegistered()) {
EventLoop eventLoop = eventLoop();
if (eventLoop.inEventLoop()) {
setReadPending0(readPending);
} else {
eventLoop.execute(new Runnable() {
@Override
public void run() {
setReadPending0(readPending);
}
});
}
} else {
// Best effort if we are not registered yet clear readPending.
// NB: We only set the boolean field instead of calling clearReadPending0(), because the SelectionKey is
// not set yet so it would produce an assertion failure.
this.readPending = readPending;
}
}
代码示例来源:origin: wildfly/wildfly
private void addToSpliceQueue(final SpliceInTask task) {
EventLoop eventLoop = eventLoop();
if (eventLoop.inEventLoop()) {
addToSpliceQueue0(task);
} else {
eventLoop.execute(new Runnable() {
@Override
public void run() {
addToSpliceQueue0(task);
}
});
}
}
内容来源于网络,如有侵权,请联系作者删除!