-
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.
fixup! Create JobKitWatchdog, clean SpoolerTest and BackgroundService…
…EventTest #140
- Loading branch information
Showing
6 changed files
with
147 additions
and
57 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
48 changes: 48 additions & 0 deletions
48
jobkit/springboot-service/src/main/java/tv/hd3g/jobkit/mod/JobKitWatchdogConfig.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,48 @@ | ||
/* | ||
* This file is part of jobkit. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* Copyright (C) hdsdi3g for hd3g.tv 2023 | ||
* | ||
*/ | ||
package tv.hd3g.jobkit.mod; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
import lombok.Data; | ||
import tv.hd3g.jobkit.engine.watchdog.LimitedExecTimePolicy; | ||
import tv.hd3g.jobkit.engine.watchdog.LimitedServiceExecTimePolicy; | ||
import tv.hd3g.jobkit.engine.watchdog.MaxSpoolQueueSizePolicy; | ||
|
||
@Configuration | ||
@ConfigurationProperties(prefix = "jobkit.watchdogpolicies") | ||
@Data | ||
public class JobKitWatchdogConfig { | ||
|
||
private List<MaxSpoolQueueSizePolicy> maxSpoolQueueSize; | ||
private List<LimitedExecTimePolicy> limitedExecTime; | ||
private List<LimitedServiceExecTimePolicy> limitedServiceExecTime; | ||
|
||
@PostConstruct | ||
void init() { | ||
maxSpoolQueueSize = Optional.ofNullable(maxSpoolQueueSize).orElse(new ArrayList<>()); | ||
limitedExecTime = Optional.ofNullable(limitedExecTime).orElse(new ArrayList<>()); | ||
limitedServiceExecTime = Optional.ofNullable(limitedServiceExecTime).orElse(new ArrayList<>()); | ||
} | ||
|
||
} |
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
jobkit/springboot-service/src/test/resources/application-watchdogpolicies.yml
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 @@ | ||
spring: | ||
main: | ||
banner-mode: "off" | ||
log-startup-info: false | ||
web-application-type: none | ||
|
||
jobkit: | ||
watchdogpolicies: | ||
maxSpoolQueueSize: | ||
- maxSize: 10 | ||
onlySpools: ["AA"] | ||
limitedExecTime: | ||
- maxExecTime: 10s | ||
onlySpools: ["BB"] | ||
limitedServiceExecTime: | ||
- waitFactor: 5 | ||
onlySpools: ["CC"] |
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