Source:
<code>public void removeStoreArtifactMapTest() throws Exception { final ReleaseIdImpl releaseId = new ReleaseIdImpl("org", "redeploy", "2.0"); final InternalKieModule originalKieModule = mock(InternalKieModule.class); when(originalKieModule.getReleaseId()).thenReturn(releaseId); when(originalKieModule.getCreationTimestamp()).thenReturn(0l); final InternalKieModule redeployKieModule = mock(InternalKieModule.class); when(redeployKieModule.getReleaseId()).thenReturn(releaseId); when(redeployKieModule.getCreationTimestamp()).thenReturn(1l); kieModuleRepo.store(originalKieModule); final CyclicBarrier storeRemoveOperationBarrier = new CyclicBarrier(2); final CyclicBarrier operationsSerializationBarrier = new CyclicBarrier(2); final CyclicBarrier threadsFinishedBarrier = new CyclicBarrier(3); final Runnable removeRunnable = () -> { waitFor(storeRemoveOperationBarrier); kieModuleRepo.remove(releaseId); waitFor(operationsSerializationBarrier); waitFor(threadsFinishedBarrier); }; final Runnable redeployRunnable = () -> { waitFor(storeRemoveOperationBarrier); waitFor(operationsSerializationBarrier); kieModuleRepo.store(redeployKieModule); waitFor(threadsFinishedBarrier); }; final Thread removeThread = new Thread(removeRunnable); removeThread.setName("remove"); removeThread.start(); final Thread redeployThread = new Thread(redeployRunnable); redeployThread.setName("store"); <START> redeployThread.start(); <END> waitFor(threadsFinishedBarrier); final String ga = releaseId.getGroupId() + ":" + releaseId.getArtifactId(); final Map<ComparableVersion, KieModule> artifactMap = kieModuleRepo.kieModules.get(ga); assertNotNull( "Artifact Map for GA '" + ga + "' not in KieModuleRepo!", artifactMap); final KieModule redeployedKieModule = artifactMap.get(new ComparableVersion(releaseId.getVersion())); assertNotNull( "Redeployed module has disappeared from KieModuleRepo!", redeployedKieModule); assertEquals( "Original module retrieved instead of redeployed module!", 1l, redeployKieModule.getCreationTimestamp() ); }</code><technical_language>stopping these? If so, if runnables submitted executor shutting executor end</technical_language>

Target:
public void removeStoreArtifactMapTest() throws Exception { final ReleaseIdImpl releaseId = new ReleaseIdImpl("org", "redeploy", "2.0"); final InternalKieModule originalKieModule = mock(InternalKieModule.class); when(originalKieModule.getReleaseId()).thenReturn(releaseId); when(originalKieModule.getCreationTimestamp()).thenReturn(0l); final InternalKieModule redeployKieModule = mock(InternalKieModule.class); when(redeployKieModule.getReleaseId()).thenReturn(releaseId); when(redeployKieModule.getCreationTimestamp()).thenReturn(1l); kieModuleRepo.store(originalKieModule); final CyclicBarrier storeRemoveOperationBarrier = new CyclicBarrier(2); final CyclicBarrier operationsSerializationBarrier = new CyclicBarrier(2); final CyclicBarrier threadsFinishedBarrier = new CyclicBarrier(3); final Runnable removeRunnable = () -> { waitFor(storeRemoveOperationBarrier); kieModuleRepo.remove(releaseId); waitFor(operationsSerializationBarrier); waitFor(threadsFinishedBarrier); }; final Runnable redeployRunnable = () -> { waitFor(storeRemoveOperationBarrier); waitFor(operationsSerializationBarrier); kieModuleRepo.store(redeployKieModule); waitFor(threadsFinishedBarrier); }; final ExecutorService executor = Executors.newFixedThreadPool(2); executor.submit(removeRunnable); executor.submit(redeployRunnable); try { waitFor(threadsFinishedBarrier); } finally { executor.shutdownNow(); } final String ga = releaseId.getGroupId() + ":" + releaseId.getArtifactId(); final Map<ComparableVersion, KieModule> artifactMap = kieModuleRepo.kieModules.get(ga); assertNotNull( "Artifact Map for GA '" + ga + "' not in KieModuleRepo!", artifactMap); final KieModule redeployedKieModule = artifactMap.get(new ComparableVersion(releaseId.getVersion())); assertNotNull( "Redeployed module has disappeared from KieModuleRepo!", redeployedKieModule); assertEquals( "Original module retrieved instead of redeployed module!", 1l, redeployKieModule.getCreationTimestamp() ); }