Package net.jini.core.lease

Examples of net.jini.core.lease.UnknownLeaseException


     */
    public long renew(final Uuid cookie, final long extension) throws LeaseDeniedException, UnknownLeaseException {
        LeasedResource resource = getLeasedResource(cookie);
        long granted;
        if (resource == null)
            throw new UnknownLeaseException("No lease for cookie: " + cookie);
        long now = System.currentTimeMillis();
        if (resource.getExpiration() <= now) {
            UnknownLeaseException e = new UnknownLeaseException("Lease has already expired");
            if(logger.isTraceEnabled()) {
                logger.trace("Lease has already expired by [{}] milliseconds, [{}] seconds",
                             (now-resource.getExpiration())((now-resource.getExpiration())/1000));
            }
            throw e;
View Full Code Here


     *
     * @param cookie Associated with the lease when it was created
     */
    public void cancel(final Uuid cookie) throws UnknownLeaseException {
        if (!remove(cookie))
            throw new UnknownLeaseException("No lease for cookie: " + cookie);
    }
View Full Code Here

            result = leasePolicy.renew(registeredNotification, duration);
            registeredNotification.setExpiration(result.expiration);
            registrations.put(uuid, registeredNotification);
            leaseListener.renewed(registeredNotification);
        } else {
            throw new UnknownLeaseException("Unable to renew unknown lease");
        }
        return result.duration;
    }
View Full Code Here

        RegisteredNotification registeredNotification = registrations.get(uuid);
        if(registeredNotification!=null) {
            registrations.remove(uuid);
            leaseListener.removed(registeredNotification);
        } else {
            throw new UnknownLeaseException("Unable to cancel unknown lease");
        }
    }
View Full Code Here

TOP

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

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.