コード例 #1
0
 // Note: this Javadoc is copied from javax.management.Descriptor
 //       due to 6369229.
 @Override
 public synchronized int hashCode() {
   final int size = descriptorMap.size();
   // descriptorMap is sorted with a comparator that ignores cases.
   //
   return Util.hashCode(
       descriptorMap.keySet().toArray(new String[size]),
       descriptorMap.values().toArray(new Object[size]));
 }
コード例 #2
0
  static String[] getLibraryPath(Object userData) {
    final Map<Object, Object> m = Util.cast((userData instanceof Map) ? userData : null);
    final String tag = "JvmRuntime.getLibraryPath";

    // If the list is in the cache, simply return it.
    //
    if (m != null) {
      final String[] cached = (String[]) m.get(tag);
      if (cached != null) return cached;
    }

    final String[] args = splitPath(getRuntimeMXBean().getLibraryPath());

    if (m != null) m.put(tag, args);
    return args;
  }
コード例 #3
0
  static String[] getInputArguments(Object userData) {
    final Map<Object, Object> m = Util.cast((userData instanceof Map) ? userData : null);
    final String tag = "JvmRuntime.getInputArguments";

    // If the list is in the cache, simply return it.
    //
    if (m != null) {
      final String[] cached = (String[]) m.get(tag);
      if (cached != null) return cached;
    }

    final List<String> l = getRuntimeMXBean().getInputArguments();
    final String[] args = l.toArray(new String[0]);

    if (m != null) m.put(tag, args);
    return args;
  }
コード例 #4
0
 /**
  * Returns a {@link ClassLoaderRepository} based on the class loader returned by {@link
  * #getDefaultClassLoader()}.
  *
  * @return a {@link ClassLoaderRepository} that contains a single class loader, returned by {@link
  *     #getDefaultClassLoader()}.
  */
 public ClassLoaderRepository getClassLoaderRepository() {
   // We return a new ClassLoaderRepository each time this method is
   // called. This is by design, because there's no guarantee that
   // getDefaultClassLoader() will always return the same class loader.
   return Util.getSingleClassLoaderRepository(getDefaultClassLoader());
 }
コード例 #5
0
 /**
  * This method is called each time an IOException is raised when trying to forward an operation to
  * the underlying MBeanServerConnection, as a result of calling {@link
  * #getMBeanServerConnection()} or as a result of invoking the operation on the returned
  * connection. Since the methods in {@link MBeanServer} are not declared to throw {@code
  * IOException}, this method must return a {@code RuntimeException} to be thrown instead.
  * Typically, the original {@code IOException} will be in the {@linkplain Throwable#getCause()
  * cause chain} of the {@code RuntimeException}.
  *
  * <p>Subclasses may redefine this method if they need to perform any specific handling of
  * IOException (logging etc...).
  *
  * @param x The raised IOException.
  * @param method The name of the method in which the exception was raised. This is one of the
  *     methods of the MBeanServer interface.
  * @return A RuntimeException that should be thrown by the caller. In this default implementation,
  *     this is a {@link RuntimeException} wrapping <var>x</var>.
  */
 protected RuntimeException wrapIOException(IOException x, String method) {
   return Util.newRuntimeIOException(x);
 }