Tabnine Logo
org.glassfish.grizzly.utils
Code IndexAdd Tabnine to your IDE (free)

How to use org.glassfish.grizzly.utils

Best Java code snippets using org.glassfish.grizzly.utils (Showing top 20 results out of 315)

origin: com.ning/async-http-client

@Override
public InputStream getResponseBodyAsStream() throws IOException {
  return new BufferInputStream(responseBody);
}
origin: com.ning/async-http-client

GrizzlyResponseFuture(final AsyncHandler asyncHandler) {
  this.asyncHandler = asyncHandler;
  
  delegate = Futures.<V>createSafeFuture();
  delegate.addCompletionHandler(this);
}
origin: com.ning/async-http-client

  private Charset getCharset(final String charset) {

    String charsetLocal = charset;

    if (charsetLocal == null) {
      charsetLocal = httpResponsePacket.getCharacterEncoding();
    }

    return charsetLocal == null ?
        Charsets.ASCII_CHARSET :
        Charsets.lookupCharset(charsetLocal);
  }
}
origin: org.glassfish.grizzly/grizzly-websockets-server

public IdleTimeoutFilter(final DelayedExecutor executor,
             final long timeout,
             final TimeUnit timeUnit,
             final TimeoutHandler handler) {
  this(executor,
      new DefaultWorker(handler),
      new IdleTimeoutResolver(convertToMillis(timeout, timeUnit)));
}
origin: com.ning/async-http-client

  delay = timeout - 10;
timeoutExecutor = IdleTimeoutFilter.createDefaultIdleDelayedExecutor(delay, TimeUnit.MILLISECONDS);
timeoutExecutor.start();
final IdleTimeoutFilter.TimeoutResolver timeoutResolver =
    new IdleTimeoutFilter.TimeoutResolver() {
final IdleTimeoutFilter timeoutFilter = new IdleTimeoutFilter(timeoutExecutor,
    timeoutResolver,
    new IdleTimeoutFilter.TimeoutHandler() {
resolver = timeoutFilter.getResolver();
origin: com.ning/async-http-client

  @Override
  public void onError(Throwable t) {
    future.failure(makeIOException(t));
  }
});
origin: com.ning/async-http-client

@Override
public void close() {
  try {
    connectionManager.destroy();
    clientTransport.shutdownNow();
    final ExecutorService service = clientConfig.executorService();
    if (service != null) {
      service.shutdown();
    }
    if (timeoutExecutor != null) {
      timeoutExecutor.stop();
      timeoutExecutor.getThreadPool().shutdownNow();
    }
  } catch (IOException ignored) { }
}
origin: com.ning/async-http-client

void touchConnection(final Connection c, final Request request) {
  final long timeOut = request.getRequestTimeout() > 0
      ? request.getRequestTimeout()
      : clientConfig.getRequestTimeout();
  
  
  if (timeOut > 0) {
    if (resolver != null) {
      resolver.setTimeoutMillis(c,
          System.currentTimeMillis() + timeOut);
    }
  }
}
origin: com.ning/async-http-client

((WebSocketUpgradeHandler) context.getAsyncHandler()).onSuccess(context.webSocket);
final int wsTimeout = provider.getClientConfig().getWebSocketTimeout();
IdleTimeoutFilter.setCustomTimeout(ctx.getConnection(),
    (wsTimeout <= 0) ? IdleTimeoutFilter.FOREVER : wsTimeout,
    TimeUnit.MILLISECONDS);
origin: javaee/grizzly

public IdleTimeoutFilter(final DelayedExecutor executor,
             final long timeout,
             final TimeUnit timeUnit,
             final TimeoutHandler handler) {
  this(executor,
      new DefaultWorker(handler),
      new IdleTimeoutResolver(convertToMillis(timeout, timeUnit)));
}
origin: com.ning/async-http-client

@Override
public void onFailure(final Connection connection, final Throwable t) {
  connection.closeWithReason(Exceptions.makeIOException(t));
}

origin: com.ning/async-http-client

/**
 * This method will block if the async write queue is currently larger
 * than the configured maximum.  The amount of time that this method
 * will block is dependent on the write timeout of the transport
 * associated with the specified connection.
 */
private static void blockUntilQueueFree(final Connection c) {
  if (!c.canWrite()) {
    final FutureImpl<Boolean> future =
        Futures.createSafeFuture();
    // Connection may be obtained by calling FilterChainContext.getConnection().
    c.notifyCanWrite(new WriteHandler() {
      @Override
      public void onWritePossible() throws Exception {
        future.result(TRUE);
      }
      @Override
      public void onError(Throwable t) {
        future.failure(makeIOException(t));
      }
    });
    block(c, future);
  }
}
origin: javaee/grizzly

public IdleTimeoutFilter(final DelayedExecutor executor,
             final long timeout,
             final TimeUnit timeUnit,
             final TimeoutHandler handler) {
  this(executor,
      new DefaultWorker(handler),
      new IdleTimeoutResolver(convertToMillis(timeout, timeUnit)));
}
origin: com.ning/async-http-client

@Override
public void onError(Throwable t) {
  c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
  c.closeWithReason(Exceptions.makeIOException(t));
}
origin: org.glassfish.grizzly/grizzly-core

public IdleTimeoutFilter(final DelayedExecutor executor,
             final long timeout,
             final TimeUnit timeUnit,
             final TimeoutHandler handler) {
  this(executor,
      new DefaultWorker(handler),
      new IdleTimeoutResolver(convertToMillis(timeout, timeUnit)));
}
origin: com.ning/async-http-client

@Override
public void exceptionOccurred(final FilterChainContext ctx,
    final Throwable error) {
  ctx.getCloseable().closeWithReason(Exceptions.makeIOException(error));
}
origin: org.mule.glassfish.grizzly/grizzly-framework

public IdleTimeoutFilter(final DelayedExecutor executor,
             final long timeout,
             final TimeUnit timeUnit,
             final TimeoutHandler handler) {
  this(executor,
      new DefaultWorker(handler),
      new IdleTimeoutResolver(convertToMillis(timeout, timeUnit)));
}
origin: com.ning/async-http-client

private static void block(final Connection c,
             final FutureImpl<Boolean> future) {
  try {
    final long writeTimeout =
        c.getTransport().getWriteTimeout(MILLISECONDS);
    if (writeTimeout != -1) {
      future.get(writeTimeout, MILLISECONDS);
    } else {
      future.get();
    }
  } catch (ExecutionException e) {
    c.closeWithReason(Exceptions.makeIOException(e.getCause()));
  } catch (Exception e) {
    c.closeWithReason(Exceptions.makeIOException(e));
  }
}
origin: com.ning/async-http-client

@Override
public void ready() {
  try {
    flush();
  } catch (IOException e) {
    final Connection c = feedableBodyGenerator.context.getConnection();
    c.setMaxAsyncWriteQueueSize(feedableBodyGenerator.origMaxPendingBytes);
    c.closeWithReason(Exceptions.makeIOException(e));
  }
}
origin: com.ning/async-http-client

      : future.get();
} catch (ExecutionException ee) {
  throw Exceptions.makeIOException(ee.getCause());
} catch (Exception e) {
  throw Exceptions.makeIOException(e);
} finally {
  future.cancel(false);
org.glassfish.grizzly.utils

Most used classes

  • Futures
    Set of Future utilities.
  • DelayedExecutor
  • Charsets
    Charset utility class.
  • IdleTimeoutFilter
    The Filter is responsible for tracking Connection activity and closing Connection once it becomes id
  • BufferInputStream
    InputStream implementation over Grizzly Buffer.
  • ArraySet,
  • DelayedExecutor$DelayQueue,
  • DelayedExecutor$Resolver,
  • JdkVersion,
  • BufferOutputStream,
  • Holder,
  • StateHolder,
  • StringEncoder,
  • ActivityCheckFilter$ActiveRecord,
  • ActivityCheckFilter$DefaultWorker,
  • ActivityCheckFilter$Resolver,
  • ActivityCheckFilter$TimeoutHandler,
  • ActivityCheckFilter,
  • ArraySet$Itr
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now