Beispiel #1
0
        /**
         * <summary>
         * Handles communication connection failure. Tries to reconnect to any of the servers specified and
         * throws an exception if none of the servers can be reached.</summary>
         *
         * <param name="node">Remote node for which this connection belongs to.</param>
         * <param name="conn">Facade that caused the exception.</param>
         * <param name="e">Exception.</param>
         */
        public void onFacadeFailed(IGridClientNode node, C conn, GridClientConnectionResetException e)
        {
            Dbg.WriteLine("Connection with remote node was terminated" +
                          "[node=" + node + ", srvAddr=" + conn.ServerAddress + ", errMsg=" + e.Message + ']');

            guard.AcquireWriterLock(Timeout.Infinite);

            try {
                IPEndPoint srv = conn.ServerAddress;
                C          cached;

                if (conns.TryGetValue(srv, out cached) && cached.Equals(conn))
                {
                    conns.Remove(srv);
                }
            }
            finally {
                guard.ReleaseWriterLock();
            }

            /* Close connection to failed node outside the writer lock. */
            closeSilent(conn, false);
        }
        /**
         * <summary>
         * Handles communication connection failure. Tries to reconnect to any of the servers specified and
         * throws an exception if none of the servers can be reached.</summary>
         *
         * <param name="node">Remote node for which this connection belongs to.</param>
         * <param name="conn">Facade that caused the exception.</param>
         * <param name="e">Exception.</param>
         */
        public void onFacadeFailed(IGridClientNode node, C conn, GridClientConnectionResetException e)
        {
            Dbg.WriteLine("Connection with remote node was terminated" +
                "[node=" + node + ", srvAddr=" + conn.ServerAddress + ", errMsg=" + e.Message + ']');

            guard.AcquireWriterLock(Timeout.Infinite);

            try {
                IPEndPoint srv = conn.ServerAddress;
                C cached;

                if (conns.TryGetValue(srv, out cached) && cached.Equals(conn))
                    conns.Remove(srv);
            }
            finally {
                guard.ReleaseWriterLock();
            }

            /* Close connection to failed node outside the writer lock. */
            closeSilent(conn, false);
        }