01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package javax.management;
10:
11: import java.io.Serializable;
12:
13: /**
14: * The base class for QueryExp implementations.
15: *
16: * @version $Revision: 1.7 $
17: */
18: public abstract class QueryEval implements Serializable {
19: private static final long serialVersionUID = 2675899265640874796L;
20:
21: private transient MBeanServer server;
22: private static ThreadLocal serverPerThread = new ThreadLocal();
23:
24: /**
25: * Sets the MBeanServer used by the QueryExp implementation to evaluate the expression.
26: */
27: public void setMBeanServer(MBeanServer server) {
28: this .server = server;
29: serverPerThread.set(server);
30: }
31:
32: /**
33: * Returns the MBeanServer used by the QueryExp implementation to evaluate the expression.
34: * This method is static for a mistake in the JMX spec, should not be needed, but it's implemented
35: * for sake of compatibility.
36: */
37: public static MBeanServer getMBeanServer() {
38: return (MBeanServer) serverPerThread.get();
39: }
40: }
|