public void writeByte(final int v) throws IOException { delegate.writeByte(v); }
private void writeSuccessResponse(final int messageId, final int id, final Object result) throws IOException { try (MessageOutputStream mos = messageTracker.openMessageUninterruptibly()) { mos.writeByte(messageId); writeId(mos, version, id); mos.writeByte(Protocol.SUCCESS); if (result instanceof Context) { mos.writeByte(Protocol.P_CONTEXT); } else { mos.writeByte(Protocol.P_OBJECT); try (Marshaller marshaller = createMarshaller(mos, configuration)) { marshaller.writeObject(result); } } } }
private void writeExceptionResponse(final Exception e, final int messageId, final int id) throws IOException { try (MessageOutputStream mos = messageTracker.openMessageUninterruptibly()) { mos.writeByte(messageId); writeId(mos, version, id); mos.writeByte(Protocol.FAILURE); mos.writeByte(Protocol.P_EXCEPTION); try (Marshaller marshaller = createMarshaller(mos, configuration)) { marshaller.writeObject(e); } } }
void writeSimpleResponse(final int msgId, final int invId) { try (final MessageOutputStream outputStream = messageTracker.openMessageUninterruptibly()) { outputStream.writeShort(invId); outputStream.writeByte(msgId); } catch (IOException e) { log.outboundException(e); } }
public void clusterRemoval(final List<String> clusterNames) { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.CLUSTER_TOPOLOGY_REMOVAL); PackedInteger.writePackedInteger(os, clusterNames.size()); for (String clusterName : clusterNames) { os.writeUTF(clusterName); } } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB cluster message write failed", e); } }
void writeParamError(final int invId) { try (final MessageOutputStream outputStream = messageTracker.openMessageUninterruptibly()) { outputStream.writeShort(invId); outputStream.writeByte(M_RESP_PARAM_ERROR); } catch (IOException e) { log.outboundException(e); } } }
private void writeExceptionResponse(final int msgId, final int invId, final int exceptionKind, final Exception e) { try (final MessageOutputStream outputStream = messageTracker.openMessageUninterruptibly()) { outputStream.writeShort(invId); outputStream.writeByte(msgId); writeInt8(outputStream, exceptionKind); final RemoteExceptionCause remoteExceptionCause = RemoteExceptionCause.of(e); final ByteArrayOutputStream os = new ByteArrayOutputStream(); final DataOutputStream dos = new DataOutputStream(os); remoteExceptionCause.writeToStream(dos); dos.flush(); writePackedUnsignedInt31(outputStream, os.size()); os.writeTo(outputStream); } catch (IOException ioe) { log.outboundException(ioe); } }
@Override public void writeProceedAsync() { if(version >= 3) { //not used in newer protocols return; } try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.PROCEED_ASYNC_RESPONSE); os.writeShort(invId); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB async response write failed", e); } }
void writeSimpleResponse(final int msgId, final int invId, final int param1) { try (final MessageOutputStream outputStream = messageTracker.openMessageUninterruptibly()) { outputStream.writeShort(invId); outputStream.writeByte(msgId); writeParam(param1, outputStream); } catch (IOException e) { log.outboundException(e); } }
public void writeCancelResponse() { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.CANCEL_RESPONSE); os.writeShort(invId); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB response write failed", e); } finally { invocations.removeKey(invId); } }
private void writeTxnResponse(final int invId) { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.TXN_RESPONSE); os.writeShort(invId); os.writeBoolean(false); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB transaction response write failed", e); } }
void handleCapabilityMessage(final MessageInputStream message, final int invId) throws IOException { while (message.read() != -1) { // ignore parameters readIntParam(message, StreamUtils.readPackedUnsignedInt32(message)); } // acknowledge no capabilities try (final MessageOutputStream outputStream = messageTracker.openMessageUninterruptibly()) { outputStream.writeShort(invId); outputStream.writeByte(M_RESP_CAPABILITY); } return; }
private void writeTxnResponse(final int invId, final int flag) { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.TXN_RESPONSE); os.writeShort(invId); os.writeBoolean(true); PackedInteger.writePackedInteger(os, flag); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB transaction response write failed", e); } }
public void writeNoSuchMethod() { final String message = Logs.REMOTING.remoteMessageNoSuchMethod(methodLocator, identifier); try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.NO_SUCH_METHOD); os.writeShort(invId); os.writeUTF(message); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB response write failed", e); } finally { invocations.removeKey(invId); } }
public void writeSessionNotActive() { final String message = Logs.REMOTING.remoteMessageSessionNotActive(methodLocator, identifier); try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.NO_SUCH_METHOD); os.writeShort(invId); os.writeUTF(message); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB response write failed", e); } finally { invocations.removeKey(invId); } }
void writeCancellation() { if (version >= 3) try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.CANCEL_RESPONSE); os.writeShort(invId); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB response write failed", e); } finally { invocations.removeKey(invId); } else { writeFailure(Logs.REMOTING.requestCancelled()); } } }
public void writeNoSuchEJB() { final String message = Logs.REMOTING.remoteMessageNoSuchEJB(getEJBIdentifier()); try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.NO_SUCH_EJB); os.writeShort(invId); os.writeUTF(message); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB response write failed", e); } finally { invocations.removeKey(invId); } }
public void writeNotStateful() { final String message = Logs.REMOTING.remoteMessageEJBNotStateful(getEJBIdentifier()); try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.EJB_NOT_STATEFUL); os.writeShort(invId); os.writeUTF(message); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB response write failed", e); } finally { invocations.removeKey(invId); } }
private void writeFailedResponse(final int invId, final Throwable e) { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.APPLICATION_EXCEPTION); os.writeShort(invId); final Marshaller marshaller = marshallerFactory.createMarshaller(configuration); marshaller.start(new NoFlushByteOutput(Marshalling.createByteOutput(os))); marshaller.writeObject(new RequestSendFailedException(e.getMessage() + "@" + channel.getConnection().getPeerURI(), e)); marshaller.writeByte(0); marshaller.finish(); } catch (IOException e2) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB response write failed", e2); } }