/// <exception cref="Org.Apache.Hadoop.IO.Retry.UnreliableInterface.UnreliableException
        ///     "/>
        /// <exception cref="Org.Apache.Hadoop.Ipc.StandbyException"/>
        /// <exception cref="System.IO.IOException"/>
        private static void ThrowAppropriateException(UnreliableImplementation.TypeOfExceptionToFailWith
                                                      eType, string message)
        {
            switch (eType)
            {
            case UnreliableImplementation.TypeOfExceptionToFailWith.StandbyException:
            {
                throw new StandbyException(message);
            }

            case UnreliableImplementation.TypeOfExceptionToFailWith.UnreliableException:
            {
                throw new UnreliableInterface.UnreliableException(message);
            }

            case UnreliableImplementation.TypeOfExceptionToFailWith.IoException:
            {
                throw new IOException(message);
            }

            case UnreliableImplementation.TypeOfExceptionToFailWith.RemoteException:
            {
                throw new RemoteException(typeof(IOException).FullName, message);
            }

            default:
            {
                throw new RuntimeException(message);
            }
            }
        }
示例#2
0
 private static TestFailoverProxy.FlipFlopProxyProvider <UnreliableInterface> NewFlipFlopProxyProvider
     (UnreliableImplementation.TypeOfExceptionToFailWith t1, UnreliableImplementation.TypeOfExceptionToFailWith
     t2)
 {
     return(new TestFailoverProxy.FlipFlopProxyProvider <UnreliableInterface>(typeof(UnreliableInterface
                                                                                     ), new UnreliableImplementation("impl1", t1), new UnreliableImplementation("impl2"
                                                                                                                                                                , t2)));
 }
示例#3
0
 public SynchronizedUnreliableImplementation(string identifier, UnreliableImplementation.TypeOfExceptionToFailWith
                                             exceptionToFailWith, int threadCount)
     : base(identifier, exceptionToFailWith)
 {
     methodLatch = new CountDownLatch(threadCount);
 }
 public UnreliableImplementation(string identifier, UnreliableImplementation.TypeOfExceptionToFailWith
                                 exceptionToFailWith)
 {
     this.identifier          = identifier;
     this.exceptionToFailWith = exceptionToFailWith;
 }