-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove stopping Infinispan by Rest API
- Loading branch information
1 parent
c9f1954
commit ef9b074
Showing
1 changed file
with
0 additions
and
37 deletions.
There are no files selected for viewing
37 changes: 0 additions & 37 deletions
37
plugins/infinispan110/src/main/java/org/radargun/service/Infinispan110ServerLifecycle.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 |
---|---|---|
@@ -1,46 +1,9 @@ | ||
package org.radargun.service; | ||
|
||
import java.util.concurrent.ExecutionException; | ||
|
||
import org.radargun.traits.Clustered; | ||
|
||
public class Infinispan110ServerLifecycle extends Infinispan100ServerLifecycle { | ||
|
||
public Infinispan110ServerLifecycle(InfinispanServerService service) { | ||
super(service); | ||
} | ||
|
||
@Override | ||
protected void stopInternal() { | ||
Clustered clustered = this.service.getClustered(); | ||
if (clustered == null) { | ||
throw new NullPointerException("clustered cannot be null"); | ||
} | ||
if (clustered instanceof Infinispan100ServerClustered) { | ||
Infinispan100ServerClustered innerClustered = (Infinispan100ServerClustered) clustered; | ||
innerClustered.getRestAPI().stopCluster(service.stopTimeout); | ||
// the stop request return as fast as possible | ||
long now = System.currentTimeMillis(); | ||
while (System.currentTimeMillis() - now < service.stopTimeout) { | ||
try { | ||
Thread.sleep(1000); | ||
try { | ||
innerClustered.getRestAPI().info(); | ||
} catch (ExecutionException e) { | ||
// we should kill the inherited process | ||
super.stopInternal(); | ||
break; | ||
} | ||
} catch (InterruptedException e) { | ||
throw new IllegalStateException("InterruptedException", e); | ||
} | ||
} | ||
// if the server still alive, fail | ||
if (this.service.getLifecycle().isRunning()) { | ||
throw new IllegalStateException("Error while stopping the server. The server is still running"); | ||
} | ||
} else { | ||
throw new IllegalStateException("service.clustered should extends Infinispan100ServerClustered"); | ||
} | ||
} | ||
} |