mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 12:35:22 +02:00
[284018] concurrent SubSystem.connect() calls can result in double login-prompt
This commit is contained in:
parent
a789b21339
commit
b9e5cdfd79
1 changed files with 53 additions and 8 deletions
|
@ -48,7 +48,7 @@
|
||||||
* David McKnight (IBM) - [262930] Remote System Details view not restoring filter memento input
|
* 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) - [272882] [api] Handle exceptions in IService.initService()
|
||||||
* David McKnight (IBM) - [284018] concurrent SubSystem.connect() calls can result in double login-prompt
|
* David McKnight (IBM) - [284018] concurrent SubSystem.connect() calls can result in double login-prompt
|
||||||
********************************************************************************/
|
* ********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.core.subsystems;
|
package org.eclipse.rse.core.subsystems;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
@ -2443,6 +2443,41 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
|
||||||
_isInitialized = false;
|
_isInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static class ConnectorServicePool {
|
||||||
|
|
||||||
|
private static List _connectingConnectorServices = new ArrayList();
|
||||||
|
|
||||||
|
public synchronized void add(IConnectorService cs) {
|
||||||
|
_connectingConnectorServices.add(cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void remove(IConnectorService cs) {
|
||||||
|
_connectingConnectorServices.remove(cs);
|
||||||
|
notifyAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized boolean contains(IConnectorService cs) {
|
||||||
|
return _connectingConnectorServices.contains(cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void waitUntilNotContained(IConnectorService cs) {
|
||||||
|
while (contains(cs)){ // wait until the connector service is no longer in the list
|
||||||
|
try {
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
catch (InterruptedException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ConnectorServicePool _connectorServicePool = new ConnectorServicePool();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect to a remote system with a monitor.
|
* Connect to a remote system with a monitor.
|
||||||
* Required for Bug 176603
|
* Required for Bug 176603
|
||||||
|
@ -2462,9 +2497,20 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
|
||||||
final Exception[] exception=new Exception[1];
|
final Exception[] exception=new Exception[1];
|
||||||
exception[0]=null;
|
exception[0]=null;
|
||||||
|
|
||||||
IConnectorService conServ = getConnectorService();
|
IConnectorService connectorService = getConnectorService();
|
||||||
synchronized (conServ){
|
// is this connector service already connecting?
|
||||||
if (!conServ.isConnected()){
|
boolean alreadyConnecting = _connectorServicePool.contains(connectorService);
|
||||||
|
|
||||||
|
if (alreadyConnecting){
|
||||||
|
// connector service already attempting connect
|
||||||
|
// need to wait for it to complete
|
||||||
|
// before we can return out of this method
|
||||||
|
_connectorServicePool.waitUntilNotContained(connectorService);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_connectorServicePool.add(connectorService);
|
||||||
|
|
||||||
|
try {
|
||||||
Display.getDefault().syncExec(new Runnable() {
|
Display.getDefault().syncExec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try
|
try
|
||||||
|
@ -2475,9 +2521,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Exception e = exception[0];
|
Exception e = exception[0];
|
||||||
if (e == null) {
|
if (e == null) {
|
||||||
getConnectorService().connect(monitor);
|
getConnectorService().connect(monitor);
|
||||||
|
@ -2494,6 +2538,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
_connectorServicePool.remove(connectorService);
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue