io.grpc.internal.LogExceptionRunnable Java Examples
The following examples show how to use
io.grpc.internal.LogExceptionRunnable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestServiceImpl.java From grpc-nebula-java with Apache License 2.0 | 6 votes |
/** * Schedules the next response chunk to be dispatched. If all input has been received and there * are no more chunks in the queue, the stream is closed. */ private void scheduleNextChunk() { synchronized (this) { if (scheduled) { // Dispatch task is already scheduled. return; } // Schedule the next response chunk if there is one. Chunk nextChunk = chunks.peek(); if (nextChunk != null) { scheduled = true; // TODO(ejona): cancel future if RPC is cancelled Future<?> unused = executor.schedule(new LogExceptionRunnable(dispatchTask), nextChunk.delayMicroseconds, TimeUnit.MICROSECONDS); return; } } }
Example #2
Source File: MaxConnectionIdleManager.java From grpc-nebula-java with Apache License 2.0 | 6 votes |
@VisibleForTesting void start(final ChannelHandlerContext ctx, final ScheduledExecutorService scheduler) { this.scheduler = scheduler; nextIdleMonitorTime = ticker.nanoTime() + maxConnectionIdleInNanos; shutdownTask = new LogExceptionRunnable(new Runnable() { @Override public void run() { if (shutdownDelayed) { if (!isActive) { // delay shutdown shutdownFuture = scheduler.schedule( shutdownTask, nextIdleMonitorTime - ticker.nanoTime(), TimeUnit.NANOSECONDS); shutdownDelayed = false; } // if isActive, exit. Will schedule a new shutdownFuture once onTransportIdle } else { close(ctx); shutdownFuture = null; } } }); shutdownFuture = scheduler.schedule(shutdownTask, maxConnectionIdleInNanos, TimeUnit.NANOSECONDS); }
Example #3
Source File: TestServiceImpl.java From armeria with Apache License 2.0 | 6 votes |
/** * Schedules the next response chunk to be dispatched. If all input has been received and there * are no more chunks in the queue, the stream is closed. */ private void scheduleNextChunk() { synchronized (this) { if (scheduled) { // Dispatch task is already scheduled. return; } // Schedule the next response chunk if there is one. final Chunk nextChunk = chunks.peek(); if (nextChunk != null) { scheduled = true; // TODO(ejona): cancel future if RPC is cancelled final Future<?> unused = executor.schedule(new LogExceptionRunnable(dispatchTask), nextChunk.delayMicroseconds, TimeUnit.MICROSECONDS); return; } } }
Example #4
Source File: TestServiceImpl.java From grpc-java with Apache License 2.0 | 6 votes |
/** * Schedules the next response chunk to be dispatched. If all input has been received and there * are no more chunks in the queue, the stream is closed. */ private void scheduleNextChunk() { synchronized (this) { if (scheduled) { // Dispatch task is already scheduled. return; } // Schedule the next response chunk if there is one. Chunk nextChunk = chunks.peek(); if (nextChunk != null) { scheduled = true; // TODO(ejona): cancel future if RPC is cancelled Future<?> unused = executor.schedule(new LogExceptionRunnable(dispatchTask), nextChunk.delayMicroseconds, TimeUnit.MICROSECONDS); return; } } }
Example #5
Source File: MaxConnectionIdleManager.java From grpc-java with Apache License 2.0 | 6 votes |
@VisibleForTesting void start(final ChannelHandlerContext ctx, final ScheduledExecutorService scheduler) { this.scheduler = scheduler; nextIdleMonitorTime = ticker.nanoTime() + maxConnectionIdleInNanos; shutdownTask = new LogExceptionRunnable(new Runnable() { @Override public void run() { if (shutdownDelayed) { if (!isActive) { // delay shutdown shutdownFuture = scheduler.schedule( shutdownTask, nextIdleMonitorTime - ticker.nanoTime(), TimeUnit.NANOSECONDS); shutdownDelayed = false; } // if isActive, exit. Will schedule a new shutdownFuture once onTransportIdle } else { close(ctx); shutdownFuture = null; } } }); shutdownFuture = scheduler.schedule(shutdownTask, maxConnectionIdleInNanos, TimeUnit.NANOSECONDS); }