01: package vicazh.hyperpool.stream.net.http;
02:
03: import java.io.*;
04: import java.util.*;
05: import vicazh.hyperpool.*;
06: import vicazh.hyperpool.stream.Connection;
07:
08: /**
09: * The monitor service
10: *
11: * @author Victor Zhigunov
12: * @version 0.4.0
13: */
14: public class MonitorService extends Service implements
15: MonitorServiceMBean {
16: public Connection getConnection() {
17: return new MonitorConnection(this );
18: }
19:
20: public void setAttribute(String name, Object value)
21: throws Exception {
22: if (name.equals(ElementMBean.INIT)) {
23: List<Object> list = new ArrayList<Object>();
24: for (Connection c : getConnections())
25: list.add(new MonitorItem((MonitorConnection) c));
26: super .setAttribute(name, list);
27: } else
28: for (Connection c : getConnections())
29: if (c.hashCode() == (Integer) value) {
30: try {
31: c.getClient().close();
32: } catch (IOException e) {
33: }
34: break;
35: }
36: }
37: }
|