Esempio n. 1
0
 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();
     }
 }
Esempio n. 2
0
        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
            }
        }
Esempio n. 3
0
        public void DisconnectedObject(object objectValue)
        {
            // Check if this object is a connection that needs to be disposed and dispose it if so
            // This should not recurse because the RemotingServices.Disconnect call in the connection dispose
            //  should not notify TrackingHandlers if the object has already been disconnected, and if the
            //  connection has already been disposed than it should no longer be associated with this server
            // BTR 5/12/2005 -> Use a thread pool to perform this call so that there is no chance of blocking
            // the lease manager.
            RemoteServerConnection connection = objectValue as RemoteServerConnection;

            if ((connection != null) && (connection.Server == this))
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(DisposeConnection), connection);
            }
        }
Esempio n. 4
0
 internal RemoteServerConnection[] GetCurrentConnections()
 {
     BeginCall();
     try
     {
         RemoteServerConnection[] result = new RemoteServerConnection[_connections == null ? 0 : _connections.Count];
         if (_connections != null)
         {
             _connections.CopyTo(result, 0);
         }
         return(result);
     }
     finally
     {
         EndCall();
     }
 }
Esempio n. 5
0
        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);
            }
        }