2 Replies Latest reply on Mar 8, 2006 3:27 AM by timfox

    Bug in setupClientLease

    timfox

      I'm observing a bug in Client::setupClientLease() where the same LeasePinger instance gets scheduled twice resulting in failure.

      Looking at the code

      
      ret = invoker.invoke(new InvocationRequest(sessionId, subsystem, "$PING$", configuration, null, null));
       if(ret instanceof InvocationResponse)
       {
       InvocationResponse resp = (InvocationResponse)ret;
       Map respMap = resp.getPayload();
       if(respMap != null)
       {
       Long leaseTimeoutValue = (Long)respMap.get("clientLeasePeriod");
       long leaseTimeout = leaseTimeoutValue.longValue();
       if(leaseTimeout > 0)
       {
       if(leasePinger == null)
       {
       leasePinger = new LeasePinger(this);
       }
       leasePinger.startPing(leaseTimeout);
       }
       }
       }
      
      


      The call to

       leasePinger.startPing(leaseTimeout);
      


      gets executed whether or not the leasePinger already exists.

      We only want one pinger per client (I assume) so I have amended this in my local copy so startPing is only called in the case the leasePinger has just been created and not at any other time.

      This seems to solve the problem.