On Fri, Dec 23, 2011 at 10:27 PM, Mat Lowery wrote: > Thanks for your help.  FYI: https://issues.apache.org/jira/browse/JCR-3194 excellent, thanks! cheers stefan > > > > On 12/23/2011 03:49 PM, Stefan Guggisberg wrote: >> >> package test; >> >>> >> >>>  import java.io.File; >> >>>  import java.util.concurrent.ExecutorService; >> >>>  import java.util.concurrent.Executors; >> >>>  import java.util.concurrent.TimeUnit; >> >>>  import java.util.concurrent.atomic.AtomicBoolean; >> >>>  import java.util.concurrent.atomic.AtomicInteger; >> >>> >> >>>  import javax.jcr.Repository; >> >>>  import javax.jcr.RepositoryException; >> >>>  import javax.jcr.Session; >> >>>  import javax.jcr.SimpleCredentials; >> >>> >> >>>  import org.apache.jackrabbit.core.TransientRepository; >> >>> >> >>>  public class JackrabbitTest { >> >>> >> >>>    public static void main(final String[] args) throws Exception { >> >>>      File dir = File.createTempFile("jackrabbit-test", ""); >> >>>      dir.delete(); >> >>>      dir.mkdir(); >> >>>      System.out.println("created temporary directory: " + >> >>>          dir.getAbsolutePath()); >> >>>      dir.deleteOnExit(); >> >>> >> >>>      final Repository jcrRepo = new TransientRepository(dir); >> >>>      final AtomicBoolean passed = new AtomicBoolean(true); >> >>>      final AtomicInteger counter = new AtomicInteger(0); >> >>>      ExecutorService executor = Executors.newFixedThreadPool(50); >> >>>      Runnable runnable = new Runnable() { >> >>> >> >>>        @Override >> >>>        public void run() { >> >>>          try { >> >>>            Session session = jcrRepo.login( >> >>>                new SimpleCredentials("admin", >> >>>                    "admin".toCharArray())); >> >>>            session.getRootNode().addNode("n" + >> >>>                    counter.getAndIncrement()); //unique name >> >>>            session.save(); >> >>>            session.logout(); >> >>>          } catch (RepositoryException e) { >> >>>            e.printStackTrace(); >> >>>            passed.set(false); >> >>>          } >> >>>        } >> >>> >> >>>      }; >> >>>      System.out.println("Running threads"); >> >>>      for (int i = 0; i<   500; i++) { >> >>>        executor.execute(runnable); >> >>>      } >> >>>      executor.shutdown(); //Disable new tasks from being submitted >> >>>      if (!executor.awaitTermination(120, TimeUnit.SECONDS)) { >> >>>        System.err.println("timeout"); >> >>>        System.exit(1); >> >>>      } >> >>>      if (!passed.get()) { >> >>>        System.err.println("one or more threads got an exception"); >> >>>        System.exit(1); >> >>>      } else { >> >>>        System.out.println("all threads ran with no exceptions"); >> >>>        System.exit(0); >> >>>      } >> >>> >> >>>    } >> >>> >> >>>  }