CR-IU-595 - introduce createTemporaryConnection - fix

This commit is contained in:
Michael Golubev
2014-03-26 12:00:42 +01:00
parent b197f05047
commit 737553691f
2 changed files with 13 additions and 7 deletions
@@ -42,11 +42,14 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
private final Map<String, DeploymentImpl> myLocalDeployments = new HashMap<String, DeploymentImpl>();
private final Map<String, DeploymentLogManagerImpl> myLogManagers = new ConcurrentHashMap<String, DeploymentLogManagerImpl>();
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<D extends DeploymentConfiguration> implements
@Override
public void disconnect() {
myConnectionManager.removeConnection(myServer);
if (myConnectionManager != null) {
myConnectionManager.removeConnection(myServer);
}
doDisconnect();
}
@@ -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 <C extends ServerConfiguration> ServerConnection createTemporaryConnection(@NotNull RemoteServer<C> server) {
return doCreateConnection(server);
return doCreateConnection(server, null);
}
private <C extends ServerConfiguration> ServerConnection doCreateConnection(@NotNull RemoteServer<C> server) {
private <C extends ServerConfiguration> ServerConnection doCreateConnection(@NotNull RemoteServer<C> 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