From 737553691fa01c5cb0d074bf87e640f854ba0c73 Mon Sep 17 00:00:00 2001 From: Michael Golubev Date: Wed, 26 Mar 2014 12:00:42 +0100 Subject: [PATCH] CR-IU-595 - introduce createTemporaryConnection - fix --- .../impl/runtime/ServerConnectionImpl.java | 11 ++++++++--- .../impl/runtime/ServerConnectionManagerImpl.java | 9 +++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java index 04b1dfae604e..fe43f2aa4f4d 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java @@ -42,11 +42,14 @@ public class ServerConnectionImpl implements private final Map myLocalDeployments = new HashMap(); private final Map myLogManagers = new ConcurrentHashMap(); - public ServerConnectionImpl(RemoteServer server, ServerConnector connector, ServerConnectionManagerImpl connectionManager) { + public ServerConnectionImpl(RemoteServer server, + ServerConnector connector, + @Nullable ServerConnectionManagerImpl connectionManager, + ServerConnectionEventDispatcher eventDispatcher) { myServer = server; myConnector = connector; myConnectionManager = connectionManager; - myEventDispatcher = myConnectionManager.getEventDispatcher(); + myEventDispatcher = eventDispatcher; } @NotNull @@ -85,7 +88,9 @@ public class ServerConnectionImpl implements @Override public void disconnect() { - myConnectionManager.removeConnection(myServer); + if (myConnectionManager != null) { + myConnectionManager.removeConnection(myServer); + } doDisconnect(); } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionManagerImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionManagerImpl.java index e54a5db3c8a4..71f04e2265f1 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionManagerImpl.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionManagerImpl.java @@ -26,7 +26,7 @@ public class ServerConnectionManagerImpl extends ServerConnectionManager { ApplicationManager.getApplication().assertIsDispatchThread(); ServerConnection connection = myConnections.get(server); if (connection == null) { - connection = doCreateConnection(server); + connection = doCreateConnection(server, this); myConnections.put(server, connection); myEventDispatcher.fireConnectionCreated(connection); } @@ -36,12 +36,13 @@ public class ServerConnectionManagerImpl extends ServerConnectionManager { @NotNull @Override public ServerConnection createTemporaryConnection(@NotNull RemoteServer server) { - return doCreateConnection(server); + return doCreateConnection(server, null); } - private ServerConnection doCreateConnection(@NotNull RemoteServer server) { + private ServerConnection doCreateConnection(@NotNull RemoteServer server, + ServerConnectionManagerImpl manager) { ServerTaskExecutorImpl executor = new ServerTaskExecutorImpl(); - return new ServerConnectionImpl(server, server.getType().createConnector(server, executor), this); + return new ServerConnectionImpl(server, server.getType().createConnector(server, executor), manager, getEventDispatcher()); } @Nullable