Package net.jini.core.lease

Examples of net.jini.core.lease.LeaseDeniedException


  // are did they?
  if (desiredExpiration == Lease.FOREVER && desiredRenewal == Lease.ANY) {
      if (extension != Lease.ANY) {
    setRsltIfNeeded("LRS asked for " + extension +
        " when it should have asked for Lease.ANY");
    throw new LeaseDeniedException("Next time ask for Lease.ANY");
      }
  } else if (extension > desiredRenewal) {
      // If desiredRenewal is not Lease.ANY extension must be less
      // than or equal to desiredRenewal
      setRsltIfNeeded("LRS asked for " + extension + " when it " +
          "should have asked for no more than " +
          desiredRenewal);
      throw new LeaseDeniedException("Next time ask for no more than " +
             desiredRenewal);
  } else if (desiredRenewal + slop > desiredExpiration - now) {
      // Make sure they are asking for the remander of the
      // desiredExpiration
     
      final long requestedExp = now + extension;
      if (requestedExp < 0) {
    // Overflow, ignore slop and just check to see if
    // desired expiration is forever
    if (desiredExpiration != Long.MAX_VALUE) {
        setRsltIfNeeded("Renewal service asked for a new " +
            "expiration of " + requestedExp +
      " should have asked for " + desiredExpiration +
      " (a diffrence of " +
      (requestedExp - desiredExpiration) + " milliseconds)");
        throw new LeaseDeniedException("Too MUCH!");
    }
      } else {
    // No overflow...no...forever check to see if the diff
    // is less than the slop, or if it asked for
    // desiredRenewal
    final long diff = Math.abs(requestedExp - desiredExpiration);
    if (diff > slop) {
        setRsltIfNeeded("Renewal service asked for a new " +
      "expiration of " + requestedExp +
      " should have asked for " + desiredExpiration +
      " (a diffrence of " + diff + " milliseconds)");
        throw new LeaseDeniedException("A bit off");
    }
      }
  } else if (desiredRenewal != extension) {
      // Should have asked for exactly desiredRenewal
      setRsltIfNeeded("Renewal service asked for an extention " +
    "of " + extension + " should have asked for " + desiredRenewal);
     
      throw new LeaseDeniedException("Next time ask for " +
             desiredRenewal);     
  }
   
  // Seem to ask for the right extension
  // Calculate the renewal grant __DURATION__
View Full Code Here


      throw new UnknownLeaseException("Lease expired");
  }

  // Have the asked for the right renewal?
  if (!isValidExtension(extension))
      throw new LeaseDeniedException("Did not ask for right extension");
   
  // Seem to ask for the right extension
  // Calculate the renewal grant __DURATION__
 
  long grant;
View Full Code Here

      throw new UnknownLeaseException("Lease expired");
  }

  // Have the asked for the right renewal?
  if (!isValidExtension(extension))
      throw new LeaseDeniedException("Did not ask for right extension");
   
  // Seem to ask for the right extension
  // Calculate the renewal grant __DURATION__
 
  long grant;
View Full Code Here

      new Error("Synthetic Error"), true, set);
  createAndRegisterLease(
      new UnknownLeaseException("Synthetic UnknownLeaseException"), true,
      set);
  createAndRegisterLease(
      new LeaseDeniedException("Synthetic LeaseDeniedException"), true,
      set);
  createAndRegisterLease(
      new OutOfMemoryError("Synthetic OutOfMemoryError"),
      false, set);
  createAndRegisterLease(
View Full Code Here

      throw new UnknownLeaseException("Lease expired");
  }

  // Have the asked for the right renewal?
  if (!isValidExtension(extension))
      throw new LeaseDeniedException("Did not ask for right extension");
   
  // Seem to ask for the right extension
  // Calculate the renewal grant __DURATION__
 
  long grant;
View Full Code Here

  // are did they?
  if (desiredExpiration == Lease.FOREVER && desiredRenewal == Lease.ANY) {
      if (extension != Lease.ANY) {
    setRsltIfNeeded("LRS asked for " + extension +
        " when it should have asked for Lease.ANY");
    throw new LeaseDeniedException("Next time ask for Lease.ANY");
      }
  } else if (extension > desiredRenewal) {
      // If desiredRenewal is not Lease.ANY extension must be less
      // than or equal to desiredRenewal
      setRsltIfNeeded("LRS asked for " + extension + " when it " +
          "should have asked for no more than " +
          desiredRenewal);
      throw new LeaseDeniedException("Next time ask for no more than " +
             desiredRenewal);
  } else if (desiredRenewal + slop > desiredExpiration - now) {
      // Make sure they are asking for the remander of the
      // desiredExpiration
     
      final long requestedExp = now + extension;
      if (requestedExp < 0) {
    // Overflow, ignore slop and just check to see if
    // desired expiration is forever
    if (desiredExpiration != Long.MAX_VALUE) {
        setRsltIfNeeded("Renewal service asked for a new " +
            "expiration of " + requestedExp +
      " should have asked for " + desiredExpiration +
      " (a diffrence of " +
      (requestedExp - desiredExpiration) + " milliseconds)");
        throw new LeaseDeniedException("Too MUCH!");
    }
      } else {
    // No overflow...no...forever check to see if the diff
    // is less than the slop, or if it asked for
    // desiredRenewal
    final long diff = Math.abs(requestedExp - desiredExpiration);
    if (diff > slop) {
        setRsltIfNeeded("Renewal service asked for a new " +
      "expiration of " + requestedExp +
      " should have asked for " + desiredExpiration +
      " (a diffrence of " + diff + " milliseconds)");
        throw new LeaseDeniedException("A bit off");
    }
      }
  } else if (desiredRenewal != extension) {
      // Should have asked for exactly desiredRenewal
      setRsltIfNeeded("Renewal service asked for an extention " +
    "of " + extension + " should have asked for " + desiredRenewal);
     
      throw new LeaseDeniedException("Next time ask for " +
             desiredRenewal);     
  }
   
  // Seem to ask for the right extension
  // Calculate the renewal grant __DURATION__
View Full Code Here

    /**
     * @see org.rioproject.admin.MonitorableService#monitor
     */
    public Lease monitor(final long duration) throws LeaseDeniedException {
        if (duration <= 0)
            throw new LeaseDeniedException("lease duration of ["+duration+"] is invalid");
        String phonyResource = this.getClass().getName() + ":"+ System.currentTimeMillis();
        ServiceResource serviceResource = new ServiceResource(phonyResource);
        Lease lease = monitorLandlord.newLease(serviceResource, duration);
        return (lease);
    }
View Full Code Here

        ServiceBeanInstantiator instantiator;

        try {
            instantiator = sbi.get();
        } catch (IOException e) {
            throw new LeaseDeniedException("Error calling MarshalledObject.get(), "+e.getLocalizedMessage());
        } catch (ClassNotFoundException e) {
            throw new LeaseDeniedException("Could not load ServiceBeanInstantiator, "+e.getLocalizedMessage());
        }

        if(instantiator instanceof RemoteMethodControl)
            instantiator = (ServiceBeanInstantiator)instantiatorPreparer.prepareProxy(instantiator);
        String name;
        try {
            name = instantiator.getName();
        } catch(Throwable t) {
            name = "Cybernode";
        }

        Uuid uuid=instantiator.getInstantiatorUuid();
        InstantiatorResource resource = new InstantiatorResource(sbi,
                                                                 instantiator,
                                                                 name,
                                                                 uuid,
                                                                 handback,
                                                                 resourceCapability,
                                                                 serviceLimit);
        try {
            resource.setDeployedServices(deployedServices);
        } catch (Throwable t) {
            logger.warn("Registering a ServiceBeanInstantiator", t);
            throw new LeaseDeniedException("Getting ServiceRecords");
        }

        ServiceResource serviceResource = new ServiceResource(resource);

        /* Add ServiceResource to landlord */
 
View Full Code Here

TOP

Related Classes of net.jini.core.lease.LeaseDeniedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.