1 package org.apache.helix.participant;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.List;
23
24 import org.apache.helix.HelixConstants.ChangeType;
25 import org.apache.helix.participant.statemachine.StateModelFactory;
26
27
28 public class GenericLeaderStandbyStateModelFactory
29 extends StateModelFactory<GenericLeaderStandbyModel>
30 {
31 private final CustomCodeCallbackHandler _callback;
32 private final List<ChangeType> _notificationTypes;
33 public GenericLeaderStandbyStateModelFactory(CustomCodeCallbackHandler callback,
34 List<ChangeType> notificationTypes)
35 {
36 if (callback == null || notificationTypes == null || notificationTypes.size() == 0)
37 {
38 throw new IllegalArgumentException("Require: callback | notificationTypes");
39 }
40 _callback = callback;
41 _notificationTypes = notificationTypes;
42 }
43
44 @Override
45 public GenericLeaderStandbyModel createNewStateModel(String partitionKey)
46 {
47 return new GenericLeaderStandbyModel(_callback, _notificationTypes, partitionKey);
48 }
49 }