private void TriggerEvent(DefaultTransactionTracer tracer, int eventDuration)
        {
            using (TransactionEvent txEvent = tracer.BeginTransaction())
            {
                using (CommitEvent commitEvent = txEvent.BeginCommitEvent())
                {
                    using (LogAppendEvent logAppendEvent = commitEvent.BeginLogAppend())
                    {
                        _clock.forward(ThreadLocalRandom.current().nextLong(200), TimeUnit.MILLISECONDS);
                        using (LogRotateEvent @event = logAppendEvent.BeginLogRotate())
                        {
                            _clock.forward(eventDuration, TimeUnit.MILLISECONDS);
                        }
                    }
                }
            }

            _jobScheduler.runJob();
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean rotateLogIfNeeded(org.neo4j.kernel.impl.transaction.tracing.LogAppendEvent logAppendEvent) throws java.io.IOException
        public override bool RotateLogIfNeeded(LogAppendEvent logAppendEvent)
        {
            /* We synchronize on the writer because we want to have a monitor that another thread
             * doing force (think batching of writes), such that it can't see a bad state of the writer
             * even when rotating underlying channels.
             */
            if (_logFile.rotationNeeded())
            {
                lock ( _logFile )
                {
                    if (_logFile.rotationNeeded())
                    {
                        using (LogRotateEvent rotateEvent = logAppendEvent.BeginLogRotate())
                        {
                            DoRotate();
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }