Search in sources :

Example 1 with PendingWorkflowIterator

use of io.zeebe.broker.system.deployment.data.PendingWorkflows.PendingWorkflowIterator in project zeebe by zeebe-io.

the class WorkflowDeleteProcessor method processEvent.

@Override
public void processEvent(TypedEvent<WorkflowEvent> event) {
    event.getValue().setState(WorkflowState.DELETED);
    final long workflowKey = event.getKey();
    partitionIds.clear();
    final PendingWorkflowIterator workflows = pendingWorkflows.iterator();
    while (workflows.hasNext()) {
        final PendingWorkflow workflow = workflows.next();
        if (workflow.getWorkflowKey() == workflowKey) {
            partitionIds.addInt(workflow.getPartitionId());
        }
    }
    ensureGreaterThan("partition ids", partitionIds.size(), 0);
}
Also used : PendingWorkflow(io.zeebe.broker.system.deployment.data.PendingWorkflows.PendingWorkflow) PendingWorkflowIterator(io.zeebe.broker.system.deployment.data.PendingWorkflows.PendingWorkflowIterator)

Example 2 with PendingWorkflowIterator

use of io.zeebe.broker.system.deployment.data.PendingWorkflows.PendingWorkflowIterator in project zeebe by zeebe-io.

the class DeploymentDistributedProcessor method removePendingWorkflowsOfDeployment.

private void removePendingWorkflowsOfDeployment(long deploymentKey) {
    int offset = 0;
    // cannot delete entries while iterating over it
    final PendingWorkflowIterator iterator = pendingWorkflows.iterator();
    while (iterator.hasNext()) {
        final PendingWorkflow pendingWorkflow = iterator.next();
        if (deploymentKey == pendingWorkflow.getDeploymentKey()) {
            buffer.putLong(offset, pendingWorkflow.getWorkflowKey());
            offset += SIZE_OF_LONG;
            buffer.putInt(offset, pendingWorkflow.getPartitionId());
            offset += SIZE_OF_INT;
        }
    }
    final int limit = offset;
    offset = 0;
    while (offset < limit) {
        final long workflowKey = buffer.getLong(offset);
        offset += SIZE_OF_LONG;
        final int partitionId = buffer.getInt(offset);
        offset += SIZE_OF_INT;
        pendingWorkflows.remove(workflowKey, partitionId);
    }
}
Also used : PendingWorkflow(io.zeebe.broker.system.deployment.data.PendingWorkflows.PendingWorkflow) PendingWorkflowIterator(io.zeebe.broker.system.deployment.data.PendingWorkflows.PendingWorkflowIterator)

Aggregations

PendingWorkflow (io.zeebe.broker.system.deployment.data.PendingWorkflows.PendingWorkflow)2 PendingWorkflowIterator (io.zeebe.broker.system.deployment.data.PendingWorkflows.PendingWorkflowIterator)2