Examples of CancelResults


Examples of org.rhq.core.clientapi.agent.operation.CancelResults

         * for cancellation).  the user click on the cancel button, but by the time the request makes it down to the
         * agent the operation has completed (or failed).  in this case, asking for the operation from the gateway will
         * fail with a NullPointerException.  here, we assume the job has finished and return that to the caller.
         */
        if (operation == null) {
            return new CancelResults(InterruptedState.FINISHED);
        }
        EnumSet<Status> interruptedStatus = operation.markAsCanceled();

        // tell the caller what state the operation was in when it was canceled
        if (interruptedStatus.contains(Status.FINISHED)) {
            return new CancelResults(InterruptedState.FINISHED);
        } else if (interruptedStatus.contains(Status.QUEUED)) {
            return new CancelResults(InterruptedState.QUEUED);
        } else if (interruptedStatus.contains(Status.RUNNING)) {
            return new CancelResults(InterruptedState.RUNNING);
        }

        return new CancelResults(InterruptedState.UNKNOWN);
    }
View Full Code Here

Examples of org.rhq.core.clientapi.agent.operation.CancelResults

        boolean hadAgentError = false;

        List<ResourceOperationHistory> doomedResourceHistories = doomedHistory.getResourceOperationHistories();
        for (ResourceOperationHistory doomedResourceHistory : doomedResourceHistories) {
            try {
                CancelResults results = cancelResourceOperation(subject, doomedResourceHistory, ignoreAgentErrors);
                if (results == null) {
                    hadAgentError = true;
                }
            } catch (IllegalStateException ignore) {
                // it wasn't in progress - which is fine, nothing to cancel then and its already stopped
View Full Code Here

Examples of org.rhq.core.clientapi.agent.operation.CancelResults

            throw new IllegalStateException("The job is no longer in-progress - cannot cancel it: " + doomedHistory);
        }

        String jobIdString = doomedHistory.getJobId().toString();
        int resourceId = doomedHistory.getResource().getId();
        CancelResults results = null;
        AgentClient agent = null;
        boolean canceled = false;

        try {
            agent = agentManager.getAgentClient(subjectManager.getOverlord(), resourceId);

            // since this method is usually called by the UI, we want to quickly determine if we can even talk to the agent
            if (agent.pingService(5000L)) {
                results = agent.getOperationAgentService().cancelOperation(jobIdString);

                InterruptedState interruptedState = results.getInterruptedState();

                switch (interruptedState) {
                case FINISHED: {
                    // If the agent says the interrupted state was FINISHED, we should not set the history state
                    // to canceled because it can't be canceled after its completed.  Besides, the agent will very
View Full Code Here

Examples of org.rhq.core.clientapi.agent.operation.CancelResults

    @Test(enabled = ENABLE_TESTS)
    public void testCancelGroupOperation() throws Exception {
        simulatedOperation_Error = null;
        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 30000L;
        simulatedOperation_CancelResults = new CancelResults(InterruptedState.RUNNING);

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date());
        operationManager.scheduleGroupOperation(overlord(), newGroup.getId(), new int[] { newResource.getId() }, true,
            PREFIX + "testOp", null, trigger, PREFIX + "desc");
View Full Code Here

Examples of org.rhq.core.clientapi.agent.operation.CancelResults

        // server side still thinks its INPROGRESS.

        simulatedOperation_Error = null;
        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 30000L;
        simulatedOperation_CancelResults = new CancelResults(InterruptedState.FINISHED);

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date());
        operationManager.scheduleGroupOperation(overlord(), newGroup.getId(), new int[] { newResource.getId() }, true,
            PREFIX + "testOp", null, trigger, PREFIX + "desc");
View Full Code Here

Examples of org.rhq.core.clientapi.agent.operation.CancelResults

        Resource resource = newResource;

        simulatedOperation_Error = null;
        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 30000L; // long enough so it doesn't finish before we cancel
        simulatedOperation_CancelResults = new CancelResults(InterruptedState.RUNNING);

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date());
        operationManager.scheduleResourceOperation(overlord(), resource.getId(), PREFIX + "testOp", null, trigger,
            PREFIX + "desc");
View Full Code Here

Examples of org.rhq.core.clientapi.agent.operation.CancelResults

        Resource resource = newResource;

        simulatedOperation_Error = null;
        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 30000L; // long enough so it doesn't notify that it finished before we cancel
        simulatedOperation_CancelResults = new CancelResults(InterruptedState.FINISHED); // agent says its finished

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date());
        operationManager.scheduleResourceOperation(overlord(), resource.getId(), PREFIX + "testOp", null, trigger,
            PREFIX + "desc");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.