diff --git a/common/source/java/ch/systemsx/cisd/common/concurrent/ThreadGuard.java b/common/source/java/ch/systemsx/cisd/common/concurrent/ThreadGuard.java index e82f344f5f9640b160ebd9679122a5219cd07459..33bffb085a1e192f34a9690417fa6e29889f72a3 100644 --- a/common/source/java/ch/systemsx/cisd/common/concurrent/ThreadGuard.java +++ b/common/source/java/ch/systemsx/cisd/common/concurrent/ThreadGuard.java @@ -50,35 +50,6 @@ final class ThreadGuard private volatile boolean cancelled = false; - @SuppressWarnings("deprecation") - private static void stopNow(Thread t) - { - t.stop(new StopException()); - } - - // Do not synchronize this or things will stop working! - private boolean stop(Thread t, long timeoutMillis) throws InterruptedException - { - final boolean gotIt; - gotIt = stopLock.tryLock(timeoutMillis, TimeUnit.MILLISECONDS); - if (waitForFinished(TerminableCallable.NO_WAIT_MILLIS)) - { - // interrupt() took effect, we don't need to stop() - return true; - } - if (gotIt == false) - { - return false; - } - try - { - stopNow(t); - return true; - } finally - { - stopLock.unlock(); - } - } private synchronized Thread tryInterruptAndGetThread() { @@ -262,10 +233,7 @@ final class ThreadGuard return true; } else { - if (stop(t, timeoutMillis - (System.currentTimeMillis() - start)) == false) - { - return false; - } + return false; } } return waitForFinished(timeoutMillis - (System.currentTimeMillis() - start)); diff --git a/common/source/java/ch/systemsx/cisd/common/concurrent/TimerUtilities.java b/common/source/java/ch/systemsx/cisd/common/concurrent/TimerUtilities.java index 5951d1793b29d5f68d3bed8bd4d6c8be77a69dd1..384c9b105d338d5438455643f10eb50015f3870f 100644 --- a/common/source/java/ch/systemsx/cisd/common/concurrent/TimerUtilities.java +++ b/common/source/java/ch/systemsx/cisd/common/concurrent/TimerUtilities.java @@ -57,12 +57,6 @@ public class TimerUtilities return null; } - @SuppressWarnings("deprecation") - private static void stopTimerThread(Thread timerThread) - { - timerThread.stop(new InterruptedExceptionUnchecked()); - } - /** * Tries to join the <var>thread</var> {@link Thread#join(long)}. * @@ -155,13 +149,6 @@ public class TimerUtilities { return true; } - // If we have been interrupting the thread successfully but the interrupted flag has not - // been set, then try stopping and again joining the thread. - if (timerThread.isInterrupted()) - { - stopTimerThread(timerThread); - return tryJoinThread(timerThread, millis); - } return false; } diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/concurrent/TerminableCallableTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/concurrent/TerminableCallableTest.java index 667eb606f7c896ecad2f623f281a278846865b40..9997443ee53a691e1ce7af0f56eba0d76d66e779 100644 --- a/common/sourceTest/java/ch/systemsx/cisd/common/concurrent/TerminableCallableTest.java +++ b/common/sourceTest/java/ch/systemsx/cisd/common/concurrent/TerminableCallableTest.java @@ -217,22 +217,6 @@ public class TerminableCallableTest t.stop(); } - @Test(groups = "slow") - public void testStop() throws Exception - { - final CountDownLatch launchLatch = new CountDownLatch(1); - final CountDownLatch milestoneLatch = new CountDownLatch(1); - final TestRunnable sensor = - new TestRunnable(launchLatch, milestoneLatch, Strategy.KEEP_SPINNING_STOPPABLE); - final TerminableCallable<Object> callableUnderTest = TerminableCallable.create(sensor); - final Thread t = new Thread(callableUnderTest.asRunnable(), "stop"); - t.start(); - launchLatch.await(); - assertTrue(callableUnderTest.terminate(200L)); - assertTrue(milestoneLatch.await(0, TimeUnit.MILLISECONDS)); - assertTrue(describe(sensor.cause), FinishCause.STOPPED.equals(sensor.cause)); - assertEquals(1, sensor.cleanUpCount); - } @Test(invocationCount = 10) public void testThrowException() throws Exception diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/concurrent/TimerUtilitiesTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/concurrent/TimerUtilitiesTest.java index 0f2d83ba24a6ff3b6a2098ee7c8fed4341b5b1e7..f8f7a52ea9991168ebd23b5104a764e1e2a7b87f 100644 --- a/common/sourceTest/java/ch/systemsx/cisd/common/concurrent/TimerUtilitiesTest.java +++ b/common/sourceTest/java/ch/systemsx/cisd/common/concurrent/TimerUtilitiesTest.java @@ -206,41 +206,4 @@ public class TimerUtilitiesTest assertTrue(sem.tryAcquire()); timer.cancel(); // Just to be sure. } - - @Test - public void testShutdownWithStop() throws InterruptedException - { - final Semaphore sem = new Semaphore(0); - final Timer timer = new Timer(); - final TimerTask task = new TimerTask() - { - private void keepWheelsSpinning() - { - do - { - // Nothing. - } while (true); - } - - @Override - public void run() - { - sem.release(); - try - { - keepWheelsSpinning(); - fail("should have been stopped."); - } catch (InterruptedExceptionUnchecked ex) - { - // That is expected, signal success. - sem.release(); - } - } - }; - timer.schedule(task, 0L); - sem.acquire(); // Ensure we don't cancel() before the task is running. - assertTrue(TimerUtilities.tryShutdownTimer(timer, 50L)); - assertTrue(sem.tryAcquire()); - timer.cancel(); // Just to be sure. - } } diff --git a/openbis/build.gradle b/openbis/build.gradle index 1ec7f1cf677e68ebbbe0d4651c901e9c62f44ee2..07fab92b0c41b03c3fe6f15aee72d651343ff099 100644 --- a/openbis/build.gradle +++ b/openbis/build.gradle @@ -21,7 +21,7 @@ dependencies { 'hibernate:hibernate-search-orm:5.0.1.Final', 'eclipse:jetty-deploy:8.1.8.v20121106', 'google:gwt-debug-panel:1.0', - 'google:gwt-user:2.4', + 'google:gwt-user:+', 'reveregroup:gwt-image-loader:+', 'springframework:spring-orm:+', 'cisd:cisd-hotdeploy:13.01.0', @@ -73,6 +73,6 @@ task copyTestData(type: Copy, dependsOn: testClasses) { include "*.properties" } test.dependsOn(copyTestData) -// test.dependsOn(cleanDbSuite) +test.dependsOn(cleanDbSuite) apply from: 'gwtdev.gradle' \ No newline at end of file diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java index 8fe0943f8d504870839662060c47c287901fea7b..53085144a4e78df2186650c1eba68f555992ae93 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java @@ -30,6 +30,7 @@ import org.springframework.test.context.testng.AbstractTransactionalTestNGSpring import org.springframework.test.context.transaction.TransactionConfiguration; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; @@ -144,7 +145,6 @@ public abstract class BaseTest extends AbstractTransactionalTestNGSpringContextT LogInitializer.init(); initializeProperties(); setContext(); - createDataStore(); } private void initializeProperties() @@ -163,7 +163,8 @@ public abstract class BaseTest extends AbstractTransactionalTestNGSpringContextT super.springTestContextPrepareTestInstance(); } - private void createDataStore() + @BeforeMethod(alwaysRun = true) + public void createDataStore() { DataStorePE dataStore = new DataStorePE(); dataStore.setCode("STANDARD"); @@ -171,7 +172,6 @@ public abstract class BaseTest extends AbstractTransactionalTestNGSpringContextT dataStore.setDownloadUrl("http://localhost"); dataStore.setRemoteUrl("http://remotehost"); dataStore.setSessionToken(""); - this.daoFactory.getDataStoreDAO().createOrUpdateDataStore(dataStore); }