accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject git commit: ACCUMULO-1514 - dynamic classloader more like regular classloader
Date Tue, 29 Oct 2013 20:54:06 GMT
Updated Branches:
  refs/heads/master 5b8efba01 -> 6140f926d


ACCUMULO-1514 - dynamic classloader more like regular classloader


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/6140f926
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/6140f926
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/6140f926

Branch: refs/heads/master
Commit: 6140f926d545ca00bd572f4d58cb6a105eba04d5
Parents: 5b8efba
Author: John Vines <jvines@gmail.com>
Authored: Tue Oct 29 16:51:03 2013 -0400
Committer: John Vines <jvines@gmail.com>
Committed: Tue Oct 29 16:53:57 2013 -0400

----------------------------------------------------------------------
 .../classloader/vfs/AccumuloVFSClassLoader.java      |  7 +------
 .../vfs/AccumuloReloadingVFSClassLoaderTest.java     |  9 ++++++---
 .../start/classloader/vfs/ContextManagerTest.java    | 15 +++++++--------
 .../vfs/providers/VfsClassLoaderTest.java            |  6 +++---
 4 files changed, 17 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/6140f926/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
index eb653bc..24349d7 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
@@ -134,14 +134,9 @@ public class AccumuloVFSClassLoader {
       
       switch (fo.getType()) {
         case FILE:
-          classpath.add(fo);
-          pathsToMonitor.add(fo);
-          break;
         case FOLDER:
+          classpath.add(fo);
           pathsToMonitor.add(fo);
-          for (FileObject child : fo.getChildren()) {
-            classpath.add(child);
-          }
           break;
         case IMAGINARY:
           // assume its a pattern

http://git-wip-us.apache.org/repos/asf/accumulo/blob/6140f926/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
index 0a48a00..f590376 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoaderTest.java
@@ -34,6 +34,7 @@ import org.junit.rules.TemporaryFolder;
 public class AccumuloReloadingVFSClassLoaderTest {
 
   private TemporaryFolder folder1 = new TemporaryFolder(new File(System.getProperty("user.dir")
+ "/target"));
+  String folderPath;
   private FileSystemManager vfs;
 
   @Before
@@ -43,6 +44,8 @@ public class AccumuloReloadingVFSClassLoaderTest {
     vfs = ContextManagerTest.getVFS();
 
     folder1.create();
+    folderPath = folder1.getRoot().toURI().toString() + ".*";
+
     FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"), folder1.newFile("HelloWorld.jar"));
   }
 
@@ -63,7 +66,7 @@ public class AccumuloReloadingVFSClassLoaderTest {
     FileObject testDir = vfs.resolveFile(folder1.getRoot().toURI().toString());
     FileObject[] dirContents = testDir.getChildren();
 
-    AccumuloReloadingVFSClassLoader arvcl = new AccumuloReloadingVFSClassLoader(folder1.getRoot().toURI().toString(),
vfs, new ReloadingClassLoader() {
+    AccumuloReloadingVFSClassLoader arvcl = new AccumuloReloadingVFSClassLoader(folderPath,
vfs, new ReloadingClassLoader() {
       @Override
       public ClassLoader getClassLoader() {
         return ClassLoader.getSystemClassLoader();
@@ -83,7 +86,7 @@ public class AccumuloReloadingVFSClassLoaderTest {
     FileObject testDir = vfs.resolveFile(folder1.getRoot().toURI().toString());
     FileObject[] dirContents = testDir.getChildren();
 
-    AccumuloReloadingVFSClassLoader arvcl = new AccumuloReloadingVFSClassLoader(folder1.getRoot().toURI().toString(),
vfs, new ReloadingClassLoader() {
+    AccumuloReloadingVFSClassLoader arvcl = new AccumuloReloadingVFSClassLoader(folderPath,
vfs, new ReloadingClassLoader() {
       @Override
       public ClassLoader getClassLoader() {
         return ClassLoader.getSystemClassLoader();
@@ -126,7 +129,7 @@ public class AccumuloReloadingVFSClassLoaderTest {
     FileObject testDir = vfs.resolveFile(folder1.getRoot().toURI().toString());
     FileObject[] dirContents = testDir.getChildren();
 
-    AccumuloReloadingVFSClassLoader arvcl = new AccumuloReloadingVFSClassLoader(folder1.getRoot().toURI().toString(),
vfs, new ReloadingClassLoader() {
+    AccumuloReloadingVFSClassLoader arvcl = new AccumuloReloadingVFSClassLoader(folderPath,
vfs, new ReloadingClassLoader() {
       @Override
       public ClassLoader getClassLoader() {
         return ClassLoader.getSystemClassLoader();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/6140f926/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
----------------------------------------------------------------------
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
index 6ed7906..65f0292 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/ContextManagerTest.java
@@ -17,7 +17,6 @@
 package org.apache.accumulo.start.classloader.vfs;
 
 import java.io.File;
-import java.net.URI;
 import java.util.HashSet;
 
 import org.apache.accumulo.start.classloader.vfs.ContextManager.ContextConfig;
@@ -38,8 +37,8 @@ public class ContextManagerTest {
   private TemporaryFolder folder1 = new TemporaryFolder(new File(System.getProperty("user.dir")
+ "/target"));
   private TemporaryFolder folder2 = new TemporaryFolder(new File(System.getProperty("user.dir")
+ "/target"));
   private FileSystemManager vfs;
-  private URI uri1;
-  private URI uri2;
+  private String uri1;
+  private String uri2;
 
   static FileSystemManager getVFS() {
     try {
@@ -60,8 +59,8 @@ public class ContextManagerTest {
     FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"), folder1.newFile("HelloWorld.jar"));
     FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"), folder2.newFile("HelloWorld.jar"));
 
-    uri1 = new File(folder1.getRoot(), "HelloWorld.jar").toURI();
-    uri2 = folder2.getRoot().toURI();
+    uri1 = new File(folder1.getRoot(), "HelloWorld.jar").toURI().toString();
+    uri2 = folder2.getRoot().toURI().toString()+".*";
 
   }
 
@@ -91,9 +90,9 @@ public class ContextManagerTest {
       @Override
       public ContextConfig getContextConfig(String context) {
         if (context.equals("CX1")) {
-          return new ContextConfig(uri1.toString(), true);
+          return new ContextConfig(uri1, true);
         } else if (context.equals("CX2")) {
-          return new ContextConfig(uri2.toString(), true);
+          return new ContextConfig(uri2, true);
         }
         return null;
       }
@@ -126,7 +125,7 @@ public class ContextManagerTest {
 
   @Test
   public void testPostDelegation() throws Exception {
-    final VFSClassLoader parent = new VFSClassLoader(new FileObject[] {vfs.resolveFile(uri1.toString())},
vfs);
+    final VFSClassLoader parent = new VFSClassLoader(new FileObject[] {vfs.resolveFile(uri1)},
vfs);
 
     Class<?> pclass = parent.loadClass("test.HelloWorld");
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/6140f926/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
index 5a7036d..215d6fd 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
@@ -114,17 +114,17 @@ public class VfsClassLoaderTest extends AccumuloDFSBase {
     private boolean fileCreated = false;
     
     public void fileCreated(FileChangeEvent event) throws Exception {
-      //System.out.println(event.getFile() + " created");
+      System.out.println(event.getFile() + " created");
       this.fileCreated = true;
     }
 
     public void fileDeleted(FileChangeEvent event) throws Exception {
-      //System.out.println(event.getFile() + " deleted");
+      System.out.println(event.getFile() + " deleted");
       this.fileDeleted = true;
     }
 
     public void fileChanged(FileChangeEvent event) throws Exception {
-      //System.out.println(event.getFile() + " changed");
+      System.out.println(event.getFile() + " changed");
       this.fileChanged = true;
     }
 


Mime
View raw message