code: public Collection<Lease> acquire(int qty, long time, TimeUnit unit) throws Exception
      {
          long                startMs = System.currentTimeMillis();
          long                waitMs = TimeUnit.MILLISECONDS.convert(time, unit);
  
          Preconditions.checkArgument(qty > 0, "qty cannot be 0");
  
          ImmutableList.Builder<Lease>    builder = ImmutableList.builder();
          try
          {
              while ( qty-- > 0 )
              {
                  long        elapsedMs = System.currentTimeMillis() - startMs;
                  long        thisWaitMs = waitMs - elapsedMs;
  
                  String      path = (thisWaitMs > 0) ? internals.attemptLock(thisWaitMs, TimeUnit.MILLISECONDS, null) : null;
                  if ( path == null )
                  {
                      returnAll(builder.build());
                      return null;
                  }
                  builder.add(makeLease(path));
              }
          }
          catch ( Exception e )
          {
              ThreadUtils.checkInterrupted(e);
              returnAll(builder.build());
              throw e;
          }
  
          return builder.build();
      }
docs: <p>Acquire <code>qty</code> leases. If there are not enough leases available, this method
  blocks until either the maximum number of leases is increased enough or other clients/processes
  close enough leases. However, this method will only block to a maximum of the time
  parameters given. If time expires before all leases are acquired, the subset of acquired
  leases are automatically closed.</p>
  
  <p>The client must close the leases when it is done with them. You should do this in a
  <code>finally</code> block. NOTE: You can use {@link #returnAll(Collection)} for this.</p>
  
  @param qty number of leases to acquire
  @param time time to wait
  @param unit time unit
  @return the new leases or null if time ran out
  @throws Exception ZK errors, interruptions, etc.