1) add a log line on plumber creation to make it easier to know what rejection policy is being used.

This commit is contained in:
Eric Tschetter 2012-11-27 11:12:28 -06:00
parent 790ba59244
commit 1e35913579
1 changed files with 15 additions and 2 deletions

View File

@ -242,6 +242,7 @@ public class RealtimePlumberSchool implements PlumberSchool
final long truncatedNow = segmentGranularity.truncate(new DateTime()).getMillis(); final long truncatedNow = segmentGranularity.truncate(new DateTime()).getMillis();
final long windowMillis = windowPeriod.toStandardDuration().getMillis(); final long windowMillis = windowPeriod.toStandardDuration().getMillis();
final RejectionPolicy rejectionPolicy = rejectionPolicyFactory.create(windowPeriod); final RejectionPolicy rejectionPolicy = rejectionPolicyFactory.create(windowPeriod);
log.info("Creating plumber using rejectionPolicy[%s]", rejectionPolicy);
log.info( log.info(
"Expect to run at [%s]", "Expect to run at [%s]",
@ -553,7 +554,7 @@ public class RealtimePlumberSchool implements PlumberSchool
public class ServerTimeRejectionPolicyFactory implements RejectionPolicyFactory public class ServerTimeRejectionPolicyFactory implements RejectionPolicyFactory
{ {
@Override @Override
public RejectionPolicy create(Period windowPeriod) public RejectionPolicy create(final Period windowPeriod)
{ {
final long windowMillis = windowPeriod.toStandardDuration().getMillis(); final long windowMillis = windowPeriod.toStandardDuration().getMillis();
@ -570,6 +571,12 @@ public class RealtimePlumberSchool implements PlumberSchool
{ {
return timestamp >= (System.currentTimeMillis() - windowMillis); return timestamp >= (System.currentTimeMillis() - windowMillis);
} }
@Override
public String toString()
{
return String.format("serverTime-%s", windowPeriod);
}
}; };
} }
} }
@ -577,7 +584,7 @@ public class RealtimePlumberSchool implements PlumberSchool
public class MessageTimeRejectionPolicyFactory implements RejectionPolicyFactory public class MessageTimeRejectionPolicyFactory implements RejectionPolicyFactory
{ {
@Override @Override
public RejectionPolicy create(Period windowPeriod) public RejectionPolicy create(final Period windowPeriod)
{ {
final long windowMillis = windowPeriod.toStandardDuration().getMillis(); final long windowMillis = windowPeriod.toStandardDuration().getMillis();
@ -598,6 +605,12 @@ public class RealtimePlumberSchool implements PlumberSchool
return timestamp >= (maxTimestamp - windowMillis); return timestamp >= (maxTimestamp - windowMillis);
} }
@Override
public String toString()
{
return String.format("messageTime-%s", windowPeriod);
}
}; };
} }
} }