public IoFuture<Channel> openChannel(final String serviceType, final OptionMap optionMap) { return delegate.openChannel(serviceType, optionMap); }
final IoFuture<Channel> futureChannel = connection.openChannel(serviceName, OptionMap.EMPTY); IoFuture.Status result = futureChannel.await(getTimeoutValue(Timeout.CHANNEL, combinedEnvironment), TimeUnit.SECONDS); if (result == IoFuture.Status.DONE) {
final IoFuture<Channel> futureChannel = connection.openChannel(serviceName, optionMap); futureChannel.addNotifier(new IoFuture.HandlingNotifier<Channel, FutureResult<T>>() { public void handleCancelled(final FutureResult<T> futureResult) {
public IoFuture<Channel> openChannel(final String serviceType, final OptionMap optionMap) { return delegate.openChannel(serviceType, optionMap); }
/** * Open a channel. * * @param connection the connection * @param serviceType the service type * @param options the channel options * @return the opened channel * @throws IOException */ protected Channel openChannel(final Connection connection, final String serviceType, final OptionMap options) throws IOException { final IoFuture<Channel> futureChannel = connection.openChannel(serviceType, options); return futureChannel.get(); }
Channel openChannel(final Connection connection) throws IOException { final IoFuture<Channel> future = connection.openChannel(DEFAULT_CHANNEL_SERVICE_TYPE, OptionMap.EMPTY); final Channel channel = future.get(); channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(final Channel old, final IOException e) { synchronized (ChannelStrategy.this) { if(ChannelStrategy.this.channel == old) { ChannelStrategy.this.channel = null; } } handler.handleChannelClosed(old, e); } }); return channel; }
private RemoteNamingStore getOrCreateNamingStore(final Hashtable<String, Object> env, final Properties clientProperties, final OptionMap channelCreationOptions, final long channelCreationTimeoutInMillis, final List<RemoteContext.CloseTask> closeTasks, final EJBClientHandler ejbClientHandler) throws IOException, NamingException, URISyntaxException { final Channel channel; if (env.containsKey(CONNECTION)) { final Connection connection = (Connection) env.get(CONNECTION); // open a channel final IoFuture<Channel> futureChannel = connection.openChannel("naming", channelCreationOptions); channel = IoFutureHelper.get(futureChannel, channelCreationTimeoutInMillis, TimeUnit.MILLISECONDS); return RemoteContextFactory.createVersionedStore(channel, ejbClientHandler); } else { final Endpoint endpoint = getOrCreateEndpoint(env, clientProperties, closeTasks); return getOrCreateCachedNamingStore(endpoint, clientProperties, closeTasks, channelCreationOptions, channelCreationTimeoutInMillis, env, ejbClientHandler); } }
final IoFuture<Channel> futureChannel = connection.openChannel(serviceName, OptionMap.EMPTY); IoFuture.Status result = futureChannel.await(getTimeoutValue(Timeout.CHANNEL, combinedEnvironment), TimeUnit.SECONDS); if (result == IoFuture.Status.DONE) {
final IoFuture<Channel> futureChannel = connection.openChannel(serviceName, OptionMap.EMPTY); IoFuture.Status result = futureChannel.await(getTimeoutValue(Timeout.CHANNEL, combinedEnvironment), TimeUnit.SECONDS); if (result == IoFuture.Status.DONE) {
final IoFuture<Channel> futureChannel = connection.openChannel(serviceName, OptionMap.EMPTY); result = futureChannel.await(5, TimeUnit.SECONDS); if (result == IoFuture.Status.DONE) {
/** * Open a channel. * * @param connection the connection * @param serviceType the service type * @param options the channel options * @param deadline time, in ms since the epoch, by which the channel must be created, * or {@code null} if the caller is not imposing a specific deadline. * Ignored if less than 10s from the current time, with 10s used as the * default if this is {@code null} * @return the opened channel * @throws IOException if there is a remoting problem opening the channel or it cannot be opened in a reasonable amount of time */ final Channel openChannel(final Connection connection, final String serviceType, final OptionMap options, final Long deadline) throws IOException { final IoFuture<Channel> futureChannel = connection.openChannel(serviceType, options); long waitTime = deadline == null ? 10000 : Math.max(10000, deadline - System.currentTimeMillis()); futureChannel.await(waitTime, TimeUnit.MILLISECONDS); if (futureChannel.getStatus() == IoFuture.Status.WAITING) { futureChannel.cancel(); throw ProtocolLogger.ROOT_LOGGER.channelTimedOut(); } return futureChannel.get(); }
/** * Open a channel. * * @param connection the connection * @param serviceType the service type * @param options the channel options * @param deadline time, in ms since the epoch, by which the channel must be created, * or {@code null} if the caller is not imposing a specific deadline. * Ignored if less than 10s from the current time, with 10s used as the * default if this is {@code null} * @return the opened channel * @throws IOException if there is a remoting problem opening the channel or it cannot be opened in a reasonable amount of time */ final Channel openChannel(final Connection connection, final String serviceType, final OptionMap options, final Long deadline) throws IOException { final IoFuture<Channel> futureChannel = connection.openChannel(serviceType, options); long waitTime = deadline == null ? 10000 : Math.max(10000, deadline - System.currentTimeMillis()); futureChannel.await(waitTime, TimeUnit.MILLISECONDS); if (futureChannel.getStatus() == IoFuture.Status.WAITING) { futureChannel.cancel(); throw ProtocolLogger.ROOT_LOGGER.channelTimedOut(); } return futureChannel.get(); }
Channel openChannel(final Connection connection) throws IOException { final IoFuture<Channel> future = connection.openChannel(DEFAULT_CHANNEL_SERVICE_TYPE, OptionMap.EMPTY); future.await(10L, TimeUnit.SECONDS); if (future.getStatus() == IoFuture.Status.WAITING) { future.cancel(); throw ProtocolLogger.ROOT_LOGGER.channelTimedOut(); } final Channel channel = future.get(); channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(final Channel old, final IOException e) { synchronized (ChannelStrategy.this) { if(ChannelStrategy.this.channel == old) { ChannelStrategy.this.handler.handleClose(old, e); ChannelStrategy.this.channel = null; } } handler.handleChannelClosed(old, e); } }); return channel; }
connection = IoFutureHelper.get(futureConnection, connectionInfo.getConnectionTimeout(), TimeUnit.MILLISECONDS); final IoFuture<Channel> futureChannel = connection.openChannel("naming", connectionInfo.getChannelCreationOptions()); final Channel channel = IoFutureHelper.get(futureChannel, connectionInfo.getChannelCreationTimeout(), TimeUnit.MILLISECONDS); store = RemoteContextFactory.createVersionedStore(channel, ejbClientHandler);
private boolean connectUsingRemoting(CommandContext cmdCtx, RemotingMBeanServerConnection rmtMBeanSvrConn) throws IOException, CliInitializationException { Connection conn = rmtMBeanSvrConn.getConnection(); Channel channel; final IoFuture<Channel> futureChannel = conn.openChannel("management", OptionMap.EMPTY); IoFuture.Status result = futureChannel.await(5, TimeUnit.SECONDS); if (result == IoFuture.Status.DONE) { channel = futureChannel.get(); } else { futureChannel.cancel(); return false; } ModelControllerClient modelCtlrClient = ExistingChannelModelControllerClient.createReceiving(channel, createExecutor()); cmdCtx.bindClient(modelCtlrClient); return true; }
private boolean connectUsingRemoting(CommandContext cmdCtx, RemotingMBeanServerConnection rmtMBeanSvrConn) throws IOException, CliInitializationException { Connection conn = rmtMBeanSvrConn.getConnection(); Channel channel; final IoFuture<Channel> futureChannel = conn.openChannel("management", OptionMap.EMPTY); IoFuture.Status result = futureChannel.await(5, TimeUnit.SECONDS); if (result == IoFuture.Status.DONE) { channel = futureChannel.get(); } else { futureChannel.cancel(); return false; } ModelControllerClient modelCtlrClient = ExistingChannelModelControllerClient.createReceiving(channel, createExecutor()); cmdCtx.bindClient(modelCtlrClient); return true; }
final IoFuture<Channel> futureChannel = connection.openChannel(serviceName, optionMap); futureChannel.addNotifier(new IoFuture.HandlingNotifier<Channel, FutureResult<T>>() { public void handleCancelled(final FutureResult<T> futureResult) {