src/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java

Print this page


   1 /*
   2  * Copyright (c) 2004, Oracle and/or its affiliates. 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 189                                + e.getMessage());
 190         } catch (SyntaxException e) {
 191             System.err.println("Syntax error parsing " + filename + ": "
 192                                + e.getMessage());
 193         }
 194     }
 195 
 196     /**
 197      * Find the Monitor object for the named counter by using one of its
 198      * aliases.
 199      */
 200     protected Monitor findByAlias(String name) {
 201         assert Thread.holdsLock(this);
 202 
 203         Monitor  m = (Monitor)aliasCache.get(name);
 204         if (m == null) {
 205             ArrayList al = aliasMap.get(name);
 206             if (al != null) {
 207                 for (Iterator i = al.iterator(); i.hasNext() && m == null; ) {
 208                     String alias = (String)i.next();
 209                     m = (Monitor)monitors.get(alias);
 210                 }
 211             }
 212         }
 213         return m;
 214     }
 215 
 216 
 217     /**
 218      * Find a named Instrumentation object.
 219      *
 220      * This method will look for the named instrumentation object in the
 221      * instrumentation exported by this Java Virtual Machine. If an
 222      * instrumentation object with the given name exists, a Monitor interface
 223      * to that object will be return. Otherwise, the method returns
 224      * <tt>null</tt>. The method will map requests for instrumention objects
 225      * using old names to their current names, if applicable.
 226      *
 227      *
 228      *
 229      * @param name the name of the Instrumentation object to find.


   1 /*
   2  * Copyright (c) 2004, 2014, Oracle and/or its affiliates. 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 189                                + e.getMessage());
 190         } catch (SyntaxException e) {
 191             System.err.println("Syntax error parsing " + filename + ": "
 192                                + e.getMessage());
 193         }
 194     }
 195 
 196     /**
 197      * Find the Monitor object for the named counter by using one of its
 198      * aliases.
 199      */
 200     protected Monitor findByAlias(String name) {
 201         assert Thread.holdsLock(this);
 202 
 203         Monitor  m = (Monitor)aliasCache.get(name);
 204         if (m == null) {
 205             ArrayList al = aliasMap.get(name);
 206             if (al != null) {
 207                 for (Iterator i = al.iterator(); i.hasNext() && m == null; ) {
 208                     String alias = (String)i.next();
 209                     m = monitors.get(alias);
 210                 }
 211             }
 212         }
 213         return m;
 214     }
 215 
 216 
 217     /**
 218      * Find a named Instrumentation object.
 219      *
 220      * This method will look for the named instrumentation object in the
 221      * instrumentation exported by this Java Virtual Machine. If an
 222      * instrumentation object with the given name exists, a Monitor interface
 223      * to that object will be return. Otherwise, the method returns
 224      * <tt>null</tt>. The method will map requests for instrumention objects
 225      * using old names to their current names, if applicable.
 226      *
 227      *
 228      *
 229      * @param name the name of the Instrumentation object to find.