152 * version.
153 *
154 * @param bb the ByteBuffer that references the instrumentation data.
155 * @param lvmid the Local Java Virtual Machine identifier for this
156 * instrumentation buffer.
157 *
158 * @throws MonitorException
159 */
160 protected void createPerfDataBuffer(ByteBuffer bb, int lvmid)
161 throws MonitorException {
162 int majorVersion = AbstractPerfDataBufferPrologue.getMajorVersion(bb);
163 int minorVersion = AbstractPerfDataBufferPrologue.getMinorVersion(bb);
164
165 // instantiate the version specific class
166 String classname = "sun.jvmstat.perfdata.monitor.v"
167 + majorVersion + "_" + minorVersion
168 + ".PerfDataBuffer";
169
170 try {
171 Class<?> implClass = Class.forName(classname);
172 Constructor cons = implClass.getConstructor(new Class[] {
173 Class.forName("java.nio.ByteBuffer"),
174 Integer.TYPE
175 });
176
177 impl = (PerfDataBufferImpl)cons.newInstance(new Object[] {
178 bb, new Integer(lvmid)
179 });
180
181 } catch (ClassNotFoundException e) {
182 // from Class.forName();
183 throw new IllegalArgumentException(
184 "Could not find " + classname + ": " + e.getMessage(), e);
185
186 } catch (NoSuchMethodException e) {
187 // from Class.getConstructor();
188 throw new IllegalArgumentException(
189 "Expected constructor missing in " + classname + ": "
190 + e.getMessage(), e);
191
192 } catch (IllegalAccessException e) {
|
152 * version.
153 *
154 * @param bb the ByteBuffer that references the instrumentation data.
155 * @param lvmid the Local Java Virtual Machine identifier for this
156 * instrumentation buffer.
157 *
158 * @throws MonitorException
159 */
160 protected void createPerfDataBuffer(ByteBuffer bb, int lvmid)
161 throws MonitorException {
162 int majorVersion = AbstractPerfDataBufferPrologue.getMajorVersion(bb);
163 int minorVersion = AbstractPerfDataBufferPrologue.getMinorVersion(bb);
164
165 // instantiate the version specific class
166 String classname = "sun.jvmstat.perfdata.monitor.v"
167 + majorVersion + "_" + minorVersion
168 + ".PerfDataBuffer";
169
170 try {
171 Class<?> implClass = Class.forName(classname);
172 Constructor<?> cons = implClass.getConstructor(new Class<?>[] {
173 Class.forName("java.nio.ByteBuffer"),
174 Integer.TYPE
175 });
176
177 impl = (PerfDataBufferImpl)cons.newInstance(new Object[] {
178 bb, new Integer(lvmid)
179 });
180
181 } catch (ClassNotFoundException e) {
182 // from Class.forName();
183 throw new IllegalArgumentException(
184 "Could not find " + classname + ": " + e.getMessage(), e);
185
186 } catch (NoSuchMethodException e) {
187 // from Class.getConstructor();
188 throw new IllegalArgumentException(
189 "Expected constructor missing in " + classname + ": "
190 + e.getMessage(), e);
191
192 } catch (IllegalAccessException e) {
|