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 <joewitt@apache.org>
This commit is contained in:
Mark Payne 2015-12-18 17:06:11 -05:00 committed by joewitt
parent 43c7ecd221
commit 0a58ab47b9
1 changed files with 5 additions and 1 deletions

View File

@ -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()) {