Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-07-23 05:56:04 -0400
committerUwe Stieber2014-07-23 05:56:47 -0400
commitea80517f61bcb481d274e04804610868079654f0 (patch)
treedc8a6e84e15de467dc8466803c42efd87b286534
parent12baf1ef574d960283c5cbfbcc80d7494bedc06a (diff)
downloadorg.eclipse.tcf-ea80517f61bcb481d274e04804610868079654f0.tar.gz
org.eclipse.tcf-ea80517f61bcb481d274e04804610868079654f0.tar.xz
org.eclipse.tcf-ea80517f61bcb481d274e04804610868079654f0.zip
Target Explorer: Fix illegal thread access issue in path map service
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
index 39e4f5290..16d25d370 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
@@ -16,6 +16,7 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -319,9 +320,20 @@ public class PathMapService extends AbstractService implements IPathMapService {
// If called as part of the "open channel" step group, IChannelManager.getChannel(peer)
// will return null. For this case, the channel to use is passed as context directly.
- IChannel channel = context instanceof IChannel ? (IChannel)context : null;
+ final IChannel channel = context instanceof IChannel ? (IChannel)context : null;
// The peer in that case is the remote peer of the channel
- if (peer == null && channel != null) peer = channel.getRemotePeer();
+ if (peer == null && channel != null) {
+ final AtomicReference<IPeer> remotePeer = new AtomicReference<IPeer>();
+
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ remotePeer.set(channel.getRemotePeer());
+ }
+ });
+
+ peer = remotePeer.get();
+ }
// Make sure that the callback is invoked in the TCF dispatch thread
final AsyncCallbackCollector collector = new AsyncCallbackCollector(callback, new CallbackInvocationDelegate());

Back to the top