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 e8d2c16
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
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 final AtomicBoolean isStopped = new AtomicBoolean(false);

private ManagedResourceBuilder managedResourceBuilder;
private ManagedResource managedResource;
private String serviceName;
Expand Down Expand Up @@ -206,7 +210,7 @@ public void start() {
*/
@Override
public void stop() {
if (!isRunning()) {
if (isStopped.get() || !isRunning()) {
return;
}

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

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

/**
Expand Down

0 comments on commit e8d2c16

Please sign in to comment.