示例#1
0
 internal virtual void Remove(JournalManager j)
 {
     JournalSet.JournalAndStream jasToRemove = null;
     foreach (JournalSet.JournalAndStream jas in journals)
     {
         if (jas.GetManager().Equals(j))
         {
             jasToRemove = jas;
             break;
         }
     }
     if (jasToRemove != null)
     {
         jasToRemove.Abort();
         journals.Remove(jasToRemove);
     }
 }
        /// <exception cref="System.IO.IOException"/>
        private static EditLogInputStream GetJournalInputStream(JournalManager jm, long txId
                                                                , bool inProgressOk)
        {
            PriorityQueue <EditLogInputStream> allStreams = new PriorityQueue <EditLogInputStream
                                                                               >(64, JournalSet.EditLogInputStreamComparator);

            jm.SelectInputStreams(allStreams, txId, inProgressOk);
            EditLogInputStream elis = null;
            EditLogInputStream ret;

            try
            {
                while ((elis = allStreams.Poll()) != null)
                {
                    if (elis.GetFirstTxId() > txId)
                    {
                        break;
                    }
                    if (elis.GetLastTxId() < txId)
                    {
                        elis.Close();
                        continue;
                    }
                    elis.SkipUntil(txId);
                    ret  = elis;
                    elis = null;
                    return(ret);
                }
            }
            finally
            {
                IOUtils.Cleanup(Log, Sharpen.Collections.ToArray(allStreams, new EditLogInputStream
                                                                 [0]));
                IOUtils.Cleanup(Log, elis);
            }
            return(null);
        }
示例#3
0
 internal virtual void Add(JournalManager j, bool required, bool shared)
 {
     JournalSet.JournalAndStream jas = new JournalSet.JournalAndStream(j, required, shared
                                                                       );
     journals.AddItem(jas);
 }
示例#4
0
 internal virtual void Add(JournalManager j, bool required)
 {
     Add(j, required, false);
 }
示例#5
0
 public JournalAndStream(JournalManager manager, bool required, bool shared)
 {
     this.journal  = manager;
     this.required = required;
     this.shared   = shared;
 }