Search in sources :

Example 1 with Resume

use of org.wso2.carbon.humantask.core.engine.commands.Resume in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method resumeInstance.

/**
 * Resume a suspended instance
 *
 * @param iid Instance Id
 * @throws InstanceManagementException If the instance cannot be resumed due to the
 *                                     unavailability of Debugger support
 */
public void resumeInstance(long iid) throws InstanceManagementException {
    try {
        isOperationIsValidForTheCurrentTenant(iid);
    } catch (IllegalAccessException ex) {
        handleError(ex);
    }
    /*
        We need debugger support in order to resume (since we have to force
        a reduction. If one is not available the getDebugger() method should
        throw a ProcessingException
        */
    DebuggerSupport debugSupport = getDebugger(iid);
    if (debugSupport == null) {
        String errMsg = "Cannot resume the instance " + iid + ", Debugger support not available";
        log.error(errMsg);
        throw new InstanceManagementException(errMsg);
    }
    debugSupport.resume(iid);
}
Also used : InstanceManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException) DebuggerSupport(org.apache.ode.bpel.engine.DebuggerSupport)

Example 2 with Resume

use of org.wso2.carbon.humantask.core.engine.commands.Resume in project siddhi by wso2.

the class SiddhiAppRuntime method persist.

public PersistenceReference persist() {
    try {
        // first, pause all the event sources
        sourceMap.values().forEach(list -> list.forEach(Source::pause));
        // take snapshots of execution units
        byte[] snapshots = siddhiAppContext.getSnapshotService().snapshot();
        // start the snapshot persisting task asynchronously
        AsyncSnapshotPersistor asyncSnapshotPersistor = new AsyncSnapshotPersistor(snapshots, siddhiAppContext.getSiddhiContext().getPersistenceStore(), siddhiAppContext.getName());
        String revision = asyncSnapshotPersistor.getRevision();
        Future future = siddhiAppContext.getExecutorService().submit(asyncSnapshotPersistor);
        return new PersistenceReference(future, revision);
    } finally {
        // at the end, resume the event sources
        sourceMap.values().forEach(list -> list.forEach(Source::resume));
    }
}
Also used : AsyncSnapshotPersistor(org.wso2.siddhi.core.util.snapshot.AsyncSnapshotPersistor) Future(java.util.concurrent.Future) PersistenceReference(org.wso2.siddhi.core.util.snapshot.PersistenceReference)

Example 3 with Resume

use of org.wso2.carbon.humantask.core.engine.commands.Resume in project carbon-business-process by wso2.

the class TaskOperationsImpl method resume.

/**
 * Resume a suspended task.
 *
 * @param taskId : task identifier
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 * @throws IllegalArgumentFault
 * @throws IllegalAccessFault
 */
public void resume(final URI taskId) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
    try {
        validateTaskId(taskId);
        HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {

            public Object call() throws Exception {
                HumanTaskCommand resumeCommand = new Resume(getCaller(), new Long(taskId.toString()));
                resumeCommand.execute();
                return null;
            }
        });
    } catch (Exception ex) {
        handleException(ex);
    }
}
Also used : HumanTaskCommand(org.wso2.carbon.humantask.core.engine.HumanTaskCommand) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException) Resume(org.wso2.carbon.humantask.core.engine.commands.Resume)

Aggregations

Future (java.util.concurrent.Future)1 DebuggerSupport (org.apache.ode.bpel.engine.DebuggerSupport)1 InstanceManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException)1 HumanTaskCommand (org.wso2.carbon.humantask.core.engine.HumanTaskCommand)1 HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)1 Resume (org.wso2.carbon.humantask.core.engine.commands.Resume)1 HumanTaskIllegalAccessException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException)1 HumanTaskIllegalArgumentException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException)1 HumanTaskIllegalOperationException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException)1 HumanTaskIllegalStateException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException)1 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)1 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)1 UserStoreException (org.wso2.carbon.user.core.UserStoreException)1 AsyncSnapshotPersistor (org.wso2.siddhi.core.util.snapshot.AsyncSnapshotPersistor)1 PersistenceReference (org.wso2.siddhi.core.util.snapshot.PersistenceReference)1