org.glassfish.grizzly.Connection.getProcessor()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.glassfish.grizzly.Connection.getProcessor()方法的一些代码示例,展示了Connection.getProcessor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.getProcessor()方法的具体详情如下:
包路径:org.glassfish.grizzly.Connection
类名称:Connection
方法名:getProcessor

Connection.getProcessor介绍

[英]Gets the default Processor, which will process ConnectionI/O events. If Processor is null, - then Transport will try to get Processor using Connection's ProcessorSelector#select(IOEvent,Connection). If ProcessorSelector, associated withthe Connection is also null - Transport will try to get Processorusing own settings.
[中]获取将处理ConnectionI/O事件的默认处理器。如果Processor为null,-则传输将尝试使用连接的ProcessorSelector#select(IOEvent,Connection)获取处理器。如果与连接关联的ProcessorSelector也为null,则传输将尝试使用自己的设置获取ProcessorSelector。

代码示例

代码示例来源:origin: com.ning/async-http-client

@Override
  public void onClosed(Closeable closeable, CloseType type) throws IOException {
    if (isGracefullyFinishResponseOnClose()) {
      // Connection was closed.
      // This event is fired only for responses, which don't have
      // associated transfer-encoding or content-length.
      // We have to complete such a request-response processing gracefully.
      final FilterChain fc = (FilterChain) connection.getProcessor();
      fc.fireEventUpstream(connection,
          new GracefulCloseEvent(HttpTransactionContext.this), null);
    } else if (CloseType.REMOTELY.equals(type)) {
      abort(AsyncHttpProviderUtils.REMOTELY_CLOSED_EXCEPTION);
    } else {
      try {
        closeable.assertOpen();
      } catch (IOException ioe) {
        // unwrap the exception as it was wrapped by assertOpen.
        abort(ioe.getCause());
      }
    }
  }
};

代码示例来源:origin: javaee/grizzly

/**
   * {@inheritDoc}
   */
  @Override
  public Processor select(IOEvent ioEvent, Connection connection) {

    Processor eventProcessor = connection.getProcessor();

    if (eventProcessor != null && eventProcessor.isInterested(ioEvent)) {
      return eventProcessor;
    }

    ProcessorSelector processorSelector =
        connection.getProcessorSelector();

    if (processorSelector != null) {
      return processorSelector.select(ioEvent, connection);
    }

    return null;
  }
}

代码示例来源:origin: org.forgerock.ce.opendj/opendj-ldap-sdk

/**
 * Indicates whether or not TLS is enabled on this connection.
 *
 * @return {@code true} if TLS is enabled on this connection, otherwise
 *         {@code false}.
 */
boolean isTLSEnabled() {
  synchronized (stateLock) {
    final FilterChain currentFilterChain = (FilterChain) connection.getProcessor();
    for (final Filter filter : currentFilterChain) {
      if (filter instanceof SSLFilter) {
        return true;
      }
    }
    return false;
  }
}

代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-framework

/**
   * {@inheritDoc}
   */
  @Override
  public Processor select(IOEvent ioEvent, Connection connection) {

    Processor eventProcessor = connection.getProcessor();

    if (eventProcessor != null && eventProcessor.isInterested(ioEvent)) {
      return eventProcessor;
    }

    ProcessorSelector processorSelector =
        connection.getProcessorSelector();

    if (processorSelector != null) {
      return processorSelector.select(ioEvent, connection);
    }

    return null;
  }
}

代码示例来源:origin: javaee/grizzly

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
   * {@inheritDoc}
   */
  @Override
  public Processor select(IOEvent ioEvent, Connection connection) {

    Processor eventProcessor = connection.getProcessor();

    if (eventProcessor != null && eventProcessor.isInterested(ioEvent)) {
      return eventProcessor;
    }

    ProcessorSelector processorSelector =
        connection.getProcessorSelector();

    if (processorSelector != null) {
      return processorSelector.select(ioEvent, connection);
    }

    return null;
  }
}

代码示例来源:origin: javaee/grizzly

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

/**
   * {@inheritDoc}
   */
  @Override
  public Processor select(IOEvent ioEvent, Connection connection) {

    Processor eventProcessor = connection.getProcessor();

    if (eventProcessor != null && eventProcessor.isInterested(ioEvent)) {
      return eventProcessor;
    }

    ProcessorSelector processorSelector =
        connection.getProcessorSelector();

    if (processorSelector != null) {
      return processorSelector.select(ioEvent, connection);
    }

    return null;
  }
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: javaee/grizzly

/**
   * {@inheritDoc}
   */
  @Override
  public Processor select(IOEvent ioEvent, Connection connection) {

    Processor eventProcessor = connection.getProcessor();

    if (eventProcessor != null && eventProcessor.isInterested(ioEvent)) {
      return eventProcessor;
    }

    ProcessorSelector processorSelector =
        connection.getProcessorSelector();

    if (processorSelector != null) {
      return processorSelector.select(ioEvent, connection);
    }

    return null;
  }
}

代码示例来源:origin: javaee/grizzly

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: javaee/grizzly

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: javaee/grizzly

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: javaee/grizzly

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: javaee/grizzly

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: javaee/grizzly

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-core

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-framework

public FilterChainContext createContext(final Connection connection,
    final Operation operation) {
  FilterChain filterChain = (FilterChain) connection.getProcessor();
  final FilterChainContext ctx =
      filterChain.obtainFilterChainContext(connection);
  final int idx = filterChain.indexOf(this);
  ctx.setOperation(operation);
  ctx.setFilterIdx(idx);
  ctx.setStartIdx(idx);
  return ctx;
}

代码示例来源:origin: javaee/grizzly

public void setupClient() {
  clienttransport = TCPNIOTransportBuilder.newInstance().build();
  try {
    clienttransport.start();
    clienttransport.configureBlocking(false);
    clienttransport.configureStandalone(true);
    
    Future<Connection> future =
        clienttransport.connect("localhost", PORT);
    clientconnection = future.get(10, TimeUnit.SECONDS);
    assertTrue(clientconnection != null);
    clientconnection.configureStandalone(true);
    clientWriter =
        ((StandaloneProcessor) clientconnection.getProcessor()).
        getStreamWriter(clientconnection);
    
  } catch (Exception ex) {
    LOGGER.log(Level.SEVERE, "Client start error", ex);
  }
}

相关文章