support both rejectionPolicy and rejectionPolicyFactory in serde

This commit is contained in:
fjy 2014-08-07 10:06:27 -07:00
parent 0bd871e4f5
commit 91ebe45b4e
8 changed files with 15 additions and 6 deletions

View File

@ -115,7 +115,8 @@ public class RealtimeIndexTask extends AbstractTask
@JsonProperty("windowPeriod") Period windowPeriod, @JsonProperty("windowPeriod") Period windowPeriod,
@JsonProperty("maxPendingPersists") int maxPendingPersists, @JsonProperty("maxPendingPersists") int maxPendingPersists,
@JsonProperty("segmentGranularity") Granularity segmentGranularity, @JsonProperty("segmentGranularity") Granularity segmentGranularity,
@JsonProperty("rejectionPolicy") RejectionPolicyFactory rejectionPolicyFactory @JsonProperty("rejectionPolicy") RejectionPolicyFactory rejectionPolicy,
@JsonProperty("rejectionPolicyFactory") RejectionPolicyFactory rejectionPolicyFactory
) )
{ {
super( super(
@ -142,7 +143,7 @@ public class RealtimeIndexTask extends AbstractTask
windowPeriod, windowPeriod,
null, null,
null, null,
rejectionPolicyFactory, rejectionPolicy == null ? rejectionPolicyFactory : rejectionPolicy,
maxPendingPersists, maxPendingPersists,
spec.getShardSpec() spec.getShardSpec()
), ),
@ -315,6 +316,7 @@ public class RealtimeIndexTask extends AbstractTask
null, null,
null, null,
null, null,
null,
0 0
); );

View File

@ -54,6 +54,7 @@ public class TestRealtimeTask extends RealtimeIndexTask
null, null,
1, 1,
null, null,
null,
null null
); );
this.status = status; this.status = status;

View File

@ -207,6 +207,7 @@ public class TaskSerdeTest
new Period("PT10M"), new Period("PT10M"),
1, 1,
Granularity.HOUR, Granularity.HOUR,
null,
null null
); );

View File

@ -49,6 +49,7 @@ public class TaskAnnouncementTest
new Period("PT10M"), new Period("PT10M"),
1, 1,
Granularity.HOUR, Granularity.HOUR,
null,
null null
); );
final TaskStatus status = TaskStatus.running(task.getId()); final TaskStatus status = TaskStatus.running(task.getId());

View File

@ -65,7 +65,8 @@ public class FlushingPlumberSchool extends RealtimePlumberSchool
@JsonProperty("basePersistDirectory") File basePersistDirectory, @JsonProperty("basePersistDirectory") File basePersistDirectory,
@JsonProperty("segmentGranularity") Granularity segmentGranularity, @JsonProperty("segmentGranularity") Granularity segmentGranularity,
@JsonProperty("versioningPolicy") VersioningPolicy versioningPolicy, @JsonProperty("versioningPolicy") VersioningPolicy versioningPolicy,
@JsonProperty("rejectionPolicy") RejectionPolicyFactory rejectionPolicyFactory, @JsonProperty("rejectionPolicy") RejectionPolicyFactory rejectionPolicy,
@JsonProperty("rejectionPolicyFactory") RejectionPolicyFactory rejectionPolicyFactory,
@JsonProperty("maxPendingPersists") int maxPendingPersists @JsonProperty("maxPendingPersists") int maxPendingPersists
) )
{ {
@ -81,6 +82,7 @@ public class FlushingPlumberSchool extends RealtimePlumberSchool
basePersistDirectory, basePersistDirectory,
segmentGranularity, segmentGranularity,
versioningPolicy, versioningPolicy,
rejectionPolicy,
rejectionPolicyFactory, rejectionPolicyFactory,
maxPendingPersists maxPendingPersists
); );

View File

@ -75,7 +75,8 @@ public class RealtimePlumberSchool implements PlumberSchool
@JsonProperty("basePersistDirectory") File basePersistDirectory, @JsonProperty("basePersistDirectory") File basePersistDirectory,
@JsonProperty("segmentGranularity") Granularity segmentGranularity, @JsonProperty("segmentGranularity") Granularity segmentGranularity,
@JsonProperty("versioningPolicy") VersioningPolicy versioningPolicy, @JsonProperty("versioningPolicy") VersioningPolicy versioningPolicy,
@JsonProperty("rejectionPolicy") RejectionPolicyFactory rejectionPolicyFactory, @JsonProperty("rejectionPolicy") RejectionPolicyFactory rejectionPolicy,
@JsonProperty("rejectionPolicyFactory") RejectionPolicyFactory rejectionPolicyFactory,
@JsonProperty("maxPendingPersists") int maxPendingPersists @JsonProperty("maxPendingPersists") int maxPendingPersists
) )
{ {
@ -90,7 +91,7 @@ public class RealtimePlumberSchool implements PlumberSchool
this.basePersistDirectory = basePersistDirectory; this.basePersistDirectory = basePersistDirectory;
this.segmentGranularity = segmentGranularity; this.segmentGranularity = segmentGranularity;
this.versioningPolicy = versioningPolicy; this.versioningPolicy = versioningPolicy;
this.rejectionPolicyFactory = rejectionPolicyFactory; this.rejectionPolicyFactory = (rejectionPolicy == null) ? rejectionPolicyFactory : rejectionPolicy;
this.maxPendingPersists = maxPendingPersists; this.maxPendingPersists = maxPendingPersists;
} }

View File

@ -73,7 +73,7 @@ public class FireDepartmentTest
new RealtimeIOConfig( new RealtimeIOConfig(
null, null,
new RealtimePlumberSchool( new RealtimePlumberSchool(
null, null, null, null, null, null, null, null, null, null, null, null, 0 null, null, null, null, null, null, null, null, null, null, null, null, null, 0
) )
), ),
new RealtimeTuningConfig( new RealtimeTuningConfig(

View File

@ -149,6 +149,7 @@ public class RealtimePlumberSchoolTest
Granularity.HOUR, Granularity.HOUR,
new IntervalStartVersioningPolicy(), new IntervalStartVersioningPolicy(),
new NoopRejectionPolicyFactory(), new NoopRejectionPolicyFactory(),
null,
0 0
); );