本文整理了Java中org.glassfish.grizzly.Connection.notifyCanWrite()
方法的一些代码示例,展示了Connection.notifyCanWrite()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.notifyCanWrite()
方法的具体详情如下:
包路径:org.glassfish.grizzly.Connection
类名称:Connection
方法名:notifyCanWrite
暂无
代码示例来源: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: com.ning/async-http-client
@Override
public synchronized void flush() throws IOException {
final Connection c = feedableBodyGenerator.context.getConnection();
if (isReady()) {
boolean notReady = writeUntilFullOrDone(c);
if (!isDone()) {
if (notReady) {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
} else {
// write queue is full, leverage WriteListener to let us know
// when it is safe to write again.
c.notifyCanWrite(new WriteHandlerImpl());
}
}
} else {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http2
@Override
public void notifyWritePossible(WriteHandler writeHandler) {
connection.getConnection().notifyCanWrite(writeHandler);
}
代码示例来源:origin: javaee/grizzly
@Override
public void notifyWritePossible(WriteHandler writeHandler) {
connection.getConnection().notifyCanWrite(writeHandler);
}
代码示例来源:origin: javaee/grizzly
@Override
public void notifyWritePossible(WriteHandler writeHandler) {
connection.getConnection().notifyCanWrite(writeHandler);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
@Override
public void notifyWritePossible(WriteHandler writeHandler) {
connection.getConnection().notifyCanWrite(writeHandler);
}
代码示例来源:origin: javaee/grizzly
@Override
public void notifyWritePossible(WriteHandler writeHandler) {
connection.getConnection().notifyCanWrite(writeHandler);
}
代码示例来源:origin: javaee/grizzly
@Override
public void notifyWritePossible(WriteHandler writeHandler) {
connection.getConnection().notifyCanWrite(writeHandler);
}
代码示例来源:origin: javaee/grizzly
@Override
public void notifyWritePossible(WriteHandler writeHandler) {
connection.getConnection().notifyCanWrite(writeHandler);
}
代码示例来源:origin: javaee/grizzly
@Override
public void notifyWritePossible(WriteHandler writeHandler) {
connection.getConnection().notifyCanWrite(writeHandler);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
@Override
public void notifyWritePossible(WriteHandler writeHandler) {
connection.getConnection().notifyCanWrite(writeHandler);
}
代码示例来源:origin: eclipse-ee4j/tyrus
@Override
public boolean isValid() {
if (!connection.canWrite() && writeHandlerRegistered.compareAndSet(false, true)) {
connection.notifyCanWrite(new WriteHandler() {
@Override
public void onWritePossible() throws Exception {
writeHandlerRegistered.set(false);
taskProcessor.processTask();
}
@Override
public void onError(Throwable t) {
writeHandlerRegistered.set(false);
Logger.getLogger(GrizzlyWriter.class.getName()).log(Level.WARNING, t.getMessage(), t);
// TODO: do what?
}
});
return false;
}
return true;
}
}
代码示例来源:origin: org.glassfish.tyrus/tyrus-container-grizzly-client
@Override
public boolean isValid() {
if (!connection.canWrite() && writeHandlerRegistered.compareAndSet(false, true)) {
connection.notifyCanWrite(new WriteHandler() {
@Override
public void onWritePossible() throws Exception {
writeHandlerRegistered.set(false);
taskProcessor.processTask();
}
@Override
public void onError(Throwable t) {
writeHandlerRegistered.set(false);
Logger.getLogger(GrizzlyWriter.class.getName()).log(Level.WARNING, t.getMessage(), t);
// TODO: do what?
}
});
return false;
}
return true;
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-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: org.apache.apex/apex-shaded-ning19
/**
* 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: io.gatling/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: org.apache.apex/apex-shaded-ning19
@Override
public synchronized void flush() throws IOException {
final Connection c = feedableBodyGenerator.context.getConnection();
if (isReady()) {
boolean notReady = writeUntilFullOrDone(c);
if (!isDone()) {
if (notReady) {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
} else {
// write queue is full, leverage WriteListener to let us know
// when it is safe to write again.
c.notifyCanWrite(new WriteHandlerImpl());
}
}
} else {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
}
}
代码示例来源:origin: io.gatling/async-http-client
@Override
public synchronized void flush() throws IOException {
final Connection c = feedableBodyGenerator.context.getConnection();
if (isReady()) {
boolean notReady = writeUntilFullOrDone(c);
if (!isDone()) {
if (notReady) {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
} else {
// write queue is full, leverage WriteListener to let us know
// when it is safe to write again.
c.notifyCanWrite(new WriteHandlerImpl());
}
}
} else {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
}
}
代码示例来源:origin: javaee/grizzly-ahc
@Override
public synchronized void flush() throws IOException {
final Connection c = feedableBodyGenerator.context.getConnection();
if (isReady()) {
boolean notReady = writeUntilFullOrDone(c);
if (!isDone()) {
if (notReady) {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
} else {
// write queue is full, leverage WriteListener to let us know
// when it is safe to write again.
c.notifyCanWrite(new WriteHandlerImpl());
}
}
} else {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-client
@Override
public synchronized void flush() throws IOException {
final Connection c = feedableBodyGenerator.context.getConnection();
if (isReady()) {
boolean notReady = writeUntilFullOrDone(c);
if (!isDone()) {
if (notReady) {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
} else {
// write queue is full, leverage WriteListener to let us know
// when it is safe to write again.
c.notifyCanWrite(new WriteHandlerImpl());
}
}
} else {
notifyReadyToFeed(new ReadyToFeedListenerImpl());
}
}
内容来源于网络,如有侵权,请联系作者删除!