Repository: nifi
Updated Branches:
  refs/heads/master 43c7ecd22 -> 0a58ab47b


NIFI-1310: Do not yield context when encountering IOException and fixed bug 
that caused the penalization period for a node not to get set

Signed-off-by: joewitt <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/0a58ab47
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/0a58ab47
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/0a58ab47

Branch: refs/heads/master
Commit: 0a58ab47b96d1fdf5e283f4f7d0fa2a27f06d1c4
Parents: 43c7ecd
Author: Mark Payne <[email protected]>
Authored: Fri Dec 18 17:06:11 2015 -0500
Committer: joewitt <[email protected]>
Committed: Fri Dec 18 17:35:46 2015 -0500

----------------------------------------------------------------------
 .../java/org/apache/nifi/remote/StandardRemoteGroupPort.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/0a58ab47/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java
----------------------------------------------------------------------
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 773f9cf..d8f130e 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
@@ -125,12 +125,15 @@ public class StandardRemoteGroupPort extends 
RemoteGroupPort {
     public void onSchedulingStart() {
         super.onSchedulingStart();
 
+        final long penalizationMillis = 
FormatUtils.getTimeDuration(remoteGroup.getYieldDuration(), 
TimeUnit.MILLISECONDS);
+
         final SiteToSiteClient client = new SiteToSiteClient.Builder()
         .url(remoteGroup.getTargetUri().toString())
         .portIdentifier(getIdentifier())
         .sslContext(sslContext)
         .eventReporter(remoteGroup.getEventReporter())
         .peerPersistenceFile(getPeerPersistenceFile(getIdentifier()))
+        .nodePenalizationPeriod(penalizationMillis, TimeUnit.MILLISECONDS)
         .build();
         clientRef.set(client);
     }
@@ -182,7 +185,8 @@ public class StandardRemoteGroupPort extends 
RemoteGroupPort {
             remoteGroup.getEventReporter().reportEvent(Severity.ERROR, 
CATEGORY, message);
             return;
         } catch (final IOException e) {
-            context.yield();
+            // we do not yield here because the 'peer' will be penalized, and 
we won't communicate with that particular nifi instance
+            // for a while due to penalization, but we can continue to talk to 
other nifi instances
             final String message = String.format("%s failed to communicate 
with %s due to %s", this, url, e.toString());
             logger.error(message);
             if (logger.isDebugEnabled()) {

Reply via email to