public int read(final byte[] b, final int off, final int len) throws IOException { return delegate.read(b, off, len); }
/** * Close this response; closes the message stream (if any). * * @throws IOException if closing the message stream failed for some reason */ public void close() throws IOException { final MessageInputStream inputStream = this.inputStream; if (inputStream != null) inputStream.close(); } }
void handleSessionOpenRequest(final int invId, final MessageInputStream inputStream) throws IOException { final String appName = inputStream.readUTF(); final String moduleName = inputStream.readUTF(); final String distName = inputStream.readUTF(); final String beanName = inputStream.readUTF(); final int securityContext; final ExceptionSupplier<ImportResult<?>, SystemException> transactionSupplier; if (version >= 3) { securityContext = inputStream.readInt(); transactionSupplier = readTransaction(inputStream); } else { securityContext = 0; transactionSupplier = null; } final Connection connection = channel.getConnection(); final EJBIdentifier identifier = new EJBIdentifier(appName, moduleName, beanName, distName); association.receiveSessionOpenRequest(new RemotingSessionOpenRequest( invId, identifier, transactionSupplier, connection.getLocalIdentity(securityContext))); }
public static int readId(final MessageInputStream stream, final int version) throws IOException { return version == 1 ? stream.readInt() : stream.readUnsignedShort(); }
public void handleMessage(final Channel channel, final MessageInputStream message) { try { final int code = message.readUnsignedByte(); switch (code) { case Protocol.COMPRESSED_INVOCATION_MESSAGE: final int invId = message.readUnsignedShort(); try { handleSessionOpenRequest(invId, message); final int invId = message.readUnsignedShort(); try { handleCancelRequest(invId, message); case Protocol.TXN_FORGET_REQUEST: case Protocol.TXN_BEFORE_COMPLETION_REQUEST: { final int invId = message.readUnsignedShort(); try { handleTxnRequest(code, invId, message); final int invId = message.readUnsignedShort(); try { handleTxnRecoverRequest(invId, message);
if (is.readUnsignedByte() != Protocol.M_RESP_XA_BEFORE) { throw Log.log.unknownResponseXa(XAException.XAER_RMERR); int id = is.read(); if (id == Protocol.P_XA_ERROR) { int len = StreamUtils.readPackedSignedInt32(is); int error = is.readInt(); final XAException xa = Log.log.peerXaException(error); xa.initCause(RemoteExceptionCause.readFromStream(is)); if ((id = is.read()) != -1) { XAException ex = Log.log.unrecognizedParameter(XAException.XAER_RMFAIL, id); ex.addSuppressed(xa); final SecurityException sx = Log.log.peerSecurityException(); sx.initCause(RemoteExceptionCause.readFromStream(is)); if ((id = is.read()) != -1) { XAException ex = Log.log.unrecognizedParameter(XAException.XAER_RMFAIL, id); ex.addSuppressed(sx);
try (MessageInputStream is = response.getInputStream()) { if (version == 1) { if (is.readUnsignedByte() != Protocol.P_LIST) { throw Messages.log.invalidResponse(); final int listSize = is.readInt(); final List<NameClassPair> results = new ArrayList<>(listSize); try (Unmarshaller unmarshaller = createUnmarshaller(is, configuration)) { final int listSize = is.readInt(); final List<NameClassPair> results = new ArrayList<>(listSize); for (int i = 0; i < listSize; i ++) { String itemName = is.readUTF(); String itemClass = is.readUTF(); final NameClassPair nameClassPair = new NameClassPair(itemName, itemClass, true); final CompositeName inNamespace = (CompositeName) compositeName.clone();
public void handleMessage(Channel channel, MessageInputStream message) { try (MessageInputStream mis = message) { byte[] namingHeader = new byte[6]; mis.read(namingHeader); if (! Arrays.equals(namingHeader, ProtocolUtils.NAMING_BYTES)) { throw Messages.log.invalidHeader(); int version = mis.readUnsignedByte(); boolean versionSupported = false; for (int supportedProtocolVersion : SUPPORTED_PROTOCOL_VERSIONS) {
if (version == 1 && is.readUnsignedByte() != Protocol.P_LIST) { throw Messages.log.invalidResponse(); final int listSize = is.readInt(); final List<Binding> results = new ArrayList<>(listSize); try (Unmarshaller unmarshaller = createUnmarshaller(is, configuration)) {
public int readUnsignedShort() throws IOException { return delegate.readUnsignedShort(); }
private void handleTxnRequest(final int code, final int invId, final MessageInputStream message) throws IOException { final byte[] bytes = new byte[PackedInteger.readPackedInteger(message)]; message.readFully(bytes); final TransactionID transactionID = TransactionID.createTransactionID(bytes); if (transactionID instanceof XidTransactionID) try { switch (code) { case Protocol.TXN_COMMIT_REQUEST: { boolean opc = message.readBoolean(); control.commit(opc); writeTxnResponse(invId); case Protocol.TXN_COMMIT_REQUEST: { message.readBoolean(); if (localTransaction != null) localTransaction.commit(); writeTxnResponse(invId);
public boolean readBoolean() throws IOException { return delegate.readBoolean(); }
public int readUnsignedByte() throws IOException { return delegate.readUnsignedByte(); }
public byte readByte() throws IOException { return delegate.readByte(); }
public void readFully(final byte[] b) throws IOException { delegate.readFully(b); }
public long skip(final long n) throws IOException { return delegate.skip(n); }
public String readUTF() throws IOException { return delegate.readUTF(); }
if (is.readUnsignedByte() != Protocol.M_RESP_XA_FORGET) { throw Log.log.unknownResponseXa(XAException.XAER_RMERR); int id = is.read(); if (id == Protocol.P_XA_ERROR) { int len = StreamUtils.readPackedSignedInt32(is); int error = is.readInt(); final XAException xa = Log.log.peerXaException(error); xa.initCause(RemoteExceptionCause.readFromStream(is)); if ((id = is.read()) != -1) { XAException ex = Log.log.unrecognizedParameter(XAException.XAER_RMFAIL, id); ex.addSuppressed(xa); final SecurityException sx = Log.log.peerSecurityException(); sx.initCause(RemoteExceptionCause.readFromStream(is)); if ((id = is.read()) != -1) { XAException ex = Log.log.unrecognizedParameter(XAException.XAER_RMFAIL, id); ex.addSuppressed(sx);