public Connection getConnection() { return channel.getConnection(); }
public Connection getConnection() { return channel.getConnection(); }
Connection getConnection() { return channel.getConnection(); }
public Connection getConnection() { return channel.getConnection(); }
public Connection getConnection() { return channel.getConnection(); }
public <C> C getProviderInterface(Class<C> providerInterfaceType) { final Connection connection = channel.getConnection(); return providerInterfaceType.isInstance(connection) ? providerInterfaceType.cast(connection) : null; }
public SocketAddress getLocalAddress() { return channel.getConnection().getLocalAddress(); }
public String getProtocol() { return channel.getConnection().getProtocol(); }
public SocketAddress getPeerAddress() { return channel.getConnection().getPeerAddress(); }
void addAddress(EJBClientChannel clientChannel) { synchronized (this) { addressesByConnection.put(clientChannel, (InetSocketAddress) clientChannel.getChannel().getConnection().getPeerAddress()); serviceURLCache = null; } }
public void channelOpened(final Channel channel) { getServerForConnection(channel.getConnection()).openChannel(channel); }
public Executor getRequestExecutor() { return channel.getConnection().getEndpoint().getXnioWorker(); }
TransactionServerChannel(final RemotingTransactionServer server, final Channel channel, final LocalTransactionContext localTransactionContext) { this.server = server; this.channel = channel; this.localTransactionContext = localTransactionContext; messageTracker = new MessageTracker(channel, channel.getOption(RemotingOptions.MAX_OUTBOUND_MESSAGES).intValue()); channel.getConnection().getAttachments().attach(KEY, this); }
private SecurityIdentity getSecurityIdentity(int msgId, int invId, int secContext, boolean hasSecContext) { SecurityIdentity securityIdentity; if (hasSecContext) { securityIdentity = channel.getConnection().getLocalIdentity(secContext); } else { securityIdentity = channel.getConnection().getLocalIdentity(); } if(!securityIdentity.implies(RemoteTransactionPermission.getInstance())) { writeExceptionResponse(msgId, invId, P_SEC_EXC, log.noPermission(securityIdentity.getPrincipal().getName(), RemoteTransactionPermission.getInstance())); return null; } return securityIdentity; }
EJBSimpleTransactionControl(final EJBClientChannel channel) { this.channel = channel; final UserTransactionID transactionID = channel.allocateUserTransactionID(); this.transactionID = transactionID; simpleIdResolver = connection -> { if (channel.getChannel().getConnection() != connection) { throw Log.log.invalidTransactionConnection(); } return transactionID.getId(); }; }
private Executor getRetryExecutor() { return retryExecutorWrapper.getExecutor(getChannel().getConnection().getEndpoint().getXnioWorker()); }
private TransactionID calculateTransactionId(final Transaction transaction) throws RollbackException, SystemException, InvalidTransactionException { final URI location = channel.getConnection().getPeerURI(); Assert.assertNotNull(transaction); if (transaction instanceof RemoteTransaction) { final RemoteTransaction remoteTransaction = (RemoteTransaction) transaction; remoteTransaction.setLocation(location); final SimpleIdResolver ir = remoteTransaction.getProviderInterface(SimpleIdResolver.class); if (ir == null) throw Logs.TXN.cannotEnlistTx(); return new UserTransactionID(channel.getConnection().getRemoteEndpointName(), ir.getTransactionId(channel.getConnection())); } else if (transaction instanceof LocalTransaction) { final LocalTransaction localTransaction = (LocalTransaction) transaction; final XAOutflowHandle outflowHandle = transactionContext.outflowTransaction(location, localTransaction); // always verify V1/2 outflows outflowHandle.verifyEnlistment(); return new XidTransactionID(outflowHandle.getXid()); } else { throw Logs.TXN.cannotEnlistTx(); } }
EJBServerChannel(final RemotingTransactionServer transactionServer, final Channel channel, final int version, final MessageTracker messageTracker) { this.transactionServer = transactionServer; this.channel = channel; this.version = version; this.messageTracker = messageTracker; final MarshallingConfiguration configuration = new MarshallingConfiguration(); if (version < 3) { configuration.setClassTable(ProtocolV1ClassTable.INSTANCE); configuration.setObjectTable(ProtocolV1ObjectTable.INSTANCE); configuration.setObjectResolver(new ProtocolV1ObjectResolver(channel.getConnection(), true)); configuration.setVersion(2); } else { configuration.setObjectTable(ProtocolV3ObjectTable.INSTANCE); configuration.setObjectResolver(new ProtocolV3ObjectResolver(channel.getConnection(), true)); configuration.setVersion(4); } marshallerFactory = new RiverMarshallerFactory(); this.configuration = configuration; }
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); } }
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))); }