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);
}
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);
}
}
Aggregations