Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6765073

Clarify the handling of the leaseScheduler by the EventClient



      As of JDK 7 b38.
      In the following code extract we use the complex EventClient constructor to provide an executor for the lease handling.
      Said the javadoc the value 0L for the requested lease time is equivalent to using the default value which is, still from the javadoc, 300000 milliseconds.

      EventClientDelegateMBean ecdMBean = EventClientDelegate.getProxy(getClient());
      ScheduledExecutorService leaseExecutor = Executors.newSingleThreadScheduledExecutor();
      long reqLeaseTime = 0L;
      EventClient eventclient = new EventClient(ecdMBean, null, null, leaseExecutor, reqLeaseTime);

      I fetch my notifications over RMI without any issue but after that my client application refuses to exit. Attached is the full output with debugging and thread dump.
      I suspect shutdown or shutdownNow aren't called on the leaseExecutor I provide.
      A few questions:

      [1] Why after expiration of the 300 seconds lease the app's still stuck ? Shouldn't we expect shutdown or shutdownNow is called after the lease expired ?

      [2] Note that if I provide null as leaseExecutor value, which means I rely on default implementation, all goes well. Does it mean that if I create 2 EventClient, both with a null leaseExecutor but different lease time, the first to expire will trigger too the shutdown of the second one ? Or that the requested lease time parameter is ignored if the lease executor provided is null (something the javadoc doesn't say today) ?

      [3] I understand a user provides its own lease executor most probably because it's shared then JMX has no idea when it's appropriate to shutdown it; I suggest to explicit it in the javadoc. This impacts EventClient description as well as the Leasing paragraph in the event package description.




            • Assignee:
              sjiang Shanliang Jiang (Inactive)
              yjoan Yves Joan (Inactive)
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: