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

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

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

Connection.write介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
@SuppressWarnings("rawtypes")
public void send(Object message, boolean sent) throws RemotingException {
  super.send(message, sent);
  int timeout = 0;
  try {
    GrizzlyFuture future = connection.write(message);
    if (sent) {
      timeout = getUrl().getPositiveParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
      future.get(timeout, TimeUnit.MILLISECONDS);
    }
  } catch (TimeoutException e) {
    throw new RemotingException(this, "Failed to send message " + message + " to " + getRemoteAddress()
        + "in timeout(" + timeout + "ms) limit", e);
  } catch (Throwable e) {
    throw new RemotingException(this, "Failed to send message " + message + " to " + getRemoteAddress() + ", cause: " + e.getMessage(), e);
  }
}

代码示例来源:origin: apache/incubator-dubbo

@Override
@SuppressWarnings("rawtypes")
public void send(Object message, boolean sent) throws RemotingException {
  super.send(message, sent);
  int timeout = 0;
  try {
    GrizzlyFuture future = connection.write(message);
    if (sent) {
      timeout = getUrl().getPositiveParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
      future.get(timeout, TimeUnit.MILLISECONDS);
    }
  } catch (TimeoutException e) {
    throw new RemotingException(this, "Failed to send message " + message + " to " + getRemoteAddress()
        + "in timeout(" + timeout + "ms) limit", e);
  } catch (Throwable e) {
    throw new RemotingException(this, "Failed to send message " + message + " to " + getRemoteAddress() + ", cause: " + e.getMessage(), e);
  }
}

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

@SuppressWarnings({"unchecked"})
void execute(final HttpTransactionContext transactionCtx)
throws IOException {
  try {
    transactionCtx.getConnection().write(transactionCtx,
        createWriteCompletionHandler(transactionCtx.future));
  } catch (Exception e) {
    if (e instanceof RuntimeException) {
      throw (RuntimeException) e;
    } else if (e instanceof IOException) {
      throw (IOException) e;
    }
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn(e.toString(), e);
    }
  }
}

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

/**
   * Once SSL handshake will be completed - send greeting message
   */
  @Override
  public void completed(SSLEngine result) {
    // Here we send String directly
    connection.write(MESSAGE);
  }
});

代码示例来源:origin: org.glassfish.tyrus.tests/tyrus-test-tools

private void flushBufferedData() {
    if (buffer.size() == 0) {
      // buffer is empty
      return;
    }
    Buffer message = Buffers.wrap(grizzlyConnection.getMemoryManager(), buffer.toByteArray());
    grizzlyConnection.write(message);
    buffer.reset();
  }
}

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

@Override
protected GrizzlyFuture<Integer> flush0(Buffer buffer,
    final CompletionHandler<Integer> completionHandler)
    throws IOException {
  
  final FutureImpl<Integer> future = SafeFutureImpl.create();
  
  if (buffer == null) {
    buffer = Buffers.EMPTY_BUFFER;
  }
  connection.write(buffer,
      new CompletionHandlerAdapter(this, future, completionHandler));
  return future;
}

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

@Override
protected GrizzlyFuture<Integer> flush0(Buffer buffer,
    final CompletionHandler<Integer> completionHandler)
    throws IOException {
  
  final FutureImpl<Integer> future = SafeFutureImpl.create();
  
  if (buffer == null) {
    buffer = Buffers.EMPTY_BUFFER;
  }
  connection.write(buffer,
      new CompletionHandlerAdapter(this, future, completionHandler));
  return future;
}

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

@Override
protected GrizzlyFuture<Integer> flush0(Buffer buffer,
    final CompletionHandler<Integer> completionHandler)
    throws IOException {
  
  final FutureImpl<Integer> future = SafeFutureImpl.create();
  
  if (buffer == null) {
    buffer = Buffers.EMPTY_BUFFER;
  }
  connection.write(buffer,
      new CompletionHandlerAdapter(this, future, completionHandler));
  return future;
}

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

@Override
protected GrizzlyFuture<Integer> flush0(Buffer buffer,
    final CompletionHandler<Integer> completionHandler)
    throws IOException {
  
  final FutureImpl<Integer> future = SafeFutureImpl.create();
  
  if (buffer == null) {
    buffer = Buffers.EMPTY_BUFFER;
  }
  connection.write(buffer,
      new CompletionHandlerAdapter(this, future, completionHandler));
  return future;
}

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

@Override
protected GrizzlyFuture<Integer> flush0(Buffer buffer,
    final CompletionHandler<Integer> completionHandler)
    throws IOException {
  
  final FutureImpl<Integer> future = SafeFutureImpl.create();
  
  if (buffer == null) {
    buffer = Buffers.EMPTY_BUFFER;
  }
  connection.write(buffer,
      new CompletionHandlerAdapter(this, future, completionHandler));
  return future;
}

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

@Override
protected GrizzlyFuture<Integer> flush0(Buffer buffer,
    final CompletionHandler<Integer> completionHandler)
    throws IOException {
  
  final FutureImpl<Integer> future = SafeFutureImpl.create();
  
  if (buffer == null) {
    buffer = Buffers.EMPTY_BUFFER;
  }
  connection.write(buffer,
      new CompletionHandlerAdapter(this, future, completionHandler));
  return future;
}

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

protected void sendServerPreface() {
  final SettingsFrame settingsFrame = prepareSettings().build();
  NetLogger.log(NetLogger.Context.TX, this, settingsFrame);
  // server preface
  //noinspection unchecked
  connection.write(settingsFrame.toBuffer(getMemoryManager()), ((sslFilter != null) ? new EmptyCompletionHandler() {
    @Override
    public void completed(Object result) {
      sslFilter.setRenegotiationDisabled(true);
    }
  } : null));
}

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

@SuppressWarnings("unchecked")
protected void sendRaw(byte[] rawData) {
  final Connection connection = protocolHandler.getConnection();
  final MemoryManager mm = connection.getTransport().getMemoryManager();
  final Buffer buffer = Buffers.wrap(mm, rawData);
  buffer.allowBufferDispose(false);
  connection.write(buffer);
}

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

@SuppressWarnings("unchecked")
protected void sendRaw(byte[] rawData) {
  final Connection connection = protocolHandler.getConnection();
  final MemoryManager mm = connection.getTransport().getMemoryManager();
  final Buffer buffer = Buffers.wrap(mm, rawData);
  buffer.allowBufferDispose(false);
  connection.write(buffer);
}

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

protected void sendServerPreface() {
  final SettingsFrame settingsFrame = prepareSettings().build();
  NetLogger.log(NetLogger.Context.TX, this, settingsFrame);
  // server preface
  //noinspection unchecked
  connection.write(settingsFrame.toBuffer(getMemoryManager()), ((sslFilter != null) ? new EmptyCompletionHandler() {
    @Override
    public void completed(Object result) {
      sslFilter.setRenegotiationDisabled(true);
    }
  } : null));
}

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

protected void sendServerPreface() {
  final SettingsFrame settingsFrame = prepareSettings().build();
  NetLogger.log(NetLogger.Context.TX, this, settingsFrame);
  // server preface
  //noinspection unchecked
  connection.write(settingsFrame.toBuffer(getMemoryManager()), ((sslFilter != null) ? new EmptyCompletionHandler() {
    @Override
    public void completed(Object result) {
      sslFilter.setRenegotiationDisabled(true);
    }
  } : null));
}

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

protected void sendServerPreface() {
  final SettingsFrame settingsFrame = prepareSettings().build();
  NetLogger.log(NetLogger.Context.TX, this, settingsFrame);
  // server preface
  //noinspection unchecked
  connection.write(settingsFrame.toBuffer(getMemoryManager()), ((sslFilter != null) ? new EmptyCompletionHandler() {
    @Override
    public void completed(Object result) {
      sslFilter.setRenegotiationDisabled(true);
    }
  } : null));
}

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

protected void sendServerPreface() {
  final SettingsFrame settingsFrame = prepareSettings().build();
  NetLogger.log(NetLogger.Context.TX, this, settingsFrame);
  // server preface
  //noinspection unchecked
  connection.write(settingsFrame.toBuffer(getMemoryManager()), ((sslFilter != null) ? new EmptyCompletionHandler() {
    @Override
    public void completed(Object result) {
      sslFilter.setRenegotiationDisabled(true);
    }
  } : null));
}

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

@SuppressWarnings("unchecked")
protected void sendRaw(byte[] rawData) {
  final Connection connection = protocolHandler.getConnection();
  final MemoryManager mm = connection.getTransport().getMemoryManager();
  final Buffer buffer = Buffers.wrap(mm, rawData);
  buffer.allowBufferDispose(false);
  connection.write(buffer);
}

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

@SuppressWarnings("unchecked")
protected void sendRaw(byte[] rawData) {
  final Connection connection = protocolHandler.getConnection();
  final MemoryManager mm = connection.getTransport().getMemoryManager();
  final Buffer buffer = Buffers.wrap(mm, rawData);
  buffer.allowBufferDispose(false);
  connection.write(buffer);
}

相关文章