diff options
21 files changed, 435 insertions, 132 deletions
diff --git a/features/org.eclipse.emf.cdo-feature/feature.xml b/features/org.eclipse.emf.cdo-feature/feature.xml index eb7f877711..f222fccbf0 100644 --- a/features/org.eclipse.emf.cdo-feature/feature.xml +++ b/features/org.eclipse.emf.cdo-feature/feature.xml @@ -13,7 +13,7 @@ <feature id="org.eclipse.emf.cdo" label="%featureName" - version="4.3.100.qualifier" + version="4.4.0.qualifier" provider-name="%providerName" license-feature="org.eclipse.emf.cdo.license" license-feature-version="0.0.0"> diff --git a/features/org.eclipse.emf.cdo.defs-feature/feature.xml b/features/org.eclipse.emf.cdo.defs-feature/feature.xml index cab5e05782..a1c3e079e0 100644 --- a/features/org.eclipse.emf.cdo.defs-feature/feature.xml +++ b/features/org.eclipse.emf.cdo.defs-feature/feature.xml @@ -12,7 +12,7 @@ <feature id="org.eclipse.emf.cdo.defs" label="%featureName" - version="4.3.100.qualifier" + version="4.4.0.qualifier" provider-name="%providerName" license-feature="org.eclipse.emf.cdo.license" license-feature-version="0.0.0"> diff --git a/features/org.eclipse.emf.cdo.sdk-feature/feature.xml b/features/org.eclipse.emf.cdo.sdk-feature/feature.xml index 067cbecdd1..b69864fe0e 100644 --- a/features/org.eclipse.emf.cdo.sdk-feature/feature.xml +++ b/features/org.eclipse.emf.cdo.sdk-feature/feature.xml @@ -12,7 +12,7 @@ <feature id="org.eclipse.emf.cdo.sdk" label="%featureName" - version="4.3.100.qualifier" + version="4.4.0.qualifier" provider-name="%providerName" image="eclipse_update_120.jpg" license-feature="org.eclipse.emf.cdo.license" diff --git a/features/org.eclipse.emf.cdo.server-feature/feature.xml b/features/org.eclipse.emf.cdo.server-feature/feature.xml index e5e0de101f..d5059d2b7d 100644 --- a/features/org.eclipse.emf.cdo.server-feature/feature.xml +++ b/features/org.eclipse.emf.cdo.server-feature/feature.xml @@ -12,7 +12,7 @@ <feature id="org.eclipse.emf.cdo.server" label="%featureName" - version="4.3.100.qualifier" + version="4.4.0.qualifier" provider-name="%providerName" image="eclipse_update_120.jpg" license-feature="org.eclipse.emf.cdo.license" diff --git a/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters index 1fcf68beb2..5e030d422d 100644 --- a/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters +++ b/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters @@ -164,6 +164,13 @@ <message_argument value="13"/> </message_arguments> </filter> + <filter comment="It is only a protocol change" id="388194388"> + <message_arguments> + <message_argument value="org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants"/> + <message_argument value="PROTOCOL_VERSION"/> + <message_argument value="19"/> + </message_arguments> + </filter> </resource> <resource path="src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java" type="org.eclipse.emf.cdo.spi.common.id.AbstractCDOID"> <filter id="337682486"> diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java index 02c887ec2c..90de0c6dcf 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java @@ -29,8 +29,10 @@ public interface CDOProtocolConstants /** * @since 4.2 */ - public static final int PROTOCOL_VERSION = 19; // Branch renaming + public static final int PROTOCOL_VERSION = 20; // Have OMMOnitor optional in + // RequestWithMonitoring/IndicationWithMonitoring + // public static final int PROTOCOL_VERSION = 19; // Branch renaming // public static final int PROTOCOL_VERSION = 18; // Password change protocol // public static final int PROTOCOL_VERSION = 17; // Last update for make query fail in sequence diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadMergeDataRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadMergeDataRequest.java index 3c52baeae3..fe7bba5dcf 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadMergeDataRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadMergeDataRequest.java @@ -18,8 +18,11 @@ import org.eclipse.emf.cdo.common.revision.CDORevision; import org.eclipse.emf.cdo.common.revision.CDORevisionKey; import org.eclipse.emf.cdo.spi.common.commit.CDORevisionAvailabilityInfo; +import org.eclipse.net4j.util.om.monitor.EclipseMonitor; import org.eclipse.net4j.util.om.monitor.OMMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; + import java.io.IOException; import java.util.HashSet; import java.util.Iterator; @@ -56,6 +59,10 @@ public class LoadMergeDataRequest extends CDOClientRequestWithMonitoring<Set<CDO @Override protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException { + if (monitor == null) + { + monitor = new EclipseMonitor(new NullProgressMonitor()); + } out.writeInt(infos); monitor.begin(infos); @@ -108,6 +115,10 @@ public class LoadMergeDataRequest extends CDOClientRequestWithMonitoring<Set<CDO @Override protected Set<CDOID> confirming(CDODataInput in, OMMonitor monitor) throws IOException { + if (monitor == null) + { + monitor = new EclipseMonitor(new NullProgressMonitor()); + } Set<CDOID> result = new HashSet<CDOID>(); int size = in.readInt(); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java index 4c6e6e79d4..76c298f4eb 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java @@ -157,7 +157,7 @@ public class ServerCDOView extends AbstractCDOView implements org.eclipse.emf.cd return false; } - public boolean setBranchPoint(CDOBranchPoint branchPoint) + public boolean setBranchPoint(CDOBranchPoint branchPoint, IProgressMonitor monitor) { throw new UnsupportedOperationException(); } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_441136_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_441136_Test.java new file mode 100644 index 0000000000..bfbbbbc8f8 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_441136_Test.java @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Esteban Dugueperoux - initial API and implementation + */ +package org.eclipse.emf.cdo.tests.bugzilla; + +import org.eclipse.emf.cdo.common.commit.CDOCommitInfo; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.eresource.CDOResource; +import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl; +import org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol; +import org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest; +import org.eclipse.emf.cdo.net4j.CDONet4jSession; +import org.eclipse.emf.cdo.session.CDOSession; +import org.eclipse.emf.cdo.tests.AbstractCDOTest; +import org.eclipse.emf.cdo.tests.model1.Company; +import org.eclipse.emf.cdo.transaction.CDOTransaction; +import org.eclipse.emf.cdo.view.CDOView; + +import org.eclipse.emf.internal.cdo.session.DelegatingSessionProtocol; + +import org.eclipse.net4j.signal.IndicationWithMonitoring; +import org.eclipse.net4j.signal.RequestWithMonitoring; +import org.eclipse.net4j.signal.Signal; +import org.eclipse.net4j.signal.SignalProtocol; +import org.eclipse.net4j.signal.SignalScheduledEvent; +import org.eclipse.net4j.util.event.IEvent; +import org.eclipse.net4j.util.event.IListener; +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol; +import org.eclipse.emf.spi.cdo.InternalCDOSession; + +import org.eclipse.core.runtime.NullProgressMonitor; + +import java.util.HashMap; +import java.util.Map; + +/** + * Test {@link RequestWithMonitoring @link IndicationWithMonitoring} with and without {@link OMMonitor}. + * + * @author Esteban Dugueperoux + */ +public class Bugzilla_441136_Test extends AbstractCDOTest +{ + private static final String RESOURCE_NAME = "test1.model1"; + + /** + * Test that a {@link RequestWithMonitoring}/{@link IndicationWithMonitoring} without {@link OMMonitor} does not trigger MonitorProgressRequest/MonitorProgressIndication. + */ + public void testRequestWithMonitoringWithoutProgressMonitor() throws Exception + { + testRequestWithMonitoring(false); + } + + /** + * Test that a {@link RequestWithMonitoring}/{@link IndicationWithMonitoring} with {@link OMMonitor} does trigger MonitorProgressRequest/MonitorProgressIndication. + */ + public void testRequestWithMonitoringWithProgressMonitor() throws Exception + { + testRequestWithMonitoring(true); + } + + private void testRequestWithMonitoring(boolean useMonitor) throws Exception + { + CDOSession session = openSession(); + getRepository().getCommitInfoManager().addCommitInfoHandler(new CommitTransactionIndicationWaiting()); + ((CDONet4jSession)session).options().setCommitTimeout( + 1000 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); + ((CDONet4jSessionImpl)session).setSignalTimeout(10000 * SignalProtocol.DEFAULT_TIMEOUT); + CDOTransaction transaction = session.openTransaction(); + NBRequestsCallsCounter nbRequestsCallsCounter = new NBRequestsCallsCounter(transaction); + CDOResource resource = transaction.getOrCreateResource(getResourcePath(RESOURCE_NAME)); + Company company = getModel1Factory().createCompany(); + resource.getContents().add(company); + transaction.commit(useMonitor ? new NullProgressMonitor() : null); + String assertMessage = " differents kinds of requests should be sent, QueryRequest, QueryCancel, LoadRevisionsRequest and CommitTransactionRequest"; + int nbExpectedCalls; + Map<Short, Integer> nbRequestsCalls = nbRequestsCallsCounter.getNBRequestsCalls(); + if (!useMonitor) + { + + // QueryRequest, QueryCancel are used to get the resourcePath + nbExpectedCalls = 4; + assertEquals(nbExpectedCalls + assertMessage, nbExpectedCalls, nbRequestsCalls.size()); + assertEquals(true, nbRequestsCalls.containsKey(CDOProtocolConstants.SIGNAL_QUERY)); + assertEquals(true, nbRequestsCalls.containsKey(CDOProtocolConstants.SIGNAL_QUERY_CANCEL)); + assertEquals(true, nbRequestsCalls.containsKey(CDOProtocolConstants.SIGNAL_LOAD_REVISIONS)); + assertEquals(true, nbRequestsCalls.containsKey(CDOProtocolConstants.SIGNAL_COMMIT_TRANSACTION)); + } + else + { + nbExpectedCalls = 5; + assertMessage += " and MonitorProgressIndications should be received"; + // QueryRequest, QueryCancel are used to get the resourcePath + assertEquals(nbExpectedCalls + assertMessage, nbExpectedCalls, nbRequestsCalls.size()); + assertEquals(true, nbRequestsCalls.containsKey(CDOProtocolConstants.SIGNAL_QUERY)); + assertEquals(true, nbRequestsCalls.containsKey(CDOProtocolConstants.SIGNAL_QUERY_CANCEL)); + assertEquals(true, nbRequestsCalls.containsKey(CDOProtocolConstants.SIGNAL_LOAD_REVISIONS)); + assertEquals(true, nbRequestsCalls.containsKey(CDOProtocolConstants.SIGNAL_COMMIT_TRANSACTION)); + assertEquals(true, nbRequestsCalls.containsKey(SignalProtocol.SIGNAL_MONITOR_PROGRESS)); + } + } + + class NBRequestsCallsCounter implements IListener + { + private Map<Short, Integer> nbRequestsCalls = new HashMap<Short, Integer>(); + + public NBRequestsCallsCounter(CDOView view) + { + + InternalCDOSession internalCDOSession = (InternalCDOSession)view.getSession(); + CDOSessionProtocol sessionProtocol = internalCDOSession.getSessionProtocol(); + CDOClientProtocol cdoClientProtocol = null; + if (sessionProtocol instanceof CDOClientProtocol) + { + cdoClientProtocol = (CDOClientProtocol)sessionProtocol; + } + else if (sessionProtocol instanceof DelegatingSessionProtocol) + { + DelegatingSessionProtocol delegatingSessionProtocol = (DelegatingSessionProtocol)sessionProtocol; + CDOSessionProtocol delegate = delegatingSessionProtocol.getDelegate(); + if (delegate instanceof CDOClientProtocol) + { + cdoClientProtocol = (CDOClientProtocol)delegate; + } + } + if (cdoClientProtocol != null) + { + cdoClientProtocol.addListener(this); + } + } + + public void notifyEvent(IEvent event) + { + if (event instanceof SignalScheduledEvent) + { + @SuppressWarnings("unchecked") + SignalScheduledEvent<Object> signalScheduledEvent = (SignalScheduledEvent<Object>)event; + Signal signal = signalScheduledEvent.getSignal(); + short signalID = signal.getID(); + Integer nbRequestCalls = nbRequestsCalls.get(signalID); + if (nbRequestCalls == null) + { + nbRequestCalls = 0; + } + nbRequestCalls++; + nbRequestsCalls.put(signalID, nbRequestCalls); + } + } + + public Map<Short, Integer> getNBRequestsCalls() + { + return nbRequestsCalls; + } + + } + + class CommitTransactionIndicationWaiting implements CDOCommitInfoHandler + { + + public void handleCommitInfo(CDOCommitInfo commitInfo) + { + try + { + Thread.sleep(1000 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS / 2); + } + catch (InterruptedException ex) + { + ex.printStackTrace(); + } + } + + } +} diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF index 18a4b28d15..fbd44670ee 100644 --- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.cdo.ui;singleton:=true -Bundle-Version: 4.3.0.qualifier +Bundle-Version: 4.3.100.qualifier Bundle-Activator: org.eclipse.emf.cdo.internal.ui.bundle.OM$Activator Bundle-Vendor: %providerName Bundle-ClassPath: . @@ -23,8 +23,8 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)";reso org.eclipse.emf.cdo.transfer.ui;bundle-version="[4.2.0,5.0.0)";visibility:=reexport, org.eclipse.emf.cdo.transfer.repository;bundle-version="[4.2.0,5.0.0)";visibility:=reexport, org.eclipse.emf.cdo.ui.shared;bundle-version="[4.0.0,5.0.0)" -Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-internal:=true, - org.eclipse.emf.cdo.internal.ui.messages;version="4.3.0"; +Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.100";x-internal:=true, + org.eclipse.emf.cdo.internal.ui.messages;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -33,7 +33,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -42,7 +42,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.actions;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.actions;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -51,7 +51,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.dialogs;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.dialogs;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -60,7 +60,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.dnd;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.dnd;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -69,7 +69,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.editor;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.editor;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -78,7 +78,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.filters;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.filters;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -87,7 +87,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.history;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.history;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -96,7 +96,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.perspectives;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.perspectives;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -105,7 +105,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.preferences;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.preferences;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -114,7 +114,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.transfer;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.transfer;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -123,7 +123,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.internal.ui.views;version="4.3.0"; + org.eclipse.emf.cdo.internal.ui.views;version="4.3.100"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, org.eclipse.emf.cdo.ui.location, @@ -132,5 +132,5 @@ Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-interna org.eclipse.emf.cdo.explorer, org.eclipse.emf.cdo.ui.team, org.eclipse.emf.cdo.ui.compare", - org.eclipse.emf.cdo.ui;version="4.3.0", - org.eclipse.emf.cdo.ui.widgets;version="4.3.0" + org.eclipse.emf.cdo.ui;version="4.3.100", + org.eclipse.emf.cdo.ui.widgets;version="4.3.100" diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SwitchTargetAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SwitchTargetAction.java index 71022fd514..33e5b54e1d 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SwitchTargetAction.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SwitchTargetAction.java @@ -84,6 +84,6 @@ public class SwitchTargetAction extends AbstractViewAction protected void doRun(IProgressMonitor progressMonitor) throws Exception { CDOView view = getView(); - view.setBranchPoint(target); + view.setBranchPoint(target, progressMonitor); } } diff --git a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF index f252ccda1a..80e9747591 100644 --- a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.emf.cdo; singleton:=true -Bundle-Version: 4.3.100.qualifier +Bundle-Version: 4.4.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -10,43 +10,43 @@ Bundle-Activator: org.eclipse.emf.internal.cdo.bundle.Activator$Implementation Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)";resolution:=optional, org.eclipse.emf.cdo.common;bundle-version="[4.0.0,5.0.0)";visibility:=reexport -Export-Package: org.eclipse.emf.cdo;version="4.3.100", - org.eclipse.emf.cdo.eresource;version="4.3.100", - org.eclipse.emf.cdo.eresource.impl;version="4.3.100", - org.eclipse.emf.cdo.eresource.util;version="4.3.100", - org.eclipse.emf.cdo.eresource.validation;version="4.3.100", - org.eclipse.emf.cdo.etypes;version="4.3.100", - org.eclipse.emf.cdo.etypes.impl;version="4.3.100", - org.eclipse.emf.cdo.etypes.util;version="4.3.100", - org.eclipse.emf.cdo.session;version="4.3.100", - org.eclipse.emf.cdo.session.remote;version="4.3.100", - org.eclipse.emf.cdo.transaction;version="4.3.100", - org.eclipse.emf.cdo.util;version="4.3.100", - org.eclipse.emf.cdo.view;version="4.3.100", - org.eclipse.emf.internal.cdo;version="4.3.100", - org.eclipse.emf.internal.cdo.analyzer;version="4.3.100"; +Export-Package: org.eclipse.emf.cdo;version="4.4.0", + org.eclipse.emf.cdo.eresource;version="4.4.0", + org.eclipse.emf.cdo.eresource.impl;version="4.4.0", + org.eclipse.emf.cdo.eresource.util;version="4.4.0", + org.eclipse.emf.cdo.eresource.validation;version="4.4.0", + org.eclipse.emf.cdo.etypes;version="4.4.0", + org.eclipse.emf.cdo.etypes.impl;version="4.4.0", + org.eclipse.emf.cdo.etypes.util;version="4.4.0", + org.eclipse.emf.cdo.session;version="4.4.0", + org.eclipse.emf.cdo.session.remote;version="4.4.0", + org.eclipse.emf.cdo.transaction;version="4.4.0", + org.eclipse.emf.cdo.util;version="4.4.0", + org.eclipse.emf.cdo.view;version="4.4.0", + org.eclipse.emf.internal.cdo;version="4.4.0", + org.eclipse.emf.internal.cdo.analyzer;version="4.4.0"; x-friends:="org.eclipse.emf.cdo.net4j, org.eclipse.emf.cdo.server, org.eclipse.emf.cdo.tests, org.eclipse.emf.cdo.defs, org.eclipse.emf.cdo.ui", - org.eclipse.emf.internal.cdo.bundle;version="4.3.100";x-friends:="org.eclipse.emf.cdo.ui", - org.eclipse.emf.internal.cdo.messages;version="4.3.100";x-internal:=true, - org.eclipse.emf.internal.cdo.object;version="4.3.100"; + org.eclipse.emf.internal.cdo.bundle;version="4.4.0";x-friends:="org.eclipse.emf.cdo.ui", + org.eclipse.emf.internal.cdo.messages;version="4.4.0";x-internal:=true, + org.eclipse.emf.internal.cdo.object;version="4.4.0"; x-friends:="org.eclipse.emf.cdo.net4j, org.eclipse.emf.cdo.server, org.eclipse.emf.cdo.tests, org.eclipse.emf.cdo.defs, org.eclipse.emf.cdo.ui, org.eclipse.emf.cdo.ui.ide", - org.eclipse.emf.internal.cdo.query;version="4.3.100"; + org.eclipse.emf.internal.cdo.query;version="4.4.0"; x-friends:="org.eclipse.emf.cdo.net4j, org.eclipse.emf.cdo.server, org.eclipse.emf.cdo.tests, org.eclipse.emf.cdo.defs, org.eclipse.emf.cdo.ui, org.eclipse.emf.cdo.tests.objectivity", - org.eclipse.emf.internal.cdo.session;version="4.3.100"; + org.eclipse.emf.internal.cdo.session;version="4.4.0"; x-friends:="org.eclipse.emf.cdo.net4j, org.eclipse.emf.cdo.server, org.eclipse.emf.cdo.tests, @@ -55,30 +55,30 @@ Export-Package: org.eclipse.emf.cdo;version="4.3.100", org.eclipse.emf.cdo.team, org.eclipse.emf.cdo.ui.admin, org.eclipse.emf.cdo.security.ui", - org.eclipse.emf.internal.cdo.session.remote;version="4.3.100"; + org.eclipse.emf.internal.cdo.session.remote;version="4.4.0"; x-friends:="org.eclipse.emf.cdo.net4j, org.eclipse.emf.cdo.server, org.eclipse.emf.cdo.tests, org.eclipse.emf.cdo.defs, org.eclipse.emf.cdo.ui", - org.eclipse.emf.internal.cdo.transaction;version="4.3.100"; + org.eclipse.emf.internal.cdo.transaction;version="4.4.0"; x-friends:="org.eclipse.emf.cdo.net4j, org.eclipse.emf.cdo.server, org.eclipse.emf.cdo.tests, org.eclipse.emf.cdo.defs, org.eclipse.emf.cdo.ui", - org.eclipse.emf.internal.cdo.util;version="4.3.100"; + org.eclipse.emf.internal.cdo.util;version="4.4.0"; x-friends:="org.eclipse.emf.cdo.net4j, org.eclipse.emf.cdo.server, org.eclipse.emf.cdo.tests, org.eclipse.emf.cdo.defs, org.eclipse.emf.cdo.ui", - org.eclipse.emf.internal.cdo.view;version="4.3.100"; + org.eclipse.emf.internal.cdo.view;version="4.4.0"; x-friends:="org.eclipse.emf.cdo.net4j, org.eclipse.emf.cdo.server, org.eclipse.emf.cdo.tests, org.eclipse.emf.cdo.defs, org.eclipse.emf.cdo.ui, org.eclipse.emf.cdo.ui.ide", - org.eclipse.emf.spi.cdo;version="4.3.100" + org.eclipse.emf.spi.cdo;version="4.4.0" Bundle-ActivationPolicy: lazy diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java index 2708b07626..d7ae42e67e 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java @@ -839,21 +839,53 @@ public class CDOPushTransaction extends Notifier implements CDOTransaction return delegate.setBranchPoint(branch, timeStamp); } + /** + * @since 4.4 + */ + public boolean setBranchPoint(CDOBranch branch, long timeStamp, IProgressMonitor monitor) + { + return delegate.setBranchPoint(branch, timeStamp, monitor); + } + public boolean setBranchPoint(CDOBranchPoint branchPoint) { return delegate.setBranchPoint(branchPoint); } + /** + * @since 4.4 + */ + public boolean setBranchPoint(CDOBranchPoint branchPoint, IProgressMonitor monitor) + { + return delegate.setBranchPoint(branchPoint, monitor); + } + public boolean setBranch(CDOBranch branch) { return delegate.setBranch(branch); } + /** + * @since 4.4 + */ + public boolean setBranch(CDOBranch branch, IProgressMonitor monitor) + { + return delegate.setBranch(branch, monitor); + } + public boolean setTimeStamp(long timeStamp) { return delegate.setTimeStamp(timeStamp); } + /** + * @since 4.4 + */ + public boolean setTimeStamp(long timeStamp, IProgressMonitor monitor) + { + return delegate.setTimeStamp(timeStamp, monitor); + } + public URIHandler getURIHandler() { return delegate.getURIHandler(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java index 1fbcd114f8..ef8eb9eeb3 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java @@ -51,6 +51,8 @@ import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.URIHandler; +import org.eclipse.core.runtime.IProgressMonitor; + import java.util.Collection; import java.util.List; import java.util.Map; @@ -91,7 +93,7 @@ import java.util.Set; * @apiviz.uses {@link CDOViewTargetChangedEvent} - - fires */ public interface CDOView extends CDOCommonView, CDOUpdatable, CDOCommitHistory.Provider<CDOObject, CDOObjectHistory>, - IContainer<CDOResourceNode> +IContainer<CDOResourceNode> { /** * Returns the {@link CDOSession session} this view was opened by. @@ -135,6 +137,13 @@ public interface CDOView extends CDOCommonView, CDOUpdatable, CDOCommitHistory.P public boolean setBranchPoint(CDOBranch branch, long timeStamp); /** + * Same as {@link CDOView#setBranchPoint(CDOBranch, long)} with a {@link IProgressMonitor}. + * + * @since 4.4 + */ + public boolean setBranchPoint(CDOBranch branch, long timeStamp, IProgressMonitor monitor); + + /** * Same as calling {@link #setBranchPoint(CDOBranch, long) setBranchPoint(branchPoint.getBranch(), * branchPoint.getTimeStamp())}. * @@ -143,6 +152,13 @@ public interface CDOView extends CDOCommonView, CDOUpdatable, CDOCommitHistory.P public boolean setBranchPoint(CDOBranchPoint branchPoint); /** + * Same as calling {@link #setBranchPoint(CDOBranchPoint)} with a {@link IProgressMonitor} . + * + * @since 4.4 + */ + public boolean setBranchPoint(CDOBranchPoint branchPoint, IProgressMonitor monitor); + + /** * Same as calling {@link #setBranchPoint(CDOBranch, long) setBranchPoint(branch, getTimeStamp())}. * * @since 3.0 @@ -150,6 +166,13 @@ public interface CDOView extends CDOCommonView, CDOUpdatable, CDOCommitHistory.P public boolean setBranch(CDOBranch branch); /** + * Same as {@link CDOView#setBranch(CDOBranch)} with {@link IProgressMonitor}. + * + * @since 4.4 + */ + public boolean setBranch(CDOBranch branch, IProgressMonitor monitor); + + /** * Same as calling {@link #setBranchPoint(CDOBranch, long) setBranchPoint(getBranch(), timeStamp)}. * * @since 3.0 @@ -157,6 +180,13 @@ public interface CDOView extends CDOCommonView, CDOUpdatable, CDOCommitHistory.P public boolean setTimeStamp(long timeStamp); /** + * Same as {@link CDOView#setTimeStamp(long)} with {@link IProgressMonitor}. + * + * @since 4.4 + */ + public boolean setTimeStamp(long timeStamp, IProgressMonitor monitor); + + /** * @since 4.0 */ public boolean isInvalidationRunnerActive(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java index 7cd3431b2f..de2d81a321 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java @@ -59,7 +59,7 @@ public class CDOSingleTransactionStrategyImpl implements CDOTransactionStrategy InternalCDOSession session = transaction.getSession(); CDOSessionProtocol sessionProtocol = session.getSessionProtocol(); - OMMonitor monitor = new EclipseMonitor(progressMonitor); + OMMonitor monitor = progressMonitor != null ? new EclipseMonitor(progressMonitor) : null; CommitTransactionResult result = sessionProtocol.commitTransaction(commitContext, monitor); commitContext.postCommit(result); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java index 3b8a7fda66..6661dcbf34 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java @@ -167,7 +167,6 @@ import org.eclipse.emf.spi.cdo.InternalCDOTransaction; import org.eclipse.emf.spi.cdo.InternalCDOViewSet; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; import java.io.IOException; import java.io.InputStream; @@ -1266,11 +1265,6 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa token = getSession().startLocalCommit(); - if (progressMonitor == null) - { - progressMonitor = new NullProgressMonitor(); - } - CDOTransactionStrategy transactionStrategy = getTransactionStrategy(); CDOCommitInfo info = transactionStrategy.commit(this, progressMonitor); if (info != null) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java index 940e036e0e..5c34f4a587 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java @@ -24,7 +24,6 @@ import org.eclipse.emf.cdo.view.CDOViewSet; import org.eclipse.emf.internal.cdo.bundle.OM; import org.eclipse.emf.internal.cdo.messages.Messages; -import org.eclipse.net4j.util.CheckUtil; import org.eclipse.net4j.util.WrappedException; import org.eclipse.net4j.util.om.monitor.EclipseMonitor; import org.eclipse.net4j.util.om.monitor.EclipseMonitor.SynchronizedSubProgressMonitor; @@ -45,7 +44,6 @@ import org.eclipse.emf.spi.cdo.InternalCDOXATransaction; import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext.CDOXAState; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.SubProgressMonitor; import java.text.MessageFormat; @@ -213,14 +211,20 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction throws InterruptedException, ExecutionException { int xaContextSize = xaContexts.size(); - progressMonitor.beginTask("", xaContextSize); //$NON-NLS-1$ + if (progressMonitor != null) + { + progressMonitor.beginTask("", xaContextSize); //$NON-NLS-1$ + } try { Map<Future<Object>, InternalCDOXACommitContext> futures = new HashMap<Future<Object>, InternalCDOXACommitContext>(); for (InternalCDOXACommitContext xaContext : xaContexts) { - xaContext.setProgressMonitor(new SynchronizedSubProgressMonitor(progressMonitor, 1)); + if (progressMonitor != null) + { + xaContext.setProgressMonitor(new SynchronizedSubProgressMonitor(progressMonitor, 1)); + } Future<Object> future = executorService.submit(xaContext); futures.put(future, xaContext); } @@ -259,7 +263,10 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction } finally { - progressMonitor.done(); + if (progressMonitor != null) + { + progressMonitor.done(); + } for (InternalCDOXACommitContext xaContext : xaContexts) { xaContext.setProgressMonitor(null); @@ -289,7 +296,7 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction public CDOCommitInfo commit() throws CommitException { - return commit(new NullProgressMonitor()); + return commit(null); } public CDOCommitInfo commit(IProgressMonitor progressMonitor) throws CommitException @@ -320,8 +327,10 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction public void commitPrepare(IProgressMonitor progressMonitor) { - CheckUtil.checkArg(progressMonitor, "progressMonitor"); //$NON-NLS-1$ - progressMonitor.beginTask(Messages.getString("CDOXATransactionImpl.4"), 3); //$NON-NLS-1$ + if (progressMonitor != null) + { + progressMonitor.beginTask(Messages.getString("CDOXATransactionImpl.4"), 3); //$NON-NLS-1$ + } for (InternalCDOTransaction transaction : transactions) { @@ -334,7 +343,7 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction public void commitPhase(IProgressMonitor progressMonitor) throws InterruptedException, ExecutionException { - send(activeContexts.values(), new SubProgressMonitor(progressMonitor, 1)); + send(activeContexts.values(), progressMonitor != null ? new SubProgressMonitor(progressMonitor, 1) : null); } public void commitException(IProgressMonitor progressMonitor, int phase, Exception ex) throws CommitException @@ -349,7 +358,8 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction try { - send(activeContexts.values(), new SubProgressMonitor(progressMonitor, 2 - phase)); + send(activeContexts.values(), progressMonitor != null ? new SubProgressMonitor(progressMonitor, 2 - phase) + : null); } catch (InterruptedException ex1) { @@ -367,7 +377,10 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction public void commitFinally(IProgressMonitor progressMonitor) { cleanUp(); - progressMonitor.done(); + if (progressMonitor != null) + { + progressMonitor.done(); + } } public InternalCDOXASavepoint getLastSavepoint() @@ -623,7 +636,7 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction if (xaContext.getTransaction().isDirty()) { CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol(); - OMMonitor monitor = new EclipseMonitor(progressMonitor); + OMMonitor monitor = progressMonitor != null ? new EclipseMonitor(progressMonitor) : null; result = sessionProtocol.commitXATransactionPhase1(xaContext, monitor); check_result(result); } @@ -656,7 +669,7 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction if (xaContext.getTransaction().isDirty()) { CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol(); - OMMonitor monitor = new EclipseMonitor(progressMonitor); + OMMonitor monitor = progressMonitor != null ? new EclipseMonitor(progressMonitor) : null; CommitTransactionResult result = sessionProtocol.commitXATransactionPhase2(xaContext, monitor); check_result(result); } @@ -688,7 +701,7 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction if (xaContext.getTransaction().isDirty()) { CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol(); - OMMonitor monitor = new EclipseMonitor(progressMonitor); + OMMonitor monitor = progressMonitor != null ? new EclipseMonitor(progressMonitor) : null; CommitTransactionResult result = sessionProtocol.commitXATransactionPhase3(xaContext, monitor); check_result(result); } @@ -719,7 +732,7 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction public void handle(InternalCDOXACommitContext xaContext, IProgressMonitor progressMonitor) throws Exception { CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol(); - OMMonitor monitor = new EclipseMonitor(progressMonitor); + OMMonitor monitor = progressMonitor != null ? new EclipseMonitor(progressMonitor) : null; CommitTransactionResult result = sessionProtocol.commitXATransactionCancel(xaContext, monitor); check_result(result); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java index 049196914d..5bd8ec4b46 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java @@ -111,6 +111,7 @@ import org.eclipse.emf.spi.cdo.InternalCDOObject; import org.eclipse.emf.spi.cdo.InternalCDOView; import org.eclipse.emf.spi.cdo.InternalCDOViewSet; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Platform; import java.io.IOException; @@ -421,18 +422,38 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb public synchronized boolean setBranch(CDOBranch branch) { - return setBranchPoint(branch, getTimeStamp()); + return setBranchPoint(branch, getTimeStamp(), null); + } + + public synchronized boolean setBranch(CDOBranch branch, IProgressMonitor monitor) + { + return setBranchPoint(branch, getTimeStamp(), monitor); } public synchronized boolean setTimeStamp(long timeStamp) { - return setBranchPoint(getBranch(), timeStamp); + return setBranchPoint(getBranch(), timeStamp, null); + } + + public synchronized boolean setTimeStamp(long timeStamp, IProgressMonitor monitor) + { + return setBranchPoint(getBranch(), timeStamp, monitor); } public synchronized boolean setBranchPoint(CDOBranch branch, long timeStamp) { + return setBranchPoint(branch, timeStamp, null); + } + + public synchronized boolean setBranchPoint(CDOBranch branch, long timeStamp, IProgressMonitor monitor) + { CDOBranchPoint branchPoint = branch.getPoint(timeStamp); - return setBranchPoint(branchPoint); + return setBranchPoint(branchPoint, monitor); + } + + public synchronized boolean setBranchPoint(CDOBranchPoint branchPoint) + { + return setBranchPoint(branchPoint, null); } protected synchronized void basicSetBranchPoint(CDOBranchPoint branchPoint) @@ -1169,13 +1190,13 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb cleanObject(object, revision); CDOStateMachine.INSTANCE.dispatchLoadNotification(object); - - // Bug 435198: Have object's resource added to the ResourceSet on call to CDOView.getObject(CDOID) + + // Bug 435198: Have object's resource added to the ResourceSet on call to CDOView.getObject(CDOID) if (!CDOModelUtil.isResource(eClass)) { getStore().getResource(object); } - + return object; } 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 6c9b1530ca..056ff190c5 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 @@ -94,7 +94,7 @@ import org.eclipse.emf.spi.cdo.InternalCDOTransaction; import org.eclipse.emf.spi.cdo.InternalCDOView; import org.eclipse.emf.spi.cdo.InternalCDOViewSet; -import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.IProgressMonitor; import java.text.MessageFormat; import java.util.ArrayList; @@ -192,7 +192,7 @@ public class CDOViewImpl extends AbstractCDOView return session.getSessionID(); } - public synchronized boolean setBranchPoint(CDOBranchPoint branchPoint) + public synchronized boolean setBranchPoint(CDOBranchPoint branchPoint, IProgressMonitor progressMonitor) { checkActive(); @@ -232,7 +232,7 @@ public class CDOViewImpl extends AbstractCDOView } CDOSessionProtocol sessionProtocol = getSession().getSessionProtocol(); - OMMonitor monitor = new EclipseMonitor(new NullProgressMonitor()); + OMMonitor monitor = progressMonitor != null ? new EclipseMonitor(progressMonitor) : null; sessionProtocol.switchTarget(viewID, branchPoint, invalidObjects, allChangedObjects, allDetachedObjects, monitor); basicSetBranchPoint(branchPoint); diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IndicationWithMonitoring.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IndicationWithMonitoring.java index 8f971c2a3a..4c002cd719 100644 --- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IndicationWithMonitoring.java +++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IndicationWithMonitoring.java @@ -16,6 +16,7 @@ import org.eclipse.net4j.channel.IChannel; import org.eclipse.net4j.util.io.ExtendedDataInputStream; import org.eclipse.net4j.util.io.ExtendedDataOutputStream; import org.eclipse.net4j.util.lifecycle.LifecycleUtil; +import org.eclipse.net4j.util.om.monitor.Monitor; import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.net4j.util.om.monitor.TimeoutMonitor; @@ -32,7 +33,7 @@ import java.util.concurrent.ExecutorService; */ public abstract class IndicationWithMonitoring extends IndicationWithResponse { - private ReportingMonitor monitor; + private Monitor monitor; /** * @since 2.0 @@ -78,19 +79,29 @@ public abstract class IndicationWithMonitoring extends IndicationWithResponse @Override protected final void indicating(ExtendedDataInputStream in) throws Exception { - int monitorProgressSeconds = in.readInt(); - int monitorTimeoutSeconds = in.readInt(); - - monitor = new ReportingMonitor(monitorProgressSeconds, monitorTimeoutSeconds); + OMMonitor subMonitor = null; + boolean useMonitor = in.readBoolean(); + if (useMonitor) + { + int monitorProgressSeconds = in.readInt(); + int monitorTimeoutSeconds = in.readInt(); + monitor = new ReportingMonitor(monitorProgressSeconds, monitorTimeoutSeconds); + } + else + { + int monitorTimeoutSeconds = in.readInt(); + monitor = new TimeoutMonitor(1000L * monitorTimeoutSeconds); + } monitor.begin(OMMonitor.HUNDRED); - - indicating(in, monitor.fork(getIndicatingWorkPercent())); + subMonitor = monitor.fork(getIndicatingWorkPercent()); + indicating(in, subMonitor); } @Override protected final void responding(ExtendedDataOutputStream out) throws Exception { - responding(out, monitor.fork(OMMonitor.HUNDRED - getIndicatingWorkPercent())); + OMMonitor subMonitor = monitor != null ? monitor.fork(OMMonitor.HUNDRED - getIndicatingWorkPercent()) : null; + responding(out, subMonitor); } protected abstract void indicating(ExtendedDataInputStream in, OMMonitor monitor) throws Exception; diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithMonitoring.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithMonitoring.java index 7d3b1df11a..5d09e6fded 100644 --- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithMonitoring.java +++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithMonitoring.java @@ -16,7 +16,6 @@ import org.eclipse.net4j.util.ImplementationError; import org.eclipse.net4j.util.concurrent.ConcurrencyUtil; import org.eclipse.net4j.util.io.ExtendedDataInputStream; import org.eclipse.net4j.util.io.ExtendedDataOutputStream; -import org.eclipse.net4j.util.om.monitor.Monitor; import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.internal.net4j.bundle.OM; @@ -80,95 +79,100 @@ public abstract class RequestWithMonitoring<RESULT> extends RequestWithConfirmat @Override public Future<RESULT> sendAsync() { - initMainMonitor(null); return super.sendAsync(); } public Future<RESULT> sendAsync(OMMonitor monitor) { - initMainMonitor(monitor); + mainMonitor = monitor; return super.sendAsync(); } @Override public RESULT send() throws Exception, RemoteException { - initMainMonitor(null); return super.send(); } @Override public RESULT send(long timeout) throws Exception, RemoteException { - initMainMonitor(null); return super.send(timeout); } public RESULT send(OMMonitor monitor) throws Exception, RemoteException { - initMainMonitor(monitor); + mainMonitor = monitor; return super.send(); } public RESULT send(long timeout, OMMonitor monitor) throws Exception, RemoteException { - initMainMonitor(monitor); + mainMonitor = monitor; return super.send(timeout); } @Override protected final void requesting(ExtendedDataOutputStream out) throws Exception { - double remoteWork = OMMonitor.HUNDRED - getRequestingWorkPercent() - getConfirmingWorkPercent(); - if (remoteWork < OMMonitor.ZERO) + OMMonitor fork = null; + boolean useMonitor = mainMonitor != null; + out.writeBoolean(useMonitor); + if (useMonitor) { - throw new ImplementationError("Remote work must not be negative: " + remoteWork); //$NON-NLS-1$ - } + double remoteWork = OMMonitor.HUNDRED - getRequestingWorkPercent() - getConfirmingWorkPercent(); + if (remoteWork < OMMonitor.ZERO) + { + throw new ImplementationError("Remote work must not be negative: " + remoteWork); //$NON-NLS-1$ + } - mainMonitor.begin(OMMonitor.HUNDRED); - OMMonitor subMonitor = mainMonitor.fork(remoteWork); - synchronized (monitorLock) - { - remoteMonitor = subMonitor; - } + mainMonitor.begin(OMMonitor.HUNDRED); + OMMonitor subMonitor = mainMonitor.fork(remoteWork); + synchronized (monitorLock) + { + remoteMonitor = subMonitor; + } - ExecutorService executorService = getCancelationExecutorService(); - if (executorService != null) - { - executorService.execute(new Runnable() + ExecutorService executorService = getCancelationExecutorService(); + if (executorService != null) { - public void run() + executorService.execute(new Runnable() { - while (mainMonitor != null) + public void run() { - ConcurrencyUtil.sleep(getCancelationPollInterval()); - if (mainMonitor != null && mainMonitor.isCanceled()) + while (mainMonitor != null) { - try + ConcurrencyUtil.sleep(getCancelationPollInterval()); + if (mainMonitor != null && mainMonitor.isCanceled()) { - new MonitorCanceledRequest(getProtocol(), getCorrelationID()).sendAsync(); + try + { + new MonitorCanceledRequest(getProtocol(), getCorrelationID()).sendAsync(); + } + catch (Exception ex) + { + OM.LOG.error(ex); + } + + return; } - catch (Exception ex) - { - OM.LOG.error(ex); - } - - return; } } - } - }); - } + }); + } - out.writeInt(getMonitorProgressSeconds()); + out.writeInt(getMonitorProgressSeconds()); + fork = mainMonitor.fork(getRequestingWorkPercent()); + } out.writeInt(getMonitorTimeoutSeconds()); - requesting(out, mainMonitor.fork(getRequestingWorkPercent())); + requesting(out, fork); } @Override protected final RESULT confirming(ExtendedDataInputStream in) throws Exception { - return confirming(in, mainMonitor.fork(getConfirmingWorkPercent())); + OMMonitor monitor = mainMonitor != null ? mainMonitor.fork(getConfirmingWorkPercent()) : null; + return confirming(in, monitor); } protected abstract void requesting(ExtendedDataOutputStream out, OMMonitor monitor) throws Exception; @@ -297,8 +301,4 @@ public abstract class RequestWithMonitoring<RESULT> extends RequestWithConfirmat } } - private void initMainMonitor(OMMonitor monitor) - { - mainMonitor = monitor == null ? new Monitor() : monitor; - } } |