コード例 #1
0
 public void WriteBatchedMessages()
 {
     lock (Lock())
     {
         if (_batchedMessages.IsEmpty())
         {
             return;
         }
         Msg  msg;
         MsgD multibytes = Msg.WriteBatchedMessages.GetWriterForLength(Transaction, _batchedQueueLength
                                                                       );
         multibytes.WriteInt(_batchedMessages.Size());
         IEnumerator iter = _batchedMessages.GetEnumerator();
         while (iter.MoveNext())
         {
             msg = (Msg)iter.Current;
             if (msg == null)
             {
                 multibytes.WriteInt(0);
             }
             else
             {
                 multibytes.WriteInt(msg.PayLoad().Length());
                 multibytes.PayLoad().Append(msg.PayLoad()._buffer);
             }
         }
         WriteMessageToSocket(multibytes);
         ClearBatchedObjects();
     }
 }
コード例 #2
0
        private void FetchMissingSlotBuffers(Transaction transaction, ArrayList missing,
                                             IDictionary buffers, int prefetchDepth)
        {
            if (missing.Count == 0)
            {
                return;
            }
            int safePrefetchDepth = Math.Max(1, prefetchDepth);

            SendReadMultipleObjectsMessage(Msg.ReadMultipleObjects, transaction, safePrefetchDepth
                                           , missing);
            MsgD        response = (MsgD)ExpectedResponse(Msg.ReadMultipleObjects);
            IEnumerator slots    = new CacheContributingObjectReader((ClientTransaction)transaction
                                                                     , _clientSlotCache, response.PayLoad()).Buffers();

            while (slots.MoveNext())
            {
                Pair pair = ((Pair)slots.Current);
                buffers[((int)pair.first)] = ((ByteArrayBuffer)pair.second);
            }
        }