Esempio n. 1
0
        /// <summary>Try to get the HA state of the node at the given address.</summary>
        /// <remarks>
        /// Try to get the HA state of the node at the given address. This
        /// function is guaranteed to be "quick" -- ie it has a short timeout
        /// and no retries. Its only purpose is to avoid fencing a node that
        /// has already restarted.
        /// </remarks>
        internal virtual bool TryGracefulFence(HAServiceTarget svc)
        {
            HAServiceProtocol proxy = null;

            try
            {
                proxy = svc.GetProxy(gracefulFenceConf, gracefulFenceTimeout);
                proxy.TransitionToStandby(CreateReqInfo());
                return(true);
            }
            catch (ServiceFailedException sfe)
            {
                Log.Warn("Unable to gracefully make " + svc + " standby (" + sfe.Message + ")");
            }
            catch (IOException ioe)
            {
                Log.Warn("Unable to gracefully make " + svc + " standby (unable to connect)", ioe
                         );
            }
            finally
            {
                if (proxy != null)
                {
                    RPC.StopProxy(proxy);
                }
            }
            return(false);
        }
 /// <exception cref="System.IO.IOException"/>
 public static void TransitionToStandby(HAServiceProtocol svc, HAServiceProtocol.StateChangeRequestInfo
                                        reqInfo)
 {
     try
     {
         svc.TransitionToStandby(reqInfo);
     }
     catch (RemoteException e)
     {
         throw e.UnwrapRemoteException(typeof(ServiceFailedException));
     }
 }