Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-07-18 09:47:33 -0400
committerUwe Stieber2014-07-18 09:47:33 -0400
commit0750e5747ab70cdf106b0a8f7e7001b4ef73af12 (patch)
treeebe6961ff141b7fc9902f09e3755e415042dc92a
parent8456c650b568031448a2f5613f78e7f39fc40d5e (diff)
downloadorg.eclipse.tcf-0750e5747ab70cdf106b0a8f7e7001b4ef73af12.tar.gz
org.eclipse.tcf-0750e5747ab70cdf106b0a8f7e7001b4ef73af12.tar.xz
org.eclipse.tcf-0750e5747ab70cdf106b0a8f7e7001b4ef73af12.zip
Target Explorer: Fix launch value-add and chain peers steps if channel is opened with no value add flag set
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/LaunchValueAddStep.java67
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/tests/TcfCoreTests.java1
3 files changed, 50 insertions, 34 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java
index a0e5ef47e..44f1a3ec5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/iterators/ChainPeersIterator.java
@@ -22,6 +22,7 @@ import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepAttributes;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
import org.eclipse.tcf.te.tcf.core.interfaces.IPeerProperties;
import org.eclipse.tcf.te.tcf.core.iterators.AbstractPeerStepGroupIterator;
import org.eclipse.tcf.te.tcf.core.util.persistence.PeerDataHelper;
@@ -50,19 +51,22 @@ public class ChainPeersIterator extends AbstractPeerStepGroupIterator {
final IPeer peer = getActivePeerContext(context, data, fullQualifiedId);
final String peerId = peer.getID();
+ final boolean useValueAdds = !StepperAttributeUtil.getBooleanProperty(IChannelManager.FLAG_NO_VALUE_ADD, fullQualifiedId, data);
peers.clear();
Runnable runnable = new Runnable() {
@Override
public void run() {
- IValueAdd[] valueAdds = ValueAddManager.getInstance().getValueAdd(peer);
- for (IValueAdd valueAdd : valueAdds) {
- IPeer valueAddPeer = valueAdd.getPeer(peerId);
- if (valueAddPeer != null) {
- peers.add(valueAddPeer);
+ if (useValueAdds) {
+ IValueAdd[] valueAdds = ValueAddManager.getInstance().getValueAdd(peer);
+ for (IValueAdd valueAdd : valueAdds) {
+ IPeer valueAddPeer = valueAdd.getPeer(peerId);
+ if (valueAddPeer != null) {
+ peers.add(valueAddPeer);
+ }
}
- }
+ }
String proxyConfiguration = peer.getAttributes().get(IPeerProperties.PROP_PROXIES);
if (proxyConfiguration != null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/LaunchValueAddStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/LaunchValueAddStep.java
index d562889e2..0f6c707a1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/LaunchValueAddStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/LaunchValueAddStep.java
@@ -23,6 +23,7 @@ import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
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.steps.AbstractPeerStep;
import org.eclipse.tcf.te.tcf.core.va.interfaces.IValueAdd;
@@ -61,28 +62,33 @@ public class LaunchValueAddStep extends AbstractPeerStep {
final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID();
+ final boolean useValueAdds = !StepperAttributeUtil.getBooleanProperty(IChannelManager.FLAG_NO_VALUE_ADD, fullQualifiedId, data);
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- valueAdd.isAlive(peerId, new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- boolean alive = ((Boolean)getResult()).booleanValue();
+ if (useValueAdds) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ valueAdd.isAlive(peerId, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ boolean alive = ((Boolean)getResult()).booleanValue();
- if (!alive) {
- valueAdd.launch(peerId, callback);
+ if (!alive) {
+ valueAdd.launch(peerId, callback);
+ }
+ else {
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
+ }
}
- else {
- callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
- }
- }
- });
- }
- };
+ });
+ }
+ };
- 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);
+ }
}
/* (non-Javadoc)
@@ -92,17 +98,22 @@ public class LaunchValueAddStep extends AbstractPeerStep {
public void rollback(final IStepContext context, final IPropertiesContainer data, final IStatus status, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
final IValueAdd valueAdd = (IValueAdd)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_VALUE_ADD, fullQualifiedId, data);
final String peerId = getActivePeerContext(context, data, fullQualifiedId).getID();
+ final boolean useValueAdds = !StepperAttributeUtil.getBooleanProperty(IChannelManager.FLAG_NO_VALUE_ADD, fullQualifiedId, data);
- Runnable runnable = new Runnable() {
- @SuppressWarnings("synthetic-access")
- @Override
- public void run() {
- valueAdd.shutdown(peerId, callback);
- LaunchValueAddStep.super.rollback(context, data, status, fullQualifiedId, monitor, callback);
- }
- };
+ if (useValueAdds) {
+ Runnable runnable = new Runnable() {
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void run() {
+ valueAdd.shutdown(peerId, callback);
+ LaunchValueAddStep.super.rollback(context, data, status, fullQualifiedId, monitor, callback);
+ }
+ };
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeLater(runnable);
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeLater(runnable);
+ } else {
+ super.rollback(context, data, status, fullQualifiedId, monitor, callback);
+ }
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/tests/TcfCoreTests.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/tests/TcfCoreTests.java
index 5097c8ef6..670acff4c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/tests/TcfCoreTests.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/tests/TcfCoreTests.java
@@ -84,6 +84,7 @@ public class TcfCoreTests extends TcfTestCase {
int counter = 10;
while (counter > 0 && channel.getState() != IChannel.STATE_CLOSED) {
waitAndDispatch(200);
+ counter--;
}
assertTrue("Channel is not in expected closed action.", channel.getState() == IChannel.STATE_CLOSED); //$NON-NLS-1$
}

Back to the top