Skip to content

Commit

Permalink
Fix for a failing Kafka operator job
Browse files Browse the repository at this point in the history
  • Loading branch information
fedinskiy committed Oct 13, 2022
1 parent 9a42e79 commit 9782ec4
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -13,6 +13,7 @@
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import java.util.stream.Stream;

Expand Down Expand Up @@ -41,6 +42,9 @@ public class BaseService<T extends Service> implements Service {
private final Map<String, String> properties = new HashMap<>();
private final List<Runnable> futureProperties = new LinkedList<>();

//TODO workaround for https://github.com/fabric8io/kubernetes-client/issues/4491
private volatile boolean isStopped = false;

private ManagedResourceBuilder managedResourceBuilder;
private ManagedResource managedResource;
private String serviceName;
Expand Down Expand Up @@ -205,8 +209,8 @@ public void start() {
* Stop the Quarkus application.
*/
@Override
public void stop() {
if (!isRunning()) {
public synchronized void stop() {
if (isStopped || !isRunning()) {
return;
}

Expand All @@ -215,6 +219,7 @@ public void stop() {
managedResource.stop();

Log.info(this, "Service stopped (%s)", getDisplayName());
isStopped= true;
}

/**
Expand Down

0 comments on commit 9782ec4

Please sign in to comment.