Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for a failing Kafka operator job #595

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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 @@ -117,7 +120,10 @@ public T withProperty(String key, Supplier<String> value) {
}

@Override
public boolean isRunning() {
public synchronized boolean isRunning() {
if (isStopped) {
return false;
}
Log.debug(this, "Checking if resource is running");
if (managedResource == null) {
Log.debug(this, "Resource is not running");
Expand Down Expand Up @@ -205,7 +211,7 @@ public void start() {
* Stop the Quarkus application.
*/
@Override
public void stop() {
public synchronized void stop() {
if (!isRunning()) {
return;
}
Expand All @@ -215,6 +221,7 @@ public void stop() {
managedResource.stop();

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

/**
Expand Down