@Override public Channel getChannel() throws IOException { return awaitChannel(); }
@Override public Connection connect() throws IOException { return openConnection(); }
@Override public synchronized Cancellable pollForConnect() { final Future<Connection> future = connection.reconnect(); setupHandler(); return new Cancellable() { @Override public boolean cancel() { return future.cancel(true); } }; }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, CHANNEL_SERVICE_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); try { // Start the registration process channelHandler.executeRequest(new RegisterHostControllerRequest(), null).getResult().get(); } catch (Exception e) { if(e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e); } // Registered registered(); } else { channel.closeAsync(); } }
connection = new RemoteDomainConnection(localHostInfo.getLocalHostName(), hostInfo, configuration, realm, localHostInfo.getRemoteDomainControllerUsername(), executor, scheduledExecutorService, new RemoteDomainConnection.HostRegistrationCallback() { handler = connection.getChannelHandler(); } catch (Exception e) { throw new StartException(e);
@Override public synchronized void reportServerInstability(String serverName) { if (connection.isConnected()) { try { handler.executeRequest(new ControllerInstabilityNotificationRequest(serverName), null); } catch (Exception e) { HostControllerLogger.ROOT_LOGGER.failedReportingServerInstabilityToMaster(e, serverName); } } }
@Override public void close() throws IOException { try { if(prepareClose() && isConnected()) { try { channelHandler.executeRequest(new UnregisterModelControllerRequest(), null).getResult().await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } finally { try { super.close(); } finally { connectionManager.shutdown(); } } }
try { connection.connect(); connected = true; } catch (IOException e) {
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, CHANNEL_SERVICE_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); try { if (runningMode == RunningMode.ADMIN_ONLY) { // Fetch the domain configuration channelHandler.executeRequest(new FetchDomainConfigurationRequest(), null).getResult().get(); } else { // Start the registration process channelHandler.executeRequest(new RegisterHostControllerRequest(), null).getResult().get(); } } catch (Exception e) { if(e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e); } // Registered registered(); } else { channel.closeAsync(); } }
final SecurityRealm realm = securityRealmInjector.getOptionalValue(); connection = new RemoteDomainConnection(localHostInfo.getLocalHostName(), configuration, authenticationContext, realm, localHostInfo.getRemoteDomainControllerUsername(), localHostInfo.getRemoteDomainControllerDiscoveryOptions(), executor, scheduledExecutorService, handler = connection.getChannelHandler(); handler.getAttachments().attach(ManagementChannelHandler.TEMP_DIR, tempDir); } catch (Exception e) {
@Override public synchronized void reportServerInstability(String serverName) { if (connection.isConnected()) { try { handler.executeRequest(new ControllerInstabilityNotificationRequest(serverName), null); } catch (Exception e) { HostControllerLogger.ROOT_LOGGER.failedReportingServerInstabilityToMaster(e, serverName); } } }
@Override public void close() throws IOException { try { if(prepareClose() && isConnected()) { try { channelHandler.executeRequest(new UnregisterModelControllerRequest(), null).getResult().await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } finally { try { super.close(); } finally { connectionManager.shutdown(); } } }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, CHANNEL_SERVICE_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); try { if (runningMode == RunningMode.ADMIN_ONLY) { // Fetch the domain configuration channelHandler.executeRequest(new FetchDomainConfigurationRequest(), null).getResult().get(); } else { // Start the registration process channelHandler.executeRequest(new RegisterHostControllerRequest(), null).getResult().get(); } } catch (Exception e) { if(e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e); } // Registered registered(); } else { channel.closeAsync(); } }
final SecurityRealm realm = securityRealmInjector.getOptionalValue(); connection = new RemoteDomainConnection(localHostInfo.getLocalHostName(), configuration, authenticationContext, realm, localHostInfo.getRemoteDomainControllerUsername(), localHostInfo.getRemoteDomainControllerDiscoveryOptions(), executor, scheduledExecutorService, handler = connection.getChannelHandler(); handler.getAttachments().attach(ManagementChannelHandler.TEMP_DIR, tempDir); } catch (Exception e) {
@Override public void close() throws IOException { synchronized (this) { try { if(isConnected()) { try { channelHandler.executeRequest(new UnregisterModelControllerRequest(), null).getResult().await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } finally { try { connectionManager.shutdown(); } finally { super.close(); } } } }
@Override public synchronized Cancellable pollForConnect() { final Future<Connection> future = connection.reconnect(); setupHandler(); return new Cancellable() { @Override public boolean cancel() { return future.cancel(true); } }; }
@Override public Connection connect() throws IOException { return openConnection(); }
@Override public Channel getChannel() throws IOException { return awaitChannel(); }