Пример #1
0
            private UnderlyingStorageException constructCombinedFailure()
            {
                UnderlyingStorageException combined = new UnderlyingStorageException("Error performing check point");

                for (int i = 0; i < outerInstance.consecutiveFailures; i++)
                {
                    combined.addSuppressed(outerInstance.failures[i]);
                }
                return(combined);
            }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static Exception executeFailingTransaction(RecordStorageEngine engine) throws java.io.IOException
        private static Exception ExecuteFailingTransaction(RecordStorageEngine engine)
        {
            Exception          applicationError = new UnderlyingStorageException("No space left on device");
            TransactionToApply txToApply        = NewTransactionThatFailsWith(applicationError);

            try
            {
                engine.Apply(txToApply, TransactionApplicationMode.INTERNAL);
                fail("Exception expected");
            }
            catch (Exception e)
            {
                assertSame(applicationError, Exceptions.rootCause(e));
            }
            return(applicationError);
        }
Пример #3
0
            public void run()
            {
                try
                {
                    outerInstance.checkPointing = true;
                    if (outerInstance.stopped)
                    {
                        return;
                    }
                    outerInstance.checkPointer.checkPointIfNeeded(new SimpleTriggerInfo("Scheduled checkpoint"));

                    // There were previous unsuccessful attempts, but this attempt was a success
                    // so let's clear those previous errors.
                    if (outerInstance.consecutiveFailures > 0)
                    {
                        Arrays.fill(outerInstance.failures, null);
                        outerInstance.consecutiveFailures = 0;
                    }
                }
                catch (Exception t)
                {
                    outerInstance.failures[outerInstance.consecutiveFailures++] = t;

                    // We're counting check pointer to log about the failure itself
                    if (outerInstance.consecutiveFailures >= MaxConsecutiveFailuresTolerance)
                    {
                        UnderlyingStorageException combinedFailure = constructCombinedFailure();
                        outerInstance.health.panic(combinedFailure);
                        throw combinedFailure;
                    }
                }
                finally
                {
                    outerInstance.checkPointing = false;
                }

                // reschedule only if it is not stopped
                if (!outerInstance.stopped)
                {
                    outerInstance.handle = outerInstance.scheduler.schedule(Group.CHECKPOINT, job, outerInstance.recurringPeriodMillis, MILLISECONDS);
                }
            }