forked from box/mojito
-
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.
- Loading branch information
Showing
6 changed files
with
136 additions
and
26 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
17 changes: 17 additions & 0 deletions
17
webapp/src/main/java/com/box/l10n/mojito/quartz/QuartzQueue.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,17 @@ | ||
package com.box.l10n.mojito.quartz; | ||
|
||
public enum QuartzQueue { | ||
LOW_PRIORITY("Low priority"), | ||
DEFAULT("Default"), | ||
HIGH_PRIORITY("High priority"); | ||
|
||
private String description; | ||
|
||
QuartzQueue(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
webapp/src/main/java/com/box/l10n/mojito/quartz/QuartzSchedulerManager.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,34 @@ | ||
package com.box.l10n.mojito.quartz; | ||
|
||
import org.quartz.Scheduler; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class QuartzSchedulerManager { | ||
|
||
@Autowired | ||
@Qualifier("lowPriorityScheduler") | ||
Scheduler lowPriorityScheduler; | ||
|
||
@Autowired | ||
@Qualifier("defaultScheduler") | ||
Scheduler defaultScheduler; | ||
|
||
@Autowired | ||
@Qualifier("highPriorityScheduler") | ||
Scheduler highPriorityScheduler; | ||
|
||
public Scheduler getScheduler(QuartzQueue quartzQueue) { | ||
switch (quartzQueue) { | ||
case LOW_PRIORITY: | ||
return lowPriorityScheduler; | ||
case HIGH_PRIORITY: | ||
return highPriorityScheduler; | ||
case DEFAULT: | ||
default: | ||
return defaultScheduler; | ||
} | ||
} | ||
} |
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