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); }
public RemotingTransactionServer getServerForConnection(Connection connection) { if (connection.getEndpoint() != endpoint) { throw Log.log.invalidConnectionEndpoint(); } final Attachments attachments = connection.getAttachments(); RemotingTransactionServer server = attachments.getAttachment(KEY); if (server == null) { server = new RemotingTransactionServer(this, connection); RemotingTransactionServer appearing = attachments.attachIfAbsent(KEY, server); if (appearing != null) { server = appearing; } } return server; }
public TransactionalProtocolClientImpl(final ManagementChannelAssociation channelAssociation) { assert channelAssociation != null; this.channelAssociation = channelAssociation; final File temp = channelAssociation.getAttachments().getAttachment(ManagementChannelHandler.TEMP_DIR); if (temp != null && temp.isDirectory()) { tempDir = temp; } else { tempDir = javaTempDir; } }
protected Future<Connection> reconnect() { channelHandler.getAttachments().removeAttachment(TransactionalProtocolClient.SEND_IDENTITY); return executorService.submit(new Callable<Connection>() { @Override
public TransactionalProtocolClientImpl(final ManagementChannelAssociation channelAssociation) { assert channelAssociation != null; this.channelAssociation = channelAssociation; final File temp = channelAssociation.getAttachments().getAttachment(ManagementChannelHandler.TEMP_DIR); if (temp != null && temp.isDirectory()) { tempDir = temp; } else { tempDir = javaTempDir; } }
protected Future<Connection> reconnect() { channelHandler.getAttachments().removeAttachment(TransactionalProtocolClient.SEND_IDENTITY); return executorService.submit(new Callable<Connection>() { @Override
static void attachSlaveInfo(Channel channel, String hostName, Transformers transformers) { channel.getAttachments().attach(HOST_CHANNEL_INFO, new HostChannelInfo(hostName, transformers)); }
@NotNull RemotingOperations getOperations(Connection connection) throws IOException { final Attachments attachments = connection.getAttachments(); RemotingOperations operations = attachments.getAttachment(key); if (operations != null) { return operations; final RemotingOperations appearing = attachments.attachIfAbsent(key, operations); if (appearing != null) { return appearing; throw e; final RemotingOperations appearing = attachments.attachIfAbsent(key, operations); if (appearing != null) { return appearing;
static String getHostName(Channel channel) { return channel.getAttachments().getAttachment(HOST_CHANNEL_INFO).hostName; }
static void attachSlaveInfo(Channel channel, String hostName, Transformers transformers) { channel.getAttachments().attach(HOST_CHANNEL_INFO, new HostChannelInfo(hostName, transformers)); }
IoFuture<T> existing = attachments.getAttachment(key); if (existing != null) { return existing; existing = attachments.attachIfAbsent(key, future); if (existing != null) { return existing;
static Transformers getTransformers(Channel channel) { return channel.getAttachments().getAttachment(HOST_CHANNEL_INFO).transformers; }
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); }
public RemotingTransactionServer getServerForConnection(Connection connection) { if (connection.getEndpoint() != endpoint) { throw Log.log.invalidConnectionEndpoint(); } final Attachments attachments = connection.getAttachments(); RemotingTransactionServer server = attachments.getAttachment(KEY); if (server == null) { server = new RemotingTransactionServer(this, connection); RemotingTransactionServer appearing = attachments.attachIfAbsent(KEY, server); if (appearing != null) { server = appearing; } } return server; }
static String getHostName(Channel channel) { return channel.getAttachments().getAttachment(HOST_CHANNEL_INFO).hostName; }
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); }
public RemotingTransactionServer getServerForConnection(Connection connection) { if (connection.getEndpoint() != endpoint) { throw Log.log.invalidConnectionEndpoint(); } final Attachments attachments = connection.getAttachments(); RemotingTransactionServer server = attachments.getAttachment(KEY); if (server == null) { server = new RemotingTransactionServer(this, connection); RemotingTransactionServer appearing = attachments.attachIfAbsent(KEY, server); if (appearing != null) { server = appearing; } } return server; }
static Transformers getTransformers(Channel channel) { return channel.getAttachments().getAttachment(HOST_CHANNEL_INFO).transformers; }
synchronized TransactionalProtocolClient channelRegistered(final ManagementChannelHandler channelAssociation) { final InternalState current = this.internalState; // Create the remote controller client channelAssociation.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelAssociation.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); final TransactionalProtocolClient remoteClient = TransactionalProtocolHandlers.createClient(channelAssociation); if (current == InternalState.RELOADING) { internalSetState(new TransitionTask() { @Override public boolean execute(ManagedServer server) throws Exception { // Update the current remote connection protocolClient.connected(remoteClient); // clear reload required state requiresReload = false; return true; } }, InternalState.RELOADING, InternalState.SERVER_STARTING); } else { internalSetState(new TransitionTask() { @Override public boolean execute(final ManagedServer server) throws Exception { // Update the current remote connection protocolClient.connected(remoteClient); return true; } // TODO we just check that we are in the correct state, perhaps introduce a new state }, InternalState.SEND_STDIN, InternalState.SERVER_STARTING); } return remoteClient; }
@NotNull RemotingOperations getOperations(Connection connection) throws IOException { final Attachments attachments = connection.getAttachments(); RemotingOperations operations = attachments.getAttachment(key); if (operations != null) { return operations; final RemotingOperations appearing = attachments.attachIfAbsent(key, operations); if (appearing != null) { return appearing; throw e; final RemotingOperations appearing = attachments.attachIfAbsent(key, operations); if (appearing != null) { return appearing;