diff options
author | eutarass | 2008-07-02 00:55:17 +0000 |
---|---|---|
committer | eutarass | 2008-07-02 00:55:17 +0000 |
commit | c8c0ed7ca6d7b071b5937da6557655b478033d19 (patch) | |
tree | 20d4d3508b60a9b9a5cb23d00575df102afd889c /plugins/org.eclipse.tm.tcf.debug | |
parent | 4197d7dde1857b07d118d109d6e5a0495d76c2fe (diff) | |
download | org.eclipse.tcf-c8c0ed7ca6d7b071b5937da6557655b478033d19.tar.gz org.eclipse.tcf-c8c0ed7ca6d7b071b5937da6557655b478033d19.tar.xz org.eclipse.tcf-c8c0ed7ca6d7b071b5937da6557655b478033d19.zip |
1. Workaround of deadlock condition in DSF
2. Removed unused interface TCFLaunch.TerminateListener
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug')
2 files changed, 28 insertions, 83 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFLaunchDelegate.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFLaunchDelegate.java index 3cf67e271..b25cb9303 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFLaunchDelegate.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFLaunchDelegate.java @@ -14,7 +14,6 @@ import java.io.IOException; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.model.LaunchConfigurationDelegate; @@ -37,24 +36,21 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate { } public void launch(final ILaunchConfiguration configuration, final String mode, - final ILaunch launch, IProgressMonitor monitor) throws CoreException { - if (monitor == null) monitor = new NullProgressMonitor(); - monitor.beginTask("Launching debugger session", 1); //$NON-NLS-1$ - Protocol.invokeAndWait(new Runnable() { + final ILaunch launch, final IProgressMonitor monitor) throws CoreException { + if (monitor != null) monitor.beginTask("Launching TCF debugger session", 1); //$NON-NLS-1$ + Protocol.invokeLater(new Runnable() { public void run() { try { String id = configuration.getAttribute(TCFLaunchDelegate.ATTR_PEER_ID, ""); IPeer peer = Protocol.getLocator().getPeers().get(id); if (peer == null) throw new IOException("Cannot locate peer " + id); - TCFLaunch.TerminateListener term = null; - if (peer instanceof TCFLaunch.TerminateListener) term = (TCFLaunch.TerminateListener)peer; - ((TCFLaunch)launch).launchTCF(mode, peer, term); + ((TCFLaunch)launch).launchTCF(mode, peer); } catch (Throwable e) { ((TCFLaunch)launch).setError(e); } + if (monitor != null) monitor.done(); } }); - monitor.done(); } } diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java index d3c290c19..8e5283dd7 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java @@ -43,20 +43,10 @@ public class TCFLaunch extends Launch { } - public interface TerminateListener { - - public boolean canTerminate(); - - public boolean isTerminated(); - - public void terminate(Runnable done); - } - private static final Collection<Listener> listeners = new ArrayList<Listener>(); private IChannel channel; private Throwable error; - private TerminateListener terminate_listener; private TCFBreakpointsStatus breakpoints_status; private String mode; private boolean connecting; @@ -108,8 +98,8 @@ public class TCFLaunch extends Launch { for (Iterator<Listener> i = listeners.iterator(); i.hasNext();) { i.next().onDisconnected(this); } - if (error != null) setError(error); - else fireChanged(); + if (error != null) this.error = error; + fireChanged(); runShutdownSequence(new Runnable() { public void run() { shutdown = true; @@ -210,6 +200,9 @@ public class TCFLaunch extends Launch { if (channel != null && channel.getState() == IChannel.STATE_OPEN) { channel.terminate(x); } + else if (!connecting) { + disconnected = true; + } fireChanged(); } @@ -255,86 +248,42 @@ public class TCFLaunch extends Launch { return channel.getRemoteService(cls); } - public boolean canTerminate() { - final boolean res[] = new boolean[1]; - Protocol.invokeAndWait(new Runnable() { - public void run() { - if (terminate_listener == null) res[0] = false; - else res[0] = terminate_listener.canTerminate(); - } - }); - return res[0]; + public boolean canDisconnect() { + return !disconnected; } - public boolean isTerminated() { - final boolean res[] = new boolean[1]; - Protocol.invokeAndWait(new Runnable() { - public void run() { - if (channel == null || channel.getState() == IChannel.STATE_CLOSED) res[0] = true; - else if (terminate_listener == null) res[0] = false; - else res[0] = terminate_listener.isTerminated(); - } - }); - return res[0]; + public boolean isDisconnected() { + return disconnected; } - - public void terminate() { - Protocol.invokeAndWait(new Runnable() { + + public void disconnect() throws DebugException { + Protocol.invokeLater(new Runnable() { public void run() { - if (terminate_listener == null) return; - terminate_listener.terminate(new Runnable() { - public void run() { - fireTerminate(); - } - }); + if (channel != null && channel.getState() != IChannel.STATE_CLOSED) { + channel.close(); + } } }); } - - public void terminate(Runnable done) { - if (terminate_listener == null) done.run(); - else terminate_listener.terminate(done); + + public boolean canTerminate() { + return false; } - public boolean canDisconnect() { - final boolean res[] = new boolean[1]; - Protocol.invokeAndWait(new Runnable() { - public void run() { - res[0] = channel != null && channel.getState() != IChannel.STATE_CLOSED; - } - }); - return res[0]; + public boolean isTerminated() { + return disconnected; } - public boolean isDisconnected() { - final boolean res[] = new boolean[1]; - Protocol.invokeAndWait(new Runnable() { - public void run() { - res[0] = channel == null || channel.getState() == IChannel.STATE_CLOSED; - } - }); - return res[0]; + public void terminate() throws DebugException { } - + public boolean isExited() { return last_context_exited; } - public void disconnect() throws DebugException { - Protocol.invokeAndWait(new Runnable() { - public void run() { - if (channel != null && channel.getState() != IChannel.STATE_CLOSED) { - channel.close(); - } - fireTerminate(); - } - }); - } - - public void launchTCF(String mode, IPeer peer, TerminateListener terminate_listener) throws DebugException { + public void launchTCF(String mode, IPeer peer) throws DebugException { assert Protocol.isDispatchThread(); this.mode = mode; - this.terminate_listener = terminate_listener; connecting = true; channel = peer.openChannel(); channel.addChannelListener(new IChannel.IChannelListener() { |