Ejemplo n.º 1
0
        private static int LockCount(Locks locks)
        {
            LockCountVisitor lockCountVisitor = new LockCountVisitor();

            locks.Accept(lockCountVisitor);
            return(lockCountVisitor.LockCount);
        }
Ejemplo n.º 2
0
        private static string GetLocksDescriptionFunction(Locks locks)
        {
            StringWriter stringWriter = new StringWriter();

            locks.Accept(new DumpLocksVisitor(FormattedLog.withUTCTimeZone().toWriter(stringWriter)));
            return(stringWriter.ToString());
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public java.io.File dumpState(Locks lm, LockWorker... workers) throws java.io.IOException
        public virtual File DumpState(Locks lm, params LockWorker[] workers)
        {
            FileStream           @out        = new FileStream(_file, false);
            FormattedLogProvider logProvider = FormattedLogProvider.withoutAutoFlush().toOutputStream(@out);

            try
            {
                //  * locks held by the lock manager
                lm.Accept(new DumpLocksVisitor(logProvider.GetLog(typeof(LockWorkFailureDump))));
                //  * rag manager state;
                //  * workers state
                Log log = logProvider.getLog(this.GetType());
                foreach (LockWorker worker in workers)
                {
                    // - what each is doing and have up to now
                    log.Info("Worker %s", worker);
                }
                return(_file);
            }
            finally
            {
                @out.Flush();
                @out.Close();
            }
        }