In 'CassandraSessionProvider.onDisabled' setting Cassandra-related references properly to null after closing them so that they can be renewed in 'onEnabled' (which creates them only if set to 'null', leaving them closed otherwise).
Removed 'CassandraSessionProvider.onStopped'.
This closes
@@ -33,7 +33,6 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.annotation.lifecycle.OnDisabled;
import org.apache.nifi.annotation.lifecycle.OnEnabled;
-import org.apache.nifi.annotation.lifecycle.OnStopped;
import org.apache.nifi.authentication.exception.ProviderCreationException;
import org.apache.nifi.cassandra.CassandraSessionProviderService;
import org.apache.nifi.components.PropertyDescriptor;
@@ -182,19 +181,11 @@ public class CassandraSessionProvider extends AbstractControllerService implemen
public void onDisabled(){
if (cassandraSession != null) {
cassandraSession.close();
+ cassandraSession = null;
}
if (cluster != null) {
cluster.close();
- }
- }
-
- @OnStopped
- public void onStopped() {
- if (cassandraSession != null) {
- cassandraSession.close();
- }
- if (cluster != null) {
- cluster.close();
+ cluster = null;
}
}
