diff options
author | Brian Vosburgh | 2013-06-28 21:59:10 +0000 |
---|---|---|
committer | Brian Vosburgh | 2013-07-05 17:02:29 +0000 |
commit | 1416a98cb4677b5080182513ec5a14d9542674dc (patch) | |
tree | 4eac0943e0857c3905263de611fa77b420b1b0f0 | |
parent | a1d79b6a634bb944649041b2d3662423649d1459 (diff) | |
download | webtools.dali-1416a98cb4677b5080182513ec5a14d9542674dc.tar.gz webtools.dali-1416a98cb4677b5080182513ec5a14d9542674dc.tar.xz webtools.dali-1416a98cb4677b5080182513ec5a14d9542674dc.zip |
tweak synchronization of InternalJpaProjectManager
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java index 03432e7d2d..548a8db7a9 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java @@ -1104,7 +1104,12 @@ class InternalJpaProjectManager this.execute(command, null); } - public void execute(Command command, ExtendedCommandContext threadLocalModifySharedDocumentCommandContext) throws InterruptedException { + /** + * <strong>NB:</strong> + * This method is <code>synchronized</code> so only a single thread can + * execute it at a time. + */ + public synchronized void execute(Command command, ExtendedCommandContext threadLocalModifySharedDocumentCommandContext) throws InterruptedException { this.setThreadLocalModifySharedDocumentCommandContext(threadLocalModifySharedDocumentCommandContext); this.executeCommandsSynchronously(); try { @@ -1124,11 +1129,7 @@ class InternalJpaProjectManager * * @see #executeCommandsAsynchronously() */ - private synchronized void executeCommandsSynchronously() throws InterruptedException { - if ( ! (this.commandContext instanceof SimpleJobCommandContext)) { - throw new IllegalStateException(); - } - + private void executeCommandsSynchronously() throws InterruptedException { // de-activate Java events this.addJavaEventListenerFlag(FalseBooleanReference.instance()); // save the current context @@ -1147,11 +1148,10 @@ class InternalJpaProjectManager return new SingleUseQueueingExtendedJobCommandContext(); } - private synchronized void executeCommandsAsynchronously() { - if ( ! (this.commandContext instanceof SingleUseQueueingExtendedJobCommandContext)) { - throw new IllegalStateException(); - } - + /** + * @see #executeCommandsSynchronously() + */ + private void executeCommandsAsynchronously() { // no need to wait on a synchronous context... this.commandContext = this.buildAsynchronousCommandContext(); // re-activate Java events |