-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
28 changed files
with
1,975 additions
and
310 deletions.
There are no files selected for viewing
280 changes: 204 additions & 76 deletions
280
core/api/src/main/java/com/blazebit/job/JobContext.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright 2018 - 2020 Blazebit. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.blazebit.job; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Repeatable; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* {@link PartitionKey} configuration for a {@link JobInstance} class. | ||
* | ||
* @author Christian Beikov | ||
* @since 1.0.0 | ||
*/ | ||
@Repeatable(Partitions.class) | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Partition { | ||
|
||
/** | ||
* The partition name. If empty, uses the class name of the annotated {@link JobInstance}. | ||
* | ||
* @return The partition name | ||
*/ | ||
String name() default ""; | ||
|
||
/** | ||
* Defines the partition predicate to use for fetching jobs for the partition. | ||
* The string <code>{alias}</code> is replaced with the job instance alias. | ||
* The string <code>{partition}</code> is replaced with the zero-based partition number. | ||
* | ||
* @return The partition predicate | ||
*/ | ||
String predicate() default ""; | ||
|
||
/** | ||
* The number of jobs to schedule in parallel within one scheduler transaction. | ||
* | ||
* @return The number of job to schedule | ||
*/ | ||
int processCount() default 1; | ||
|
||
/** | ||
* Defines how many partitions should be created. If the value is greater than 1, | ||
* it will create partitions with a name that is suffixed by the partition number, starting at 0. | ||
* | ||
* @return The number of partitions ot create | ||
*/ | ||
int partitionCount() default 1; | ||
|
||
/** | ||
* The transaction timeout for job processing of the partition. | ||
* When -1, the default transaction timeout is used. | ||
* | ||
* @return The transaction timeout | ||
*/ | ||
int transactionTimeoutMillis() default -1; | ||
|
||
/** | ||
* The amount of seconds to backoff when a job processor throws a {@link JobTemporaryException}. | ||
* When -1, the default temporary error backoff is used. | ||
* | ||
* @return The temporary error backoff | ||
*/ | ||
int temporaryErrorBackoffSeconds() default -1; | ||
|
||
/** | ||
* The amount of seconds to backoff when a job processor throws a {@link JobRateLimitException}. | ||
* When -1, the default rate limit backoff is used. | ||
* | ||
* @return The rate limit backoff | ||
*/ | ||
int rateLimitBackoffSeconds() default -1; | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2018 - 2020 Blazebit. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.blazebit.job; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Container for defining multiple partitions for a {@link JobInstance}. | ||
* | ||
* @author Christian Beikov | ||
* @since 1.0.0 | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Partitions { | ||
|
||
/** | ||
* The partitions for this job instance. | ||
* | ||
* @return The partitions | ||
*/ | ||
Partition[] value() default {}; | ||
|
||
} |
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
37 changes: 37 additions & 0 deletions
37
core/impl/src/main/java/com/blazebit/job/impl/JobSchedulerCancelEvent.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,37 @@ | ||
/* | ||
* Copyright 2018 - 2020 Blazebit. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.blazebit.job.impl; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* @author Christian Beikov | ||
* @since 1.0.0 | ||
*/ | ||
public class JobSchedulerCancelEvent implements Serializable { | ||
|
||
private final Serializable jobInstanceId; | ||
|
||
public JobSchedulerCancelEvent(Serializable jobInstanceId) { | ||
this.jobInstanceId = jobInstanceId; | ||
} | ||
|
||
public Serializable getJobInstanceId() { | ||
return jobInstanceId; | ||
} | ||
|
||
} |
Oops, something went wrong.