blob: e5a8e3c78eea597fe234492b97dadce36075bbb6 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package sun.jvmstat.perfdata.monitor.protocol.file;
27
28import sun.jvmstat.monitor.*;
29import sun.jvmstat.monitor.event.HostListener;
30import sun.jvmstat.perfdata.monitor.*;
31import java.util.*;
32import java.net.*;
33
34/**
35 * Concrete implementation of the MonitoredHost interface for the
36 * <em>file:</em> protocol of the HotSpot PerfData monitoring implementation.
37 *
38 * @author Brian Doherty
39 * @since 1.5
40 */
41public class MonitoredHostProvider extends MonitoredHost {
42
43 /**
44 * The default polling interval. Not used by the <em>file:</em> protocol.
45 */
46 public static final int DEFAULT_POLLING_INTERVAL = 0;
47
48 /**
49 * Create a MonitoredHostProvider instance using the given HostIdentifier.
50 *
51 * @param hostId the host identifier for this MonitoredHost
52 */
53 public MonitoredHostProvider(HostIdentifier hostId) {
54 this.hostId = hostId;
55 }
56
57 /**
58 * {@inheritDoc}
59 */
60 public MonitoredVm getMonitoredVm(VmIdentifier vmid)
61 throws MonitorException {
62 return getMonitoredVm(vmid, DEFAULT_POLLING_INTERVAL);
63 }
64
65 /**
66 * {@inheritDoc}.
67 * <p>
68 * Note - the <em>file:</em> protocol silently ignores the
69 * <tt>interval</tt> parameter.
70 */
71 public MonitoredVm getMonitoredVm(VmIdentifier vmid, int interval)
72 throws MonitorException {
73 // don't attempt to resolve 'file:' based vmid
74 return new FileMonitoredVm(vmid, interval);
75 }
76
77 /**
78 * {@inheritDoc}
79 */
80 public void detach(MonitoredVm vm) {
81 vm.detach();
82 }
83
84 /**
85 * {@inheritDoc}.
86 * <p>
87 * Note - the <em>file:</em> protocol currenly does not support
88 * registration or notification of event listeners. This method
89 * silently ignores the add request.
90 */
91 public void addHostListener(HostListener listener) {
92 // no HostListener support for 'file:' based VmIdentifiers
93 }
94
95 /**
96 * {@inheritDoc}.
97 * <p>
98 * Note - the <em>file:</em> protocol currenly does not support
99 * registration or notification of event listeners. This method
100 * silently ignores the remove request.
101 */
102 public void removeHostListener(HostListener listener) {
103 // no HostListener support for 'file:' based VmIdentifiers
104 }
105
106 /**
107 * {@inheritDoc}.
108 * <p>
109 * Note - the <em>file:</em> protocol currently does not support the
110 * notion of tracking active or inactive Java Virtual Machines. This
111 * method currently returns an empty set.
112 */
113 public Set<Integer> activeVms() {
114 return new HashSet<Integer>(0);
115 }
116}