@Override public void send(final String data, final Charset charset, final IoCallback callback) { if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return;
@Override public void transferFrom(FileChannel source, IoCallback callback) { if (callback == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("callback"); } if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return; } if(exchange.isResponseComplete()) { invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); } if (this.fileChannel != null || this.buffer != null) { throw UndertowMessages.MESSAGES.dataAlreadyQueued(); } this.callback = callback; this.fileChannel = source; if (inCallback) { return; } if(transferTask == null) { transferTask = new TransferTask(); } if (exchange.isInIoThread()) { exchange.dispatch(transferTask); return; } transferTask.run(); }
throw UndertowMessages.MESSAGES.argumentCannotBeNull("callback"); if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return;
if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return;
private void closeAndFlushResponse() { if(!connection.isOpen()) {
@Override public void send(final String data, final Charset charset, final IoCallback callback) { if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return;
public void sendQuietly(HttpServerExchange exchange, ErrorDescription error, String messageId, String topicName) { try { if (exchange.getConnection().isOpen()) { if (!exchange.isResponseStarted()) { send(exchange, error, messageId); } else { logger.warn("Not sending error message to a client as response has already been started. " + "Error message: {} Topic: {} MessageId: {} Host: {}", error.getMessage(), topicName, messageId, readHostAndPort(exchange)); } } else { logger.warn("Connection to a client closed. Can't send error response. " + "Error message: {} Topic: {} MessageId: {} Host: {}", error.getMessage(), topicName, messageId, readHostAndPort(exchange)); exchange.endExchange(); } } catch (Exception e) { logger.warn("Exception in sending error response to a client. {} Topic: {} MessageId: {} Host: {}", error.getMessage(), topicName, messageId, readHostAndPort(exchange), e); } }
@Override public void send(final String data, final Charset charset, final IoCallback callback) { if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return;
@Override public void transferFrom(FileChannel source, IoCallback callback) { if (callback == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("callback"); } if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return; } if(exchange.isResponseComplete()) { invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); } if (this.fileChannel != null || this.buffer != null) { throw UndertowMessages.MESSAGES.dataAlreadyQueued(); } this.callback = callback; this.fileChannel = source; if (inCallback) { return; } if(transferTask == null) { transferTask = new TransferTask(); } if (exchange.isInIoThread()) { exchange.dispatch(transferTask); return; } transferTask.run(); }
@Override public void transferFrom(FileChannel source, IoCallback callback) { if (callback == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("callback"); } if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return; } if(exchange.isResponseComplete()) { invokeOnException(callback, new IOException(UndertowMessages.MESSAGES.responseComplete())); } if (this.fileChannel != null || this.buffer != null) { throw UndertowMessages.MESSAGES.dataAlreadyQueued(); } this.callback = callback; this.fileChannel = source; if (inCallback) { return; } if(transferTask == null) { transferTask = new TransferTask(); } if (exchange.isInIoThread()) { exchange.dispatch(transferTask); return; } transferTask.run(); }
throw UndertowMessages.MESSAGES.argumentCannotBeNull("callback"); if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return;
throw UndertowMessages.MESSAGES.argumentCannotBeNull("callback"); if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return;
if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return;
if(!exchange.getConnection().isOpen()) { invokeOnException(callback, new ClosedChannelException()); return;
private void closeAndFlushResponse() { if(!connection.isOpen()) {
private void closeAndFlushResponse() { if(!connection.isOpen()) {