/*     */ 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");
   /*     */ }
Esempio n. 2
0
  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();
  }