Skip to content

Commit

Permalink
Remove stopping Infinispan by Rest API
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolovison authored and Crumby committed Oct 7, 2022
1 parent c9f1954 commit ef9b074
Showing 1 changed file with 0 additions and 37 deletions.
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");
}
}
}

0 comments on commit ef9b074

Please sign in to comment.