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); } }
@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); } }
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); } }
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, 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 clusterNodesRemoved(final List<ClusterRemovalInfo> clusterRemovalInfoList) { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.CLUSTER_TOPOLOGY_NODE_REMOVAL); PackedInteger.writePackedInteger(os, clusterRemovalInfoList.size()); for (ClusterRemovalInfo removalInfo : clusterRemovalInfoList) { os.writeUTF(removalInfo.getClusterName()); final List<String> nodeNamesList = removalInfo.getNodeNames(); PackedInteger.writePackedInteger(os, nodeNamesList.size()); for (String name : nodeNamesList) { os.writeUTF(name); } } } 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); } } }
abstractBuilder.setUri(new URI("node", nodeName, null)); } catch (URISyntaxException e) { Logs.REMOTING.trace("Ignoring cluster node " + nodeName + " because the URI failed to be built", e); continue;
private Application updateOrFollowApplication(AbstractInvocationContext context, ConcurrentMap<Application, URI> applications, boolean register) { URI destination = context.getDestination(); if (destination != null) { EJBIdentifier identifier = context.getLocator().getIdentifier(); Application application = toApplication(identifier); URI existing = applications.putIfAbsent(application, destination); if (existing != null) { // Someone else set a mapping, use it instead context.setDestination(existing); } else { if (register) { context.putAttachment(APPLICATION, application); } return application; } } else { Logs.TXN.trace("Failed assertion: a destination was supposed ot be present but wasn't"); } return null; }
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 doWrite(final boolean available, final List<EJBModuleIdentifier> modules) { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(available ? Protocol.MODULE_AVAILABLE : Protocol.MODULE_UNAVAILABLE); PackedInteger.writePackedInteger(os, modules.size()); for (EJBModuleIdentifier module : modules) { final String appName = module.getAppName(); os.writeUTF(appName == null ? "" : appName); final String moduleName = module.getModuleName(); os.writeUTF(moduleName == null ? "" : moduleName); final String distinctName = module.getDistinctName(); os.writeUTF(distinctName == null ? "" : distinctName); } } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB availability message write failed", e); } } }
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); } }
public void clusterTopology(final List<ClusterInfo> clusterInfoList) { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.CLUSTER_TOPOLOGY_COMPLETE); PackedInteger.writePackedInteger(os, clusterInfoList.size()); for (ClusterInfo clusterInfo : clusterInfoList) { os.writeUTF(clusterInfo.getClusterName()); final List<NodeInfo> nodeInfoList = clusterInfo.getNodeInfoList(); PackedInteger.writePackedInteger(os, nodeInfoList.size()); for (NodeInfo nodeInfo : nodeInfoList) { os.writeUTF(nodeInfo.getNodeName()); final List<MappingInfo> mappingInfoList = nodeInfo.getMappingInfoList(); PackedInteger.writePackedInteger(os, mappingInfoList.size()); for (MappingInfo mappingInfo : mappingInfoList) { boolean is6 = mappingInfo.getSourceAddress() instanceof Inet6Address; if (is6) { PackedInteger.writePackedInteger(os, mappingInfo.getNetmaskBits() << 1); } else { PackedInteger.writePackedInteger(os, mappingInfo.getNetmaskBits() << 1 | 1); } os.write(mappingInfo.getSourceAddress().getAddress()); os.writeUTF(mappingInfo.getDestinationAddress()); os.writeShort(mappingInfo.getDestinationPort()); } } } } 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); } }
public void clusterNewNodesAdded(final ClusterInfo clusterInfo) { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.CLUSTER_TOPOLOGY_ADDITION); PackedInteger.writePackedInteger(os, 1); os.writeUTF(clusterInfo.getClusterName()); final List<NodeInfo> nodeInfoList = clusterInfo.getNodeInfoList(); PackedInteger.writePackedInteger(os, nodeInfoList.size()); for (NodeInfo nodeInfo : nodeInfoList) { os.writeUTF(nodeInfo.getNodeName()); final List<MappingInfo> mappingInfoList = nodeInfo.getMappingInfoList(); PackedInteger.writePackedInteger(os, mappingInfoList.size()); for (MappingInfo mappingInfo : mappingInfoList) { boolean is6 = mappingInfo.getSourceAddress() instanceof Inet6Address; if (is6) { PackedInteger.writePackedInteger(os, mappingInfo.getNetmaskBits() << 1); } else { PackedInteger.writePackedInteger(os, mappingInfo.getNetmaskBits() << 1 | 1); } os.write(mappingInfo.getSourceAddress().getAddress()); os.writeUTF(mappingInfo.getDestinationAddress()); os.writeShort(mappingInfo.getDestinationPort()); } } } 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); } }
protected void writeFailure(Exception reason) { try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.APPLICATION_EXCEPTION); os.writeShort(invId); if (version >= 3) os.writeByte(getEnlistmentStatus()); final Marshaller marshaller = marshallerFactory.createMarshaller(configuration); marshaller.start(new NoFlushByteOutput(Marshalling.createByteOutput(os))); marshaller.writeObject(reason); marshaller.writeByte(0); marshaller.finish(); } 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 writeWrongViewType() { final String message = Logs.REMOTING.remoteMessageBadViewType(getEJBIdentifier()); try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { if (version >= 3) { os.writeByte(Protocol.BAD_VIEW_TYPE); os.writeShort(invId); os.writeUTF(message); } else { os.writeByte(Protocol.APPLICATION_EXCEPTION); os.writeShort(invId); final Marshaller marshaller = marshallerFactory.createMarshaller(configuration); marshaller.start(new NoFlushByteOutput(Marshalling.createByteOutput(os))); marshaller.writeObject(Logs.REMOTING.invalidViewTypeForInvocation(message)); marshaller.writeByte(0); marshaller.finish(); } } 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 handleTxnRecoverRequest(final int invId, final MessageInputStream message) throws IOException { final String parentName = message.readUTF(); final int flags = message.readInt(); final Xid[] xids; try { xids = transactionServer.getTransactionService().getTransactionContext().getRecoveryInterface().recover(flags, parentName); } catch (XAException e) { writeFailedResponse(invId, e); return; } try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.TXN_RECOVERY_RESPONSE); os.writeShort(invId); PackedInteger.writePackedInteger(os, xids.length); final Marshaller marshaller = marshallerFactory.createMarshaller(configuration); marshaller.start(new NoFlushByteOutput(Marshalling.createByteOutput(os))); for (Xid xid : xids) { marshaller.writeObject(new XidTransactionID(xid)); } marshaller.finish(); } 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); } }