public void ProcessAtServer()
        {
            IServerMessageDispatcher dispatcher = (IServerMessageDispatcher)MessageDispatcher
                                                      ();
            int         count = ReadInt();
            Transaction ta    = Transaction();

            for (int i = 0; i < count; i++)
            {
                StatefulBuffer writer        = _payLoad.ReadStatefulBuffer();
                int            messageId     = writer.ReadInt();
                Msg            message       = Msg.GetMessage(messageId);
                Msg            clonedMessage = message.PublicClone();
                clonedMessage.SetMessageDispatcher(MessageDispatcher());
                clonedMessage.SetTransaction(ta);
                if (clonedMessage is MsgD)
                {
                    MsgD msgd = (MsgD)clonedMessage;
                    msgd.PayLoad(writer);
                    if (msgd.PayLoad() != null)
                    {
                        msgd.PayLoad().IncrementOffset(Const4.IntLength);
                        Transaction t = CheckParentTransaction(ta, msgd.PayLoad());
                        msgd.SetTransaction(t);
                        dispatcher.ProcessMessage(msgd);
                    }
                }
                else
                {
                    dispatcher.ProcessMessage(clonedMessage);
                }
            }
        }
Beispiel #2
0
        private MsgD BuildQueryResultMessage(int queryResultId, IIntIterator4 ids, int maxCount
                                             , ObjectExchangeConfiguration config)
        {
            ByteArrayBuffer payload = ObjectExchangeStrategyFactory.ForConfig(config).Marshall
                                          ((LocalTransaction)Transaction(), ids, maxCount);
            MsgD message = QueryResult.GetWriterForLength(Transaction(), Const4.IntLength + payload
                                                          .Length());
            StatefulBuffer writer = message.PayLoad();

            writer.WriteInt(queryResultId);
            writer.WriteBytes(payload._buffer);
            return(message);
        }
        public Msg ReplyFromServer()
        {
            ByteArrayBuffer bytes              = GetByteLoad();
            int             classMetadataID    = bytes.ReadInt();
            int             prefetchDepth      = bytes.ReadInt();
            int             prefetchCount      = bytes.ReadInt();
            bool            triggerQueryEvents = bytes.ReadInt() == 1;
            ByteArrayBuffer payload            = MarshallIDsFor(classMetadataID, prefetchDepth, prefetchCount
                                                                , triggerQueryEvents);
            MsgD message = Msg.IdList.GetWriterForLength(Transaction(), payload.Length());

            message.PayLoad().WriteBytes(payload._buffer);
            return(message);
        }
        public Msg ReplyFromServer()
        {
            lock (ContainerLock())
            {
                try
                {
                    // Since every new Client reads the class
                    // collection from the file, we have to
                    // make sure, it has been written.
                    Container().ClassCollection().Write(Transaction());
                }
                catch (Exception)
                {
                }
            }
            MsgD message = Msg.GetClasses.GetWriterForLength(Transaction(), Const4.IntLength
                                                             + 1);
            ByteArrayBuffer writer = message.PayLoad();

            writer.WriteInt(Container().ClassCollection().GetID());
            writer.WriteByte(Container().StringIO().EncodingByte());
            return(message);
        }