Package org.nimbustools.api.services.rm

Examples of org.nimbustools.api.services.rm.ManageException


            if (logger.isDebugEnabled()) {
                logger.error(e.getMessage(), e);
            } else {
                logger.error(e.getMessage());
            }
            throw new ManageException(e);
        }

        logger.debug("found resource = " + resource);

        final VirtualMachine vm = resource.getVM();
View Full Code Here


            final String err = "problem shutting down " + Lager.id(this.id) +
                        ": " + e.getMessage();
            logger.error(err, e);
            // setting to corrupted and/or deciding to destroy depends on the
            // situation and has already happened via the state machine
            throw new ManageException(err, e);
        }
    }
View Full Code Here

        final int keyInt;
        try {
            keyInt = Integer.parseInt(key);
        } catch (Throwable t) {
            final String err = "invalid key: " + key;
            throw new ManageException(err, t);
        }

        this.id = keyInt;

        if (lager.traceLog) {
View Full Code Here

    public int convertID(String id) throws ManageException {
        final int idInt;
        try {
            idInt = Integer.parseInt(id);
            if (idInt < 1) {
                throw new ManageException("ID may not be less than one");
            }
        } catch (NumberFormatException e) {
            throw new ManageException("Requiring instance IDs be " +
                    "integers, for now: " + e.getMessage(), e);
        }
        return idInt;
    }
View Full Code Here

        return idInt;
    }

    public String convertID(int id) throws ManageException {
        if (id < 1) {
            throw new ManageException("ID may not be less than one");
        }
        return String.valueOf(id);
    }
View Full Code Here

    public InstanceResource find(String id)

            throws ManageException, DoesNotExistException {

        if (id == null) {
            throw new ManageException("id may not be null");
        }

        final InstanceResource resource;

        final Lock lock = this.lockManager.getLock(id);
        try {
            lock.lockInterruptibly();
        } catch (InterruptedException e) {
            throw new ManageException(e.getMessage(), e);
        }

        try {

            final Element el = this.cache.get(id);
            if (el == null) {
                resource = this.newInstance(id);
                resource.load(id); // throws DoesNotExistException if not in db

                final Calendar currTime = Calendar.getInstance();
                final Calendar termTime = resource.getTerminationTime();
                if (termTime != null && termTime.before(currTime)) {
                    boolean destroyed = this.destroy(id);
                    if (destroyed) {
                      throw new DoesNotExistException(Lager.id(id) + " expired");
                    }
                }

            } else {
                resource = (InstanceResource) el.getObjectValue();
            }

        } catch (DoesNotExistException e) {
            this.cache.remove(id);
            throw e;
        } catch (CreationException e) {
            throw new ManageException(e.getMessage(), e); // ...
        } finally {
            lock.unlock();
        }

        return resource;
View Full Code Here

        final Lock destroy_lock = this.lockManager.getLock("destroy_" + id);
        final Lock lock = this.lockManager.getLock(id);
        try {
            destroy_lock.lockInterruptibly();
        } catch (InterruptedException e) {
            throw new ManageException(e.getMessage(), e);
        }

        try {
            lock.lockInterruptibly();
        } catch (InterruptedException e) {
            destroy_lock.unlock();
            throw new ManageException(e.getMessage(), e);
        }

        try {
            final InstanceResource resource = this.find(id);
            this.scheduler.cleanup(id);
View Full Code Here

        final Lock destroy_lock = this.lockManager.getLock("destroy_" + id);
        final Lock lock = this.lockManager.getLock(id);
        try {
            destroy_lock.lockInterruptibly();
        } catch (InterruptedException e) {
            throw new ManageException(e.getMessage(), e);
        }

        try {
            lock.lockInterruptibly();
        } catch (InterruptedException e) {
            destroy_lock.unlock();
            throw new ManageException(e.getMessage(), e);
        }

        try {
            final InstanceResource resource = this.find(id);
            destroyed = resource.remove();
View Full Code Here

        final int[] keys;
        try {
            keys = this.persistence.findActiveWorkspacesIDs();
        } catch (WorkspaceDatabaseException e) {
            throw new ManageException(e.getMessage(), e);
        }

        if (keys == null || keys.length == 0) {
            final String msg = "No workspaces were persisted when the" +
                        " container last shut down";
View Full Code Here

    public boolean isActiveWorkspaceID(int id) throws ManageException {
        try {
            return this.persistence.isActiveWorkspaceID(id);
        } catch (WorkspaceDatabaseException e) {
            throw new ManageException(e.getMessage(), e);
        }
    }
View Full Code Here

TOP

Related Classes of org.nimbustools.api.services.rm.ManageException

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.