01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.l2.state;
06:
07: import com.tc.config.schema.NewHaConfig;
08:
09: public class StateManagerConfigImpl implements StateManagerConfig {
10:
11: private final NewHaConfig haConfig;
12:
13: public StateManagerConfigImpl(NewHaConfig haConfig) {
14: this .haConfig = haConfig;
15: }
16:
17: public int getElectionTimeInSecs() {
18: int electionTime = -1;
19:
20: if (haConfig.isNetworkedActivePassive()) {
21: electionTime = haConfig.electionTime().getInt();
22: } else {
23: throw new AssertionError(
24: "Networked Active Passive is not enabled in config");
25: }
26:
27: if (electionTime <= 0) {
28: throw new AssertionError(
29: "Election time has to be a positive integer, but is set to "
30: + electionTime + " secs. in config");
31: }
32:
33: return electionTime;
34: }
35:
36: }
|