diff options
author | Eike Stepper | 2015-07-22 12:25:46 +0000 |
---|---|---|
committer | Eike Stepper | 2015-07-22 12:25:46 +0000 |
commit | 017c0e91d0dc68b7ead1b4c893f032d3d72e4e31 (patch) | |
tree | 43b63e279685bbafc4e131a243609487e5112c99 /plugins/org.eclipse.emf.cdo.server.net4j/src/org | |
parent | c8eba7351ffd2d37e17db3ae3c2a7009d366b769 (diff) | |
download | cdo-017c0e91d0dc68b7ead1b4c893f032d3d72e4e31.tar.gz cdo-017c0e91d0dc68b7ead1b4c893f032d3d72e4e31.tar.xz cdo-017c0e91d0dc68b7ead1b4c893f032d3d72e4e31.zip |
[473277] Enhance ThreadPool and use it as much as possible
https://bugs.eclipse.org/bugs/show_bug.cgi?id=473277
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.net4j/src/org')
2 files changed, 41 insertions, 34 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java index 0a15407ab3..83e84b56dd 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java @@ -85,14 +85,10 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori return commitContext.getPackageRegistry(); } - @Override - protected void indicatingFailed() + protected void initializeCommitContext(CDODataInput in) throws Exception { - if (commitContext != null) - { - commitContext.postCommit(false); - commitContext = null; - } + int viewID = in.readInt(); + commitContext = getTransaction(viewID).createCommitContext(); } @Override @@ -101,8 +97,8 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori try { monitor.begin(OMMonitor.TEN); - indicatingCommit(in, monitor.fork(OMMonitor.ONE)); - indicatingCommit(monitor.fork(OMMonitor.TEN - OMMonitor.ONE)); + indicatingRead(in, monitor.fork(OMMonitor.ONE)); + indicatingCommit(in, monitor.fork(OMMonitor.TEN - OMMonitor.ONE)); } catch (IOException ex) { @@ -119,7 +115,7 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori } } - protected void indicatingCommit(CDODataInput in, OMMonitor monitor) throws Exception + protected void indicatingRead(CDODataInput in, OMMonitor monitor) throws Exception { // Create commit context initializeCommitContext(in); @@ -292,32 +288,19 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori } } - private ResourceSet createResourceSet(InternalCDOPackageRegistry packageRegistry) - { - ResourceSet resourceSet = new ResourceSetImpl() - { - @Override - protected void demandLoad(Resource resource) throws IOException - { - // Do nothing: we don't want this ResourceSet to attempt demand-loads. - } - }; - - Resource.Factory resourceFactory = new EcoreResourceFactoryImpl(); - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory); //$NON-NLS-1$ - resourceSet.setPackageRegistry(packageRegistry); - return resourceSet; - } - - protected void initializeCommitContext(CDODataInput in) throws Exception + protected void indicatingCommit(CDODataInput in, OMMonitor monitor) { - int viewID = in.readInt(); - commitContext = getTransaction(viewID).createCommitContext(); + getRepository().commit(commitContext, monitor); } - protected void indicatingCommit(OMMonitor monitor) + @Override + protected void indicatingFailed() { - getRepository().commit(commitContext, monitor); + if (commitContext != null) + { + commitContext.postCommit(false); + commitContext = null; + } } @Override @@ -466,4 +449,21 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori throw new IllegalStateException("Illegal transaction: " + view); //$NON-NLS-1$ } + + private ResourceSet createResourceSet(InternalCDOPackageRegistry packageRegistry) + { + ResourceSet resourceSet = new ResourceSetImpl() + { + @Override + protected void demandLoad(Resource resource) throws IOException + { + // Do nothing: we don't want this ResourceSet to attempt demand-loads. + } + }; + + Resource.Factory resourceFactory = new EcoreResourceFactoryImpl(); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory); //$NON-NLS-1$ + resourceSet.setPackageRegistry(packageRegistry); + return resourceSet; + } } diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitXATransactionPhase1Indication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitXATransactionPhase1Indication.java index f70b26ced3..409eac0fff 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitXATransactionPhase1Indication.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitXATransactionPhase1Indication.java @@ -30,10 +30,17 @@ public class CommitXATransactionPhase1Indication extends CommitTransactionIndica } @Override - protected void indicatingCommit(OMMonitor monitor) + protected boolean closeInputStreamAfterMe() + { + // The commit manager processes phase1 asynchronously, so don't close the input stream on him. + return false; + } + + @Override + protected void indicatingCommit(CDODataInput in, OMMonitor monitor) { // Register transactionContext - getRepository().getCommitManager().preCommit(commitContext, monitor); + getRepository().getCommitManager().preCommit(commitContext, in, monitor); } @Override |