Package org.jboss.test.classloader.jbcl114

Examples of org.jboss.test.classloader.jbcl114.BlockingClassLoaderDomain


   public void testCache() throws Exception
   {
      ClassLoaderSystem system = createBlockingClassLoaderSystem();
      NoMatchClassFilter filter = new NoMatchClassFilter(ClassLoaderDomain.class);
      ParentPolicy parentPolicy = new ParentPolicy(ClassFilter.JAVA_ONLY, filter);
      BlockingClassLoaderDomain domain = (BlockingClassLoaderDomain) system.createAndRegisterDomain("test", parentPolicy, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPathsAndPackageNames(ClassLoaderDomain.class);
      final ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
      int numThreads = 2;
      ExecutorService executor = Executors.newFixedThreadPool(numThreads);
      Future<?>[] results = new Future[numThreads];
      for(int i = 0; i < results.length; i++)
      {
         results[i] = executor.submit(new Callable<Void>() {
            public Void call() throws Exception
            {
               assertLoadClass(ClassLoaderDomain.class, classLoader);
               return null;
            }
         });
      }
      executor.shutdown();
      domain.unblock();
      executor.awaitTermination(5, TimeUnit.SECONDS);
      // no exceptions means a job well done
      for(int i = 0; i < results.length; i++)
      {
         results[i].get(1, TimeUnit.SECONDS);
View Full Code Here


   public void testCache() throws Exception
   {
      ClassLoaderSystem system = createBlockingClassLoaderSystem();
      NoMatchClassFilter filter = new NoMatchClassFilter(ClassLoaderDomain.class);
      ParentPolicy parentPolicy = new ParentPolicy(ClassFilterUtils.JAVA_ONLY, filter);
      BlockingClassLoaderDomain domain = (BlockingClassLoaderDomain) system.createAndRegisterDomain("test", parentPolicy, null);
     
      MockClassLoaderPolicy policy = createMockClassLoaderPolicy();
      policy.setPathsAndPackageNames(ClassLoaderDomain.class);
      final ClassLoader classLoader = system.registerClassLoaderPolicy(domain, policy);
     
      int numThreads = 2;
      ExecutorService executor = Executors.newFixedThreadPool(numThreads);
      Future<?>[] results = new Future[numThreads];
      for(int i = 0; i < results.length; i++)
      {
         results[i] = executor.submit(new Callable<Void>() {
            public Void call() throws Exception
            {
               assertLoadClass(ClassLoaderDomain.class, classLoader);
               return null;
            }
         });
      }
      executor.shutdown();
      domain.unblock();
      executor.awaitTermination(5, TimeUnit.SECONDS);
      // no exceptions means a job well done
      for(int i = 0; i < results.length; i++)
      {
         results[i].get(1, TimeUnit.SECONDS);
View Full Code Here

      super(name);
   }

   protected ClassLoaderSystem createBlockingClassLoaderSystem()
   {
      return new BlockingClassLoaderSystem();
   }
View Full Code Here

      super(name);
   }

   protected ClassLoaderSystem createBlockingClassLoaderSystem()
   {
      return new BlockingClassLoaderSystem();
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.classloader.jbcl114.BlockingClassLoaderDomain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.