1 package net.sf.appstatus.core.services;
2
3 import org.apache.commons.collections.ArrayStack;
4
5
6
7
8
9
10
11
12 public class ServiceMonitorLocator {
13
14 private static final ThreadLocal<ArrayStack> monitorStack = new ThreadLocal<ArrayStack>() {
15 @Override
16 protected ArrayStack initialValue() {
17 return new ArrayStack();
18 }
19 };
20
21 public static IServiceMonitor getCurrentServiceMonitor() {
22 ArrayStack stack = monitorStack.get();
23
24 if (!stack.isEmpty()) {
25 return (IServiceMonitor) stack.peek();
26 }
27
28 return null;
29 }
30
31 public static ArrayStack getServiceMonitorStack() {
32 return monitorStack.get();
33 }
34
35 }