Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-07-17 10:48:24 -0400
committerUwe Stieber2014-07-17 10:48:51 -0400
commit3231b94b71c953edd1011060daff67f38aec5608 (patch)
treeb278fdfadfae75608dd9cd56fb8ce66013ff5848
parent941998cc33f6c2eaaf719d067e1b871c3b3cbf43 (diff)
downloadorg.eclipse.tcf-3231b94b71c953edd1011060daff67f38aec5608.tar.gz
org.eclipse.tcf-3231b94b71c953edd1011060daff67f38aec5608.tar.xz
org.eclipse.tcf-3231b94b71c953edd1011060daff67f38aec5608.zip
Target Explorer: Fix value-add shutdown if a private channel is closed while a shared channel is still open
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager2.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ShutdownValueAddStep.java25
2 files changed, 29 insertions, 8 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager2.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager2.java
index 279b44894..58dbd7dae 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager2.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager2.java
@@ -39,6 +39,7 @@ import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator;
import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
import org.eclipse.tcf.te.tcf.core.interfaces.steps.ITcfStepAttributes;
import org.eclipse.tcf.te.tcf.core.interfaces.tracing.ITraceIds;
+import org.eclipse.tcf.te.tcf.core.internal.channelmanager.steps.ShutdownValueAddStep;
import org.eclipse.tcf.te.tcf.core.nls.Messages;
/**
@@ -397,6 +398,17 @@ public class ChannelManager2 extends PlatformObject implements IChannelManager {
// No recent action history persistence
data.setProperty(IStepAttributes.PROP_SKIP_LAST_RUN_HISTORY, true);
+ // Determine if the value-add's can be shutdown or must stay alive.
+ // In case the channel to close is not reference counted, but this is a reference
+ // counted channel to the same peer, and that channel is still open, the
+ // value-adds must stay alive.
+ if (!isRefCounted) {
+ IChannel shared = channels.get(id);
+ if (shared != null && (shared.getState() == IChannel.STATE_OPEN || shared.getState() == IChannel.STATE_OPENING)) {
+ data.setProperty(ShutdownValueAddStep.PROP_SKIP_SHUTDOWN_STEP, true);
+ }
+ }
+
// Create the callback to be invoked once the "close channel" stepper job is completed
final ICallback callback = new Callback() {
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ShutdownValueAddStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ShutdownValueAddStep.java
index 533433952..9b7388b75 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ShutdownValueAddStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ShutdownValueAddStep.java
@@ -30,6 +30,10 @@ import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd;
* ShutdownValueAddStep
*/
public class ShutdownValueAddStep extends AbstractPeerStep {
+ /**
+ * If set to <code>true</code>, skip the shutdown step.
+ */
+ public static final String PROP_SKIP_SHUTDOWN_STEP = "ShutdownValueAddStep.skip"; //$NON-NLS-1$
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
@@ -61,14 +65,19 @@ public class ShutdownValueAddStep extends AbstractPeerStep {
final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- valueAdd.shutdown(peerId, callback);
- }
- };
+ boolean skip = StepperAttributeUtil.getBooleanProperty(PROP_SKIP_SHUTDOWN_STEP, fullQualifiedId, data);
+ if (!skip) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ valueAdd.shutdown(peerId, callback);
+ }
+ };
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeLater(runnable);
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeLater(runnable);
+ } else {
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
+ }
}
}

Back to the top