public IRemoteServerConnection Establish(string connectionName, string hostName) { BeginCall(); try { EnsureCatalogCaches(); RemoteServerConnection connection = new RemoteServerConnection(this, connectionName, hostName); try { _connections.Add(connection); return(connection); } catch { connection.Dispose(); throw; } } catch (Exception E) { throw WrapException(E); } finally { EndCall(); } }
private void DisposeConnection(Object stateInfo) { try { RemoteServerConnection connection = stateInfo as RemoteServerConnection; if (connection != null) { connection.CloseSessions(); BeginCall(); // sync here; we may be coming in on a remoting thread try { _connections.SafeDisown(connection); } finally { EndCall(); } connection.Dispose(); } } catch { // Don't allow exceptions to go unhandled... the framework will abort the application } }
public void Relinquish(IRemoteServerConnection connection) { RemoteServerConnection localConnection = connection as RemoteServerConnection; localConnection.CloseSessions(); BeginCall(); try { _connections.SafeDisown(localConnection); } finally { EndCall(); } try { localConnection.Dispose(); } catch (Exception E) { throw WrapException(E); } }