@Test
public void testMultithreadedUsage() throws Exception {

    IAtomContainer mol1 = parser.parseSmiles("C=C(C1=CC=C(C=C1)O)NNC2=C(C(=NC(=C2Cl)Cl)C(=O)O)Cl");
    IAtomContainer mol2 = parser
            .parseSmiles("C1=CC=C(C=C1)C[N+]2=C(C=C(C=C2C=CC3=CC=CC=C3)C4=CC=CC=C4)C5=CC=CC=C5");
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1);
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2);
    CDKHydrogenAdder adder = CDKHydrogenAdder.getInstance(mol1.getBuilder());
    adder.addImplicitHydrogens(mol1);
    AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol1);
    Aromaticity.cdkLegacy().apply(mol1);
    adder.addImplicitHydrogens(mol2);
    AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol2);
    Aromaticity.cdkLegacy().apply(mol2);
    IFingerprinter fp = new PubchemFingerprinter(DefaultChemObjectBuilder.getInstance());
    BitSet bs1 = fp.getBitFingerprint(mol1).asBitSet();
    BitSet bs2 = fp.getBitFingerprint(mol2).asBitSet();
    class FpRunner implements Callable<BitSet> {
        IAtomContainer mol;
        FpRunner(IAtomContainer mol) {
            this.mol = mol;
        }
        @Override
        public BitSet call() throws Exception {
            BitSet fp = null;
            IFingerprinter fpr = new PubchemFingerprinter(DefaultChemObjectBuilder.getInstance());
            try {
                fp = fpr.getBitFingerprint(mol).asBitSet();
            } catch (CDKException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }
            return fp;
        }
    }
    // now lets run some threads
    ExecutorService executor = Executors.newFixedThreadPool(2);
    List<FpRunner> tasks = new ArrayList<FpRunner>();
    tasks.add(new FpRunner(mol1));
    tasks.add(new FpRunner(mol2));
    List<Future<BitSet>> ret = executor.invokeAll(tasks);
    BitSet fb1 = ret.get(0).get();
    Assert.assertNotNull(fb1);
    BitSet fb2 = ret.get(1).get();
    Assert.assertNotNull(fb2);
    Assert.assertEquals(bs1, fb1);
    Assert.assertEquals(bs2, fb2);
}