NIFI-7590 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).

NIFI-7590 Removed 'CassandraSessionProvider.onStopped'.

This closes #4373.

Signed-off-by: Peter Turcsanyi <turcsanyi@apache.org>
This commit is contained in:
Tamas Palfy 2020-06-30 17:36:18 +02:00 committed by Peter Turcsanyi
parent 045027892a
commit 197df577ac
1 changed files with 2 additions and 11 deletions

View File

@ -33,7 +33,6 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.annotation.lifecycle.OnDisabled; import org.apache.nifi.annotation.lifecycle.OnDisabled;
import org.apache.nifi.annotation.lifecycle.OnEnabled; 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.authentication.exception.ProviderCreationException;
import org.apache.nifi.cassandra.CassandraSessionProviderService; import org.apache.nifi.cassandra.CassandraSessionProviderService;
import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.PropertyDescriptor;
@ -182,19 +181,11 @@ public class CassandraSessionProvider extends AbstractControllerService implemen
public void onDisabled(){ public void onDisabled(){
if (cassandraSession != null) { if (cassandraSession != null) {
cassandraSession.close(); cassandraSession.close();
cassandraSession = null;
} }
if (cluster != null) { if (cluster != null) {
cluster.close(); cluster.close();
} cluster = null;
}
@OnStopped
public void onStopped() {
if (cassandraSession != null) {
cassandraSession.close();
}
if (cluster != null) {
cluster.close();
} }
} }