[
https://issues.apache.org/jira/browse/EAGLE-935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15896905#comment-15896905
]
ASF GitHub Bot commented on EAGLE-935:
--------------------------------------
Github user haoch commented on a diff in the pull request:
https://github.com/apache/eagle/pull/854#discussion_r104364892
--- Diff:
eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationSimulatorImpl.java
---
@@ -74,24 +75,25 @@ public void start(String appType, Map<String, Object>
appConfig) {
// Start application
applicationResource.startApplication(new
ApplicationOperations.StartOperation(applicationEntity.getUuid()));
statusUpdateService.updateApplicationEntityStatus(applicationEntity);
- applicationResource.stopApplication(new
ApplicationOperations.StopOperation(applicationEntity.getUuid()));
- int attempt = 0;
- while (attempt < 10) {
- attempt++;
-
statusUpdateService.updateApplicationEntityStatus(applicationEntity);
- if (applicationEntity.getStatus() ==
ApplicationEntity.Status.STOPPED
- || applicationEntity.getStatus() ==
ApplicationEntity.Status.INITIALIZED) {
- break;
- } else {
+ Semaphore semp = new Semaphore(1);
+ Thread stopThread = new Thread(() -> {
+ applicationResource.stopApplication(new
ApplicationOperations.StopOperation(applicationEntity.getUuid()));
+ while (applicationEntity.getStatus() !=
ApplicationEntity.Status.INITIALIZED
+ && applicationEntity.getStatus() !=
ApplicationEntity.Status.STOPPED) {
+
statusUpdateService.updateApplicationEntityStatus(applicationEntity);
try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- // Ignore
+ Thread.sleep(1000);
+ } catch (Exception e) {
}
}
- }
- if (attempt >= 10 ) {
- throw new IllegalStateException("Application status didn't
become STOPPED in 10 attempts");
+ semp.release();
+ });
+ stopThread.start();
+ try {
+ stopThread.join();
+ semp.acquire();
--- End diff --
Add `timeout`
> send alerts if finished job duration exceeds average duration
> -------------------------------------------------------------
>
> Key: EAGLE-935
> URL: https://issues.apache.org/jira/browse/EAGLE-935
> Project: Eagle
> Issue Type: New Feature
> Reporter: wujinhu
> Assignee: wujinhu
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)