diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java index 623d08cd563..a453d67d7c1 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java @@ -47,6 +47,7 @@ * David McKnight (IBM) - [226787] [services] Dstore processes subsystem is empty after switching from shell processes * David McKnight (IBM) - [262930] Remote System Details view not restoring filter memento input * David McKnight (IBM) - [272882] [api] Handle exceptions in IService.initService() + * David McKnight (IBM) - [284018] concurrent SubSystem.connect() calls can result in double login-prompt ********************************************************************************/ package org.eclipse.rse.core.subsystems; @@ -2460,34 +2461,41 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider final Exception[] exception=new Exception[1]; exception[0]=null; - Display.getDefault().syncExec(new Runnable() { - public void run() { - try - { - promptForPassword(promptForPassword); - } catch(Exception e) { - exception[0]=e; - } - } - }); - try { - Exception e = exception[0]; - if (e == null) { - getConnectorService().connect(monitor); - if (isConnected()) { - final SubSystem ss = this; - //Notify connect status change - Display.getDefault().asyncExec(new Runnable() { - public void run() { - RSECorePlugin.getTheSystemRegistry().connectedStatusChange(ss, true, false); + + IConnectorService conServ = getConnectorService(); + synchronized (conServ){ + if (!conServ.isConnected()){ + Display.getDefault().syncExec(new Runnable() { + public void run() { + try + { + promptForPassword(promptForPassword); + } catch(Exception e) { + exception[0]=e; } - }); - } - } else { - throw e; + } + }); + } + + try { + Exception e = exception[0]; + if (e == null) { + getConnectorService().connect(monitor); + if (isConnected()) { + final SubSystem ss = this; + //Notify connect status change + Display.getDefault().asyncExec(new Runnable() { + public void run() { + RSECorePlugin.getTheSystemRegistry().connectedStatusChange(ss, true, false); + } + }); + } + } else { + throw e; + } + } finally { + monitor.done(); } - } finally { - monitor.done(); } } }