Package org.globus.workspace.creation

Examples of org.globus.workspace.creation.IdempotentInstance


        }

        PreparedStatement[] statements = new PreparedStatement[instances.size()];
        for (int i = 0; i < statements.length; i++) {

            final IdempotentInstance instance = instances.get(i);
            if (instance == null) {
                throw new IllegalArgumentException("reservation has null instance");
            }

            final PreparedStatement statement =
                    conn.prepareStatement(SQL_INSERT_IDEMPOTENT_CREATION);

            statement.setString(1, creatorId);
            statement.setString(2, clientToken);
            statement.setInt(3, instance.getID());
            statement.setString(4, groupId);
            statement.setString(5, instance.getName());
            statement.setInt(6, instance.getLaunchIndex());

            statements[i] = statement;
        }

        return statements;
View Full Code Here


        final String logId;
        if (res.getGroupId() != null) {
            logId = Lager.groupid(res.getGroupId());
        } else {
            final IdempotentInstance instance = instances.get(0);
            logId = Lager.id(instance.getID());
        }
        logger.info(logId + " idempotent creation request already fulfilled");

        InstanceResource[] resources = new InstanceResource[instances.size()];
        int index = 0;
        for (IdempotentInstance instance : instances) {
            if (instance == null) {
                throw new CreationException("Idempotent reservation has null instance");
            }

            InstanceResource resource;
            try {
                resource = this.whome.find(instance.getID());

                if (resource == null) {
                    throw new CreationException("Existing idempotent instance was null (?)");
                }

                // these parameter checks can only be performed against a running
                // instance.

                this.checkIdempotentInstanceForMismatch(resource, req, logId);

            } catch (DoesNotExistException e) {
                logger.debug("Idempotent reservation request has a terminated instance");

                final VirtualMachine vm = new VirtualMachine();
                vm.setNetwork("NONE");
                final VirtualMachineDeployment deployment = new VirtualMachineDeployment();
                vm.setDeployment(deployment);

                resource = new IdempotentInstanceResource(instance.getID(),
                        instance.getName(), null, res.getGroupId(), instances.size(),
                        instance.getLaunchIndex(), res.getCreatorId(), vm,
                        WorkspaceConstants.STATE_DESTROYING, res.getClientToken());
            }

            if (resource.getName() == null) {
                if (req.getName() != null) {
View Full Code Here

TOP

Related Classes of org.globus.workspace.creation.IdempotentInstance

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.