-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8959: [Backport stable/1.3] #3631: Re-activate jobs r=romansmirnov a=github-actions[bot] # Description Backport of #8879 to `stable/1.3`. relates to #3631 Co-authored-by: Roman <roman.smirnov@camunda.com>
- Loading branch information
Showing
13 changed files
with
864 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...way/src/main/java/io/camunda/zeebe/gateway/impl/job/InflightActivateJobsRequestState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.gateway.impl.job; | ||
|
||
import io.camunda.zeebe.gateway.impl.broker.PartitionIdIterator; | ||
|
||
public class InflightActivateJobsRequestState { | ||
|
||
private final PartitionIdIterator iterator; | ||
private int remainingAmount; | ||
private boolean pollPrevPartition; | ||
private boolean resourceExhaustedWasPresent; | ||
|
||
public InflightActivateJobsRequestState( | ||
final PartitionIdIterator iterator, final int remainingAmount) { | ||
this.iterator = iterator; | ||
this.remainingAmount = remainingAmount; | ||
} | ||
|
||
private boolean hasNextPartition() { | ||
return iterator.hasNext(); | ||
} | ||
|
||
public int getCurrentPartition() { | ||
return iterator.getCurrentPartitionId(); | ||
} | ||
|
||
public int getNextPartition() { | ||
return pollPrevPartition ? iterator.getCurrentPartitionId() : iterator.next(); | ||
} | ||
|
||
public int getRemainingAmount() { | ||
return remainingAmount; | ||
} | ||
|
||
public void setRemainingAmount(int remainingAmount) { | ||
this.remainingAmount = remainingAmount; | ||
} | ||
|
||
public boolean wasResourceExhaustedPresent() { | ||
return resourceExhaustedWasPresent; | ||
} | ||
|
||
public void setResourceExhaustedWasPresent(final boolean resourceExhaustedWasPresent) { | ||
this.resourceExhaustedWasPresent = resourceExhaustedWasPresent; | ||
} | ||
|
||
public void setPollPrevPartition(boolean pollPrevPartition) { | ||
this.pollPrevPartition = pollPrevPartition; | ||
} | ||
|
||
public boolean shouldActivateJobs() { | ||
return remainingAmount > 0 && (pollPrevPartition || hasNextPartition()); | ||
} | ||
} |
Oops, something went wrong.