### Question:
BatchSignatureVerifier implements BLSSignatureVerifier { @Override public synchronized boolean verify( List<BLSPublicKey> publicKeys, Bytes message, BLSSignature signature) { if (complete) throw new IllegalStateException("Reuse of disposable instance"); toVerify.add(new Job(toVerify.size(), publicKeys, message, signature)); return true; }  @Override synchronized boolean verify(
      List<BLSPublicKey> publicKeys, Bytes message, BLSSignature signature); synchronized boolean batchVerify();  }### Answer:
@Test public void testParallel() throws Exception { BatchSignatureVerifier verifier = new BatchSignatureVerifier(); BLSPublicKey publicKey = BLSPublicKey.random(42); Bytes message = Bytes.wrap("Hello, world!".getBytes(UTF_8)); BLSSignature signature = BLSSignature.random(42); int nThreads = 64; int iterations = 64; ExecutorService executor = Executors.newFixedThreadPool(nThreads); CountDownLatch latch = new CountDownLatch(nThreads); List<Future<Boolean>> futures = IntStream.range(0, nThreads) .mapToObj( __ -> executor.submit( () -> { latch.countDown(); latch.await(); boolean ret = true; for (int i = 0; i < iterations; i++) { ret &= verifier.verify( Collections.singletonList(publicKey), message, signature); } return ret; })) .collect(Collectors.toList()); for (Future<Boolean> future : futures) { assertThat(future.get()).isTrue(); } assertThat(verifier.toVerify.size()).isEqualTo(nThreads * iterations); assertThat(verifier.toVerify).doesNotContainNull(); }