@Test public void testJoinReuse() { AtomContext ctx1 = new AtomContext(genAtoms(3, 10)); AtomContext ctx2 = new AtomContext(genAtoms(4, 10)); AtomContext ctx1_branched = provider.branch(ctx1); AtomContext ctx2_branched = provider.branch(ctx2); RefCount<List<ByteBuffer>> atoms1 = ctx1.atoms; RefCount<List<ByteBuffer>> atoms2 = ctx2.atoms; assertEquals(2, atoms1.count); assertEquals(2, atoms2.count); AtomContext ctx3 = provider.join(ctx1, ctx2); assertNotNull(ctx3); assertNotSame(atoms1, ctx3.atoms); assertNotSame(atoms2, ctx3.atoms); RefCount<List<ByteBuffer>> atoms3 = ctx3.atoms; assertEquals(1, atoms1.count); assertEquals(1, atoms2.count); assertEquals(1, atoms3.count); assertNull(ctx2.atoms); assertEquals(ctx1, ctx3); }
public AtomContext branch() { return new AtomContext(atoms); }
AtomContext implements BaggageContext { public AtomContext branch() { return new AtomContext(atoms); } }
AtomContext implements BaggageContext { public AtomContext branch() { return new AtomContext(atoms); } AtomContext();   AtomContext(List<ByteBuffer> atoms);   AtomContext(RefCount<List<ByteBuffer>> atoms); }
AtomContext implements BaggageContext { public AtomContext branch() { return new AtomContext(atoms); } AtomContext();   AtomContext(List<ByteBuffer> atoms);   AtomContext(RefCount<List<ByteBuffer>> atoms); AtomContext branch(); AtomContext merge(AtomContext other); int serializedSize(); List<ByteBuffer> getUnmodifiableAtoms(); List<ByteBuffer> getModifiableAtoms(); }
AtomContext implements BaggageContext { public AtomContext branch() { return new AtomContext(atoms); } AtomContext();   AtomContext(List<ByteBuffer> atoms);   AtomContext(RefCount<List<ByteBuffer>> atoms); AtomContext branch(); AtomContext merge(AtomContext other); int serializedSize(); List<ByteBuffer> getUnmodifiableAtoms(); List<ByteBuffer> getModifiableAtoms();  }