From b8375a681a360152c8fb7d80d238fa572d0f36eb Mon Sep 17 00:00:00 2001 From: Koji Kawamura Date: Thu, 14 Dec 2017 17:23:25 +0900 Subject: [PATCH] NIFI-3377: NiFi RPG errors when switching between transport protocols. This closes #2340. --- .../org/apache/nifi/remote/StandardRemoteGroupPort.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java index 6802436a63..1f9f60012d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java @@ -42,6 +42,7 @@ import org.apache.nifi.remote.exception.ProtocolException; import org.apache.nifi.remote.exception.UnknownPortException; import org.apache.nifi.remote.exception.UnreachableClusterException; import org.apache.nifi.remote.protocol.DataPacket; +import org.apache.nifi.remote.protocol.SiteToSiteTransportProtocol; import org.apache.nifi.remote.protocol.http.HttpProxy; import org.apache.nifi.remote.util.SiteToSiteRestApiClient; import org.apache.nifi.remote.util.StandardDataPacket; @@ -124,9 +125,9 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { this.targetId = targetId; } - private static File getPeerPersistenceFile(final String portId, final NiFiProperties nifiProperties) { + private static File getPeerPersistenceFile(final String portId, final NiFiProperties nifiProperties, final SiteToSiteTransportProtocol transportProtocol) { final File stateDir = nifiProperties.getPersistentStateDirectory(); - return new File(stateDir, portId + ".peers"); + return new File(stateDir, String.format("%s_%s.peers", portId, transportProtocol.name())); } @Override @@ -180,7 +181,7 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { .sslContext(sslContext) .useCompression(isUseCompression()) .eventReporter(remoteGroup.getEventReporter()) - .peerPersistenceFile(getPeerPersistenceFile(getIdentifier(), nifiProperties)) + .peerPersistenceFile(getPeerPersistenceFile(getIdentifier(), nifiProperties, remoteGroup.getTransportProtocol())) .nodePenalizationPeriod(penalizationMillis, TimeUnit.MILLISECONDS) .timeout(remoteGroup.getCommunicationsTimeout(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS) .transportProtocol(remoteGroup.getTransportProtocol())