It turns our that call to remoteConnection.isOpen() sends a
connection changed event with type closed. This will overwrite
the flag to false that keeps track whether the connection was
opened explicitely.
Also, when calling disconnect() on the RemoteSystemProxy only
close the connection if it was not explicitely opened.
Change-Id: Idce1cf9515c01667ce2e4d49a30d8296a8a7977d
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/44946
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
public void connect(IProgressMonitor monitor) throws ExecutionException {
try {
if (!fHost.isOpen()) {
public void connect(IProgressMonitor monitor) throws ExecutionException {
try {
if (!fHost.isOpen()) {
- fExplicitConnect = true;
+ // Note that open() may trigger a RemoteConnectionChangeEvent
+ fExplicitConnect = true;
}
} catch (RemoteConnectionException e) {
throw new ExecutionException("Cannot connect " + fHost.getName(), e); //$NON-NLS-1$
}
} catch (RemoteConnectionException e) {
throw new ExecutionException("Cannot connect " + fHost.getName(), e); //$NON-NLS-1$
- * Disconnects from the remote connection.
+ * Disconnects from the remote connection, may close the connection.
*/
public void disconnect() {
*/
public void disconnect() {
+ if (fExplicitConnect) {
+ fHost.close();
+ fExplicitConnect = false;
+ }
*/
public void dispose() {
fHost.removeConnectionChangeListener(this);
*/
public void dispose() {
fHost.removeConnectionChangeListener(this);
- if (fExplicitConnect) {
- fHost.close();
- }