diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/Bug_262032.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/Bug_262032.java index f647434b341..bfab209d0df 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/Bug_262032.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/Bug_262032.java @@ -23,7 +23,7 @@ import org.eclipse.core.runtime.jobs.ILock; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.tests.harness.TestBarrier; +import org.eclipse.core.tests.harness.TestBarrier2; import org.eclipse.swt.widgets.Display; import org.junit.Test; @@ -71,20 +71,20 @@ public boolean contains(ISchedulingRule rule) { @Test public void testBug262032() { final ILock lock = Job.getJobManager().newLock(); - final TestBarrier tb1 = new TestBarrier(-1); + final TestBarrier2 tb1 = new TestBarrier2(-1); // Job hols scheduling rule Job j = new Job ("Deadlocking normal Job") { @Override protected IStatus run(IProgressMonitor monitor) { - tb1.setStatus(TestBarrier.STATUS_WAIT_FOR_START); - tb1.waitForStatus(TestBarrier.STATUS_RUNNING); + tb1.setStatus(TestBarrier2.STATUS_WAIT_FOR_START); + tb1.waitForStatus(TestBarrier2.STATUS_RUNNING); lock.acquire(); //test that we haven't both acquired the lock... assertTrue(!concurrentAccess); lock.release(); - tb1.setStatus(TestBarrier.STATUS_WAIT_FOR_DONE); + tb1.setStatus(TestBarrier2.STATUS_WAIT_FOR_DONE); return Status.OK_STATUS; } }; @@ -92,13 +92,13 @@ protected IStatus run(IProgressMonitor monitor) { j.schedule(); // Wait for the job with scheduling rule to start - tb1.waitForStatus(TestBarrier.STATUS_WAIT_FOR_START); + tb1.waitForStatus(TestBarrier2.STATUS_WAIT_FOR_START); // asyncExec job that wants the lock Display.getDefault().asyncExec(() -> { lock.acquire(); concurrentAccess = true; - tb1.setStatus(TestBarrier.STATUS_RUNNING); + tb1.setStatus(TestBarrier2.STATUS_RUNNING); // Sleep to test for concurrent access try { Thread.sleep(1000); @@ -114,7 +114,7 @@ protected IStatus run(IProgressMonitor monitor) { try { j.join(); - tb1.waitForStatus(TestBarrier.STATUS_WAIT_FOR_DONE); + tb1.waitForStatus(TestBarrier2.STATUS_WAIT_FOR_DONE); assertEquals(Status.OK_STATUS, j.getResult()); } catch (InterruptedException e) {fail();} } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/TestBug269121.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/TestBug269121.java index 7945e694485..c33720b7b62 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/TestBug269121.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/TestBug269121.java @@ -16,13 +16,14 @@ import static org.junit.Assert.assertTrue; import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.atomic.AtomicIntegerArray; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.tests.harness.TestBarrier; +import org.eclipse.core.tests.harness.TestBarrier2; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; @@ -65,11 +66,11 @@ public IStatus runInUIThread(IProgressMonitor monitor) { } }; job.setRule(ResourcesPlugin.getWorkspace().getRoot()); - final int[] status = new int[] { -1 }; + final AtomicIntegerArray status = new AtomicIntegerArray(new int[] { -1 }); WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor monitor) { - status[0] = TestBarrier.STATUS_DONE; + status.set(0, TestBarrier2.STATUS_DONE); } }; final ProgressMonitorDialog dialog = new ProgressMonitorDialog( @@ -78,7 +79,7 @@ protected void execute(IProgressMonitor monitor) { @Override protected IStatus run(IProgressMonitor monitor) { try { - TestBarrier.waitForStatus(status, TestBarrier.STATUS_DONE); + TestBarrier2.waitForStatus(status, TestBarrier2.STATUS_DONE); return Status.OK_STATUS; } catch (AssertionFailedError e) { // syncExecs are processed by