@Test public void testNewAnonymous() throws InterruptedException { Executor executor = Executors.newFixedThreadPool(10); int sampleSize = 10000; final CountDownLatch latch = new CountDownLatch(sampleSize); final Set<GraphName> anonymousGraphNames = Collections.synchronizedSet(new HashSet<GraphName>()); for (int i = 0; i < sampleSize; i++) { executor.execute(new Runnable() { @Override public void run() { GraphName name = GraphName.newAnonymous(); assertTrue(name.toString().startsWith(GraphName.ANONYMOUS_PREFIX)); anonymousGraphNames.add(name); latch.countDown(); } }); } assertTrue(latch.await(1, TimeUnit.SECONDS)); assertEquals(sampleSize, anonymousGraphNames.size()); }
public static GraphName newAnonymous() { return new GraphName(ANONYMOUS_PREFIX + anonymousCounter.incrementAndGet()); }
GraphName { public static GraphName newAnonymous() { return new GraphName(ANONYMOUS_PREFIX + anonymousCounter.incrementAndGet()); } }
GraphName { public static GraphName newAnonymous() { return new GraphName(ANONYMOUS_PREFIX + anonymousCounter.incrementAndGet()); } private  GraphName(String name); }
GraphName { public static GraphName newAnonymous() { return new GraphName(ANONYMOUS_PREFIX + anonymousCounter.incrementAndGet()); } private  GraphName(String name); static GraphName newAnonymous(); static GraphName root(); static GraphName empty(); static GraphName of(String name); boolean isGlobal(); boolean isRoot(); boolean isEmpty(); boolean isPrivate(); boolean isRelative(); GraphName getParent(); GraphName getBasename(); GraphName toRelative(); GraphName toGlobal(); GraphName join(GraphName other); GraphName join(String other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }
GraphName { public static GraphName newAnonymous() { return new GraphName(ANONYMOUS_PREFIX + anonymousCounter.incrementAndGet()); } private  GraphName(String name); static GraphName newAnonymous(); static GraphName root(); static GraphName empty(); static GraphName of(String name); boolean isGlobal(); boolean isRoot(); boolean isEmpty(); boolean isPrivate(); boolean isRelative(); GraphName getParent(); GraphName getBasename(); GraphName toRelative(); GraphName toGlobal(); GraphName join(GraphName other); GraphName join(String other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }