Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-04-16 05:11:52 +0000
committerEike Stepper2013-04-16 05:18:12 +0000
commit7040c929c29a64bb427eb17a6f1a3051209f7774 (patch)
tree6e5d1996f8f5adaf54ca97ff13610c53b69f55f9
parentd23bce5b998fc3aea7eddbfa9cfc1ebc803f37dc (diff)
downloadcdo-7040c929c29a64bb427eb17a6f1a3051209f7774.tar.gz
cdo-7040c929c29a64bb427eb17a6f1a3051209f7774.tar.xz
cdo-7040c929c29a64bb427eb17a6f1a3051209f7774.zip
[405761] InvalidationRunner threads are sometimes not properly stopped
https://bugs.eclipse.org/bugs/show_bug.cgi?id=405761
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java13
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java13
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorker.java11
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Channel.java9
5 files changed, 52 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
index 5249562309..2e91858c72 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
@@ -194,6 +194,15 @@ public class RepositorySynchronizer extends PriorityQueueRunner implements Inter
}
@Override
+ protected void noWork(WorkContext context)
+ {
+ if (!localRepository.isActive())
+ {
+ context.terminate();
+ }
+ }
+
+ @Override
protected void doBeforeActivate() throws Exception
{
super.doBeforeActivate();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index efc2c99cf4..7bc1facee5 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -1116,7 +1116,18 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
{
if (invalidationRunner == null)
{
- invalidationRunner = new QueueRunner();
+ invalidationRunner = new QueueRunner()
+ {
+ @Override
+ protected void noWork(WorkContext context)
+ {
+ if (isClosed())
+ {
+ context.terminate();
+ }
+ }
+ };
+
invalidationRunner.activate();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
index c5e9b89447..6a3460d00e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
@@ -130,10 +130,10 @@ public class CDOViewImpl extends AbstractCDOView
private long lastUpdateTime;
- private QueueRunner invalidationRunner;
-
private Map<CDOObject, CDOLockState> lockStates = new WeakHashMap<CDOObject, CDOLockState>();
+ private QueueRunner invalidationRunner;
+
@ExcludeFromDump
private InvalidationRunnerLock invalidationRunnerLock = new InvalidationRunnerLock();
@@ -929,6 +929,15 @@ public class CDOViewImpl extends AbstractCDOView
}
@Override
+ protected void noWork(WorkContext context)
+ {
+ if (isClosed())
+ {
+ context.terminate();
+ }
+ }
+
+ @Override
public String toString()
{
return getThreadName();
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorker.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorker.java
index caec3355fa..1094072337 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorker.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorker.java
@@ -87,6 +87,10 @@ public abstract class QueueWorker<E> extends Worker
{
work(context, element);
}
+ else
+ {
+ noWork(context);
+ }
}
/**
@@ -99,6 +103,13 @@ public abstract class QueueWorker<E> extends Worker
protected abstract void work(WorkContext context, E element);
+ /**
+ * @since 3.3
+ */
+ protected void noWork(WorkContext context)
+ {
+ }
+
protected BlockingQueue<E> createQueue()
{
return new LinkedBlockingQueue<E>();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Channel.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Channel.java
index fc5e61f6dc..6a92497ff9 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Channel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Channel.java
@@ -330,6 +330,15 @@ public class Channel extends Lifecycle implements InternalChannel
{
return "Net4jReceiveSerializer-" + Channel.this; //$NON-NLS-1$
}
+
+ @Override
+ protected void noWork(WorkContext context)
+ {
+ if (isClosed())
+ {
+ context.terminate();
+ }
+ }
}
/**

Back to the top