-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25408 from machi1990/fix/25214
Make sure that disabled jobs are paused in Quartz
- Loading branch information
Showing
5 changed files
with
75 additions
and
0 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
28 changes: 28 additions & 0 deletions
28
integration-tests/quartz/src/main/java/io/quarkus/it/quartz/DisabledMethodResource.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,28 @@ | ||
package io.quarkus.it.quartz; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
@Path("/scheduler/disabled") | ||
public class DisabledMethodResource { | ||
|
||
@Inject | ||
DisabledScheduledMethods disabledScheduledMethods; | ||
|
||
@GET | ||
@Path("cron") | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String getCronCount() { | ||
return disabledScheduledMethods.valueSetByCronScheduledMethod; | ||
} | ||
|
||
@GET | ||
@Path("every") | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String getEveryCount() { | ||
return disabledScheduledMethods.valueSetByEveryScheduledMethod; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
integration-tests/quartz/src/main/java/io/quarkus/it/quartz/DisabledScheduledMethods.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,24 @@ | ||
package io.quarkus.it.quartz; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkus.scheduler.Scheduled; | ||
|
||
@ApplicationScoped | ||
public class DisabledScheduledMethods { | ||
volatile static String valueSetByCronScheduledMethod = ""; | ||
volatile static String valueSetByEveryScheduledMethod = ""; | ||
|
||
// This should never be called as the job is disabled | ||
@Scheduled(cron = "${disabled}", identity = "disabled-cron-counter") | ||
void setValueByCron() { | ||
valueSetByCronScheduledMethod = "cron"; | ||
} | ||
|
||
// This should never be called as the job is turned off | ||
@Scheduled(every = "${off}", identity = "disabled-every-counter") | ||
void setValueByEvery() { | ||
valueSetByEveryScheduledMethod = "every"; | ||
} | ||
|
||
} |
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