@Override void end() { remoteNotificationManager.removeNotificationListener(); server.connectionClosed(this); }
@Override public void handleEvent(Event event) throws IOException { event.run(); } };
/** * Get the version string of the remoting connector provider. * * @return the version string. */ public static String getVersionString() { return Version.getVersionString(); }
public MBeanServerConnection getMBeanServerConnection(Subject delegationSubject) throws IOException { log.trace("getMBeanServerConnection(Subject)"); verifyConnected(); return versionedConnection.getMBeanServerConnection(delegationSubject); }
public DelegatingRemotingConnectorServer(final MBeanServerLocator mbeanServerLocator, final Endpoint endpoint, final Executor executor, final Map<String, ?> environment, final ServerMessageInterceptorFactory serverMessageInterceptorFactory) { this.mbeanServerManager = new DelegatingMBeanServerManager(mbeanServerLocator); this.endpoint = endpoint; this.executor = executor; versions = new Versions(environment); this.serverMessageInterceptorFactory = serverMessageInterceptorFactory != null ? serverMessageInterceptorFactory : DefaultServerInterceptorFactory.FACTORY_INSTANCE; }
public static IoFuture<InitialHeader> getInitialHeader(final Channel channel) { VersionedIoFuture<InitialHeader> future = new VersionedIoFuture<InitialHeader>(); channel.receiveMessage(new ClientVersionReceiver(future)); return future; }
public String getConnectionId() throws IOException { log.trace("getConnectionId()"); verifyConnected(); String connectionId = versionedConnection.getConnectionId(); log.debugf("Our connection id is '%s'", connectionId); return connectionId; }
public void channelOpened(Channel channel) { log.trace("Channel Opened"); try { writeVersionHeader(channel, false); channel.receiveMessage(new ClientVersionReceiver(serverMessageInterceptorFactory.create(channel))); } catch (IOException e) { log.error("Unable to send header, closing channel", e); IoUtils.safeClose(channel); } }
public void run() { if (state == ConnectorState.OPEN) { try { shutDownHook = null; close(); } catch (IOException ignored) { } } } });
public boolean isActive() { return connectorServer.isActive(); }
public Map<String, ?> getAttributes() { return connectorServer.getAttributes(); }
public void connect() throws IOException { connect(null); }
public JMXServiceURL getAddress() { return connectorServer.getAddress(); }
public WrappedMBeanServerConnection getDefaultMBeanServer() { return getMBeanServer(null); }
public void start() throws IOException { connectorServer.start(); }
public void stop() throws IOException { connectorServer.stop(); }
@Override public WrappedMBeanServerConnection getMBeanServer(Map<String, String> parameters) { if (parameters.isEmpty()) { return getDefaultMBeanServer(); } // Only a single server do don't support parameters. return null; } };
private void safeClose(final Channel channel) { if (channel != null) { try { channel.writeShutdown(); } catch (Exception ignored) { } } safeClose((Closeable) channel); }
@Override public void handleEnd(Channel channel) { remoteNotificationManager.removeNotificationListener(); server.connectionClosed(ServerProxy.this); }
public void handleError(Channel channel, IOException error) { log.warn("Channel closing due to error", error); remoteNotificationManager.removeNotificationListener(); server.connectionClosed(ServerProxy.this); }