1 |
package dk.thoerup.traininfoservice; |
package dk.thoerup.traininfoservice; |
2 |
|
|
3 |
|
import java.util.logging.Logger; |
4 |
|
|
5 |
|
import javax.servlet.ServletContext; |
6 |
|
|
7 |
import dk.thoerup.circuitbreaker.config.BreakerConfig; |
import dk.thoerup.circuitbreaker.config.BreakerConfig; |
8 |
import dk.thoerup.webconfig.ConfigVariable; |
import dk.thoerup.webconfig.ConfigVariable; |
9 |
import dk.thoerup.webconfig.ReloadConfig; |
import dk.thoerup.webconfig.ContextConfigLoader; |
10 |
|
import dk.thoerup.webconfig.ReloadConfigMethod; |
11 |
|
|
12 |
|
|
13 |
public class TraininfoSettings implements BreakerConfig{ |
public class TraininfoSettings implements BreakerConfig{ |
14 |
|
public enum Backend { |
15 |
|
Azure, |
16 |
|
Mobile |
17 |
|
} |
18 |
|
|
19 |
|
Logger logger = Logger.getLogger(TraininfoSettings.class.getName() ); |
20 |
|
|
21 |
@ConfigVariable |
@ConfigVariable |
22 |
boolean useazuresite; |
Backend backend; |
23 |
|
|
24 |
@ConfigVariable(description = "Circuitbreaker", readonly = true) |
@ConfigVariable(description = "Circuitbreaker", readonly = true) |
25 |
int banedk_threshold; |
int banedk_threshold; |
36 |
@ConfigVariable |
@ConfigVariable |
37 |
int reply_timeout; |
int reply_timeout; |
38 |
|
|
|
@ReloadConfig |
|
|
public void reloadConfig() { |
|
|
System.out.println("Reloading config"); |
|
|
|
|
|
} |
|
39 |
|
|
40 |
public boolean getUseAzureSite() { |
public Backend getBackend() { |
41 |
return useazuresite; |
return backend; |
42 |
} |
} |
43 |
|
|
44 |
|
|
53 |
public int getReplyTimeout() { |
public int getReplyTimeout() { |
54 |
return reply_timeout; |
return reply_timeout; |
55 |
} |
} |
|
|
|
56 |
|
|
57 |
@Override |
@Override |
58 |
public int getTreshold() { |
public int getTreshold() { |