Exemplo n.º 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();
     }
 }
Exemplo n.º 2
0
        private void SendReadMultipleObjectsMessage(MReadMultipleObjects message, Transaction
                                                    transaction, int prefetchDepth, IList idsToRead)
        {
            MsgD msg = message.GetWriterForLength(transaction, Const4.IntLength + Const4.IntLength
                                                  + Const4.IdLength * idsToRead.Count);

            msg.WriteInt(prefetchDepth);
            msg.WriteInt(idsToRead.Count);
            for (IEnumerator idIter = idsToRead.GetEnumerator(); idIter.MoveNext();)
            {
                int id = ((int)idIter.Current);
                msg.WriteInt(id);
            }
            Write(msg);
        }
Exemplo n.º 3
0
        public sealed override HardObjectReference GetHardReferenceBySignature(Transaction
                                                                               trans, long uuid, byte[] signature)
        {
            int  messageLength = Const4.LongLength + Const4.IntLength + signature.Length;
            MsgD message       = Msg.ObjectByUuid.GetWriterForLength(trans, messageLength);

            message.WriteLong(uuid);
            message.WriteInt(signature.Length);
            message.WriteBytes(signature);
            Write(message);
            message = (MsgD)ExpectedResponse(Msg.ObjectByUuid);
            int id = message.ReadInt();

            if (id > 0)
            {
                return(GetHardObjectReferenceById(trans, id));
            }
            return(HardObjectReference.Invalid);
        }