Added some JMX support.
[jsvc.git] / src / dolda / jsvc / jmx / Context.java
1 package dolda.jsvc.jmx;
2
3 import javax.management.*;
4 import java.util.*;
5 import dolda.jsvc.*;
6
7 public class Context implements ContextMBean {
8     public final ObjectName name;
9     private final ThreadContext b;
10     
11     public Context(ThreadContext ctx) {
12         this.b = ctx;
13         Hashtable<String, String> info = new Hashtable<String, String>();
14         info.put("type", "Context");
15         info.put("name", getname());
16         try {
17             name = new ObjectName("dolda.jsvc", info);
18         } catch(MalformedObjectNameException e) {
19             throw(new RuntimeException(e));
20         }
21     }
22     
23     public long getrequests() {
24         return(b.requests());
25     }
26     
27     public String getname() {
28         return(b.server().name());
29     }
30 }