/* */ public synchronized void close() /* */ throws IOException /* */ { /* 399 */ boolean bool1 = logger.traceOn(); /* 400 */ boolean bool2 = logger.debugOn(); /* */ /* 402 */ if (bool1) logger.trace("close", "closing"); /* */ /* 404 */ Object localObject1 = null; /* */ try { /* 406 */ if (bool2) logger.debug("close", "closing Server"); /* 407 */ closeServer(); /* */ } catch (IOException localIOException1) { /* 409 */ if (bool1) logger.trace("close", "Failed to close server: " + localIOException1); /* 410 */ if (bool2) logger.debug("close", localIOException1); /* 411 */ localObject1 = localIOException1; /* */ } /* */ /* 414 */ if (bool2) logger.debug("close", "closing Clients"); /* */ while (true) /* */ { /* 417 */ synchronized (this.clientList) { /* 418 */ if (bool2) logger.debug("close", "droping dead references"); /* 419 */ dropDeadReferences(); /* */ /* 421 */ if (bool2) logger.debug("close", "client count: " + this.clientList.size()); /* 422 */ if (this.clientList.size() == 0) /* */ { /* */ break; /* */ } /* */ /* 428 */ Iterator localIterator = this.clientList.iterator(); /* 429 */ if (localIterator.hasNext()) { /* 430 */ WeakReference localWeakReference = (WeakReference) localIterator.next(); /* 431 */ RMIConnection localRMIConnection = (RMIConnection) localWeakReference.get(); /* 432 */ localIterator.remove(); /* 433 */ if (localRMIConnection != null) { /* */ try { /* 435 */ localRMIConnection.close(); /* */ } catch (IOException localIOException2) { /* 437 */ if (bool1) /* 438 */ logger.trace("close", "Failed to close client: " + localIOException2); /* 439 */ if (bool2) logger.debug("close", localIOException2); /* 440 */ if (localObject1 == null) { /* 441 */ localObject1 = localIOException2; /* */ } /* */ } /* */ } /* */ } /* */ } /* */ } /* */ /* 449 */ if (this.notifBuffer != null) { /* 450 */ this.notifBuffer.dispose(); /* */ } /* 452 */ if (localObject1 != null) { /* 453 */ if (bool1) logger.trace("close", "close failed."); /* 454 */ throw localObject1; /* */ } /* */ /* 457 */ if (bool1) logger.trace("close", "closed."); /* */ }
/* */ protected void clientClosed(RMIConnection paramRMIConnection) /* */ throws IOException /* */ { /* 338 */ boolean bool = logger.debugOn(); /* */ /* 340 */ if (bool) logger.trace("clientClosed", "client=" + paramRMIConnection); /* */ /* 342 */ if (paramRMIConnection == null) { /* 343 */ throw new NullPointerException("Null client"); /* */ } /* 345 */ synchronized (this.clientList) { /* 346 */ dropDeadReferences(); /* 347 */ Iterator localIterator = this.clientList.iterator(); /* 348 */ while (localIterator.hasNext()) { /* 349 */ WeakReference localWeakReference = (WeakReference) localIterator.next(); /* 350 */ if (localWeakReference.get() == paramRMIConnection) { /* 351 */ localIterator.remove(); /* 352 */ break; /* */ } /* */ /* */ } /* */ /* */ } /* */ /* 360 */ if (bool) logger.trace("clientClosed", "closing client."); /* 361 */ closeClient(paramRMIConnection); /* */ /* 363 */ if (bool) logger.trace("clientClosed", "sending notif"); /* 364 */ this.connServer.connectionClosed( paramRMIConnection.getConnectionId(), "Client connection closed", null); /* */ /* 367 */ if (bool) logger.trace("clientClosed", "done"); /* */ }
public void close() throws IOException { synchronized (this) { if (closed) return; connected = false; closed = true; if (notificationHandler != null) notificationHandler.stop(); if (heartbeat != null) heartbeat.stop(); if (connection != null) connection.close(); connection = null; rmiServer = null; } emitter.sendConnectionNotificationClosed(); }
public void connect(Map environment) throws IOException, SecurityException { synchronized (this) { if (connected) return; if (closed) throw new IOException("This RMIConnector has already been closed"); // Spec says, about default ClassLoader, to look here: // 1. Environment at connect(); if null, // 2. Environment at creation; if null, // 3. Context classloader at connect(). ClassLoader loader = findDefaultClassLoader(environment); if (loader != null) defaultClassLoader = loader; else if (defaultClassLoader == null) defaultClassLoader = Thread.currentThread().getContextClassLoader(); Map env = environment == null ? new HashMap() : environment; String protocol = jmxServiceURL.getProtocol(); ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, env); if (resolver == null) throw new IOException("Unsupported protocol: " + protocol); if (rmiServer == null) rmiServer = (RMIServer) resolver.lookupClient(jmxServiceURL, env); rmiServer = (RMIServer) resolver.bindClient(rmiServer, env); Object credentials = env.get(CREDENTIALS); this.connection = rmiServer.newClient(credentials); connected = true; this.connectionId = connection.getConnectionId(); this.heartbeat = new RMIHeartBeat(connection, emitter, env); this.notificationHandler = new RMIRemoteNotificationClientHandler( connection, defaultClassLoader, emitter, heartbeat, env); this.heartbeat.start(); this.notificationHandler.start(); } emitter.sendConnectionNotificationOpened(); }