Exemplo n.º 1
0
 public void collect(String folderPath) {
   File directory = new File(folderPath);
   if (directory.isDirectory()) {
     String[] fileNames = directory.list();
     for (String name : fileNames) {
       File tempFile = new File(folderPath + File.separator + name);
       lastModifiedList.put(name, tempFile.lastModified());
     }
   } else {
     IllegalArgumentException nfe =
         new IllegalArgumentException("Folder [" + folderPath + "] is not a directory");
     StackTraceElement stackTrace =
         new StackTraceElement(
             this.getClass().getName(), "collect", this.getClass().getPackage().toString(), -1);
     nfe.setStackTrace(new StackTraceElement[] {stackTrace});
     throw nfe;
   }
 }
 private static MXBeanProxy findMXBeanProxy(Class<?> mxbeanInterface) {
   synchronized (mxbeanProxies) {
     WeakReference<MXBeanProxy> proxyRef = mxbeanProxies.get(mxbeanInterface);
     MXBeanProxy p = (proxyRef == null) ? null : proxyRef.get();
     if (p == null) {
       try {
         p = new MXBeanProxy(mxbeanInterface);
       } catch (IllegalArgumentException e) {
         String msg =
             "Cannot make MXBean proxy for " + mxbeanInterface.getName() + ": " + e.getMessage();
         IllegalArgumentException iae = new IllegalArgumentException(msg, e.getCause());
         iae.setStackTrace(e.getStackTrace());
         throw iae;
       }
       mxbeanProxies.put(mxbeanInterface, new WeakReference<MXBeanProxy>(p));
     }
     return p;
   }
 }