예제 #1
0
 public static IList ForServerDispatcher(IServerMessageDispatcher dispatcher)
 {
     var _messages = new ArrayList();
     dispatcher.MessageReceived += new _IEventListener4_16
         (_messages).OnEvent;
     return _messages;
 }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
        public override Msg ReplyFromServer()
        {
            IServerMessageDispatcher dispatcher = ServerMessageDispatcher();

            lock (ContainerLock())
            {
                LocalTransaction trans = ServerTransaction();
                long             replicationRecordId  = ReadLong();
                long             timestamp            = ReadLong();
                IList            concurrentTimestamps = trans.ConcurrentReplicationTimestamps();
                ServerMessageDispatcher().Server().BroadcastReplicationCommit(timestamp, concurrentTimestamps
                                                                              );
                ReplicationRecord replicationRecord = (ReplicationRecord)Container().GetByID(trans
                                                                                             , replicationRecordId);
                Container().Activate(trans, replicationRecord, new FixedActivationDepth(int.MaxValue
                                                                                        ));
                replicationRecord.SetVersion(timestamp);
                replicationRecord.ConcurrentTimestamps(concurrentTimestamps);
                replicationRecord.Store(trans);
                Container().StoreAfterReplication(trans, replicationRecord, Container().UpdateDepthProvider
                                                      ().ForDepth(int.MaxValue), false);
                trans.Commit(dispatcher);
                committedInfo = dispatcher.CommittedInfo();
                Transaction().UseDefaultTransactionTimestamp();
            }
            return(Msg.Ok);
        }
        public virtual Msg ReplyFromServer()
        {
            IServerMessageDispatcher dispatcher = ServerMessageDispatcher();

            dispatcher.CaresAboutCommitted(true);
            return(Msg.Ok);
        }
예제 #5
0
		public static IList ForServerDispatcher(IServerMessageDispatcher dispatcher)
		{
			ArrayList _messages = new ArrayList();
			dispatcher.MessageReceived += new System.EventHandler<MessageEventArgs>(new _IEventListener4_16
				(_messages).OnEvent);
			return _messages;
		}
예제 #6
0
        public static IList ForServerDispatcher(IServerMessageDispatcher dispatcher)
        {
            ArrayList _messages = new ArrayList();

            dispatcher.MessageReceived += new System.EventHandler <MessageEventArgs>(new _IEventListener4_16
                                                                                         (_messages).OnEvent);
            return(_messages);
        }
예제 #7
0
        public static IList ForServerDispatcher(IServerMessageDispatcher dispatcher)
        {
            var _messages = new ArrayList();

            dispatcher.MessageReceived += new _IEventListener4_16
                                              (_messages).OnEvent;
            return(_messages);
        }
 // CatchAll because we can get expected timeout exceptions
 // although we still want to continue to use the ServerSocket.
 // No nice way to catch a specific exception because
 // SocketTimeOutException is JDK 1.4 and above.
 //e.printStackTrace();
 private void TriggerClientConnected(IServerMessageDispatcher messageDispatcher)
 {
     if (null != _clientConnected)
     {
         _clientConnected(null, new ClientConnectionEventArgs
                              (messageDispatcher));
     }
 }
 private void AddServerMessageDispatcher(IServerMessageDispatcher dispatcher)
 {
     lock (_dispatchers)
     {
         _dispatchers.Add(dispatcher);
         CheckCaresAboutCommitted();
     }
     TriggerClientConnected(dispatcher);
 }
예제 #10
0
        public virtual Msg ReplyFromServer()
        {
            IServerMessageDispatcher dispatcher = ServerMessageDispatcher();

            lock (ContainerLock())
            {
                ServerTransaction().Commit(dispatcher);
                committedInfo = dispatcher.CommittedInfo();
            }
            return(Msg.Ok);
        }
예제 #11
0
        public virtual void BroadcastReplicationCommit(long timestamp, IList concurrentTimestamps
                                                       )
        {
            IEnumerator i = IterateDispatchers();

            while (i.MoveNext())
            {
                IServerMessageDispatcher dispatcher  = (IServerMessageDispatcher)i.Current;
                LocalTransaction         transaction = (LocalTransaction)dispatcher.Transaction();
                transaction.NotifyAboutOtherReplicationCommit(timestamp, concurrentTimestamps);
            }
        }
        public virtual void BroadcastMsg(Msg message, IBroadcastFilter filter)
        {
            IEnumerator i = IterateDispatchers();

            while (i.MoveNext())
            {
                IServerMessageDispatcher dispatcher = (IServerMessageDispatcher)i.Current;
                if (filter.Accept(dispatcher))
                {
                    dispatcher.Write(message);
                }
            }
        }
        private bool AnyDispatcherCaresAboutCommitted()
        {
            IEnumerator i = IterateDispatchers();

            while (i.MoveNext())
            {
                IServerMessageDispatcher dispatcher = (IServerMessageDispatcher)i.Current;
                if (dispatcher.CaresAboutCommitted())
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #14
0
        private MsgD WriteLazyQueryResult(AbstractQueryResult queryResult, ObjectExchangeConfiguration
                                          config)
        {
            int           queryResultId = GenerateID();
            int           maxCount      = Config().PrefetchObjectCount();
            IIntIterator4 idIterator    = queryResult.IterateIDs();
            MsgD          message       = BuildQueryResultMessage(queryResultId, idIterator, maxCount, config
                                                                  );
            IServerMessageDispatcher serverThread = ServerMessageDispatcher();

            serverThread.MapQueryResultToID(new LazyClientObjectSetStub(queryResult, idIterator
                                                                        ), queryResultId);
            return(message);
        }
예제 #15
0
        /// <exception cref="System.Exception"></exception>
        public virtual void _test()
        {
            ObjectServerImpl serverImpl = (ObjectServerImpl)ClientServerFixture().Server();
            IEnumerator      iter       = serverImpl.IterateDispatchers();

            iter.MoveNext();
            IServerMessageDispatcher serverDispatcher = (IServerMessageDispatcher)iter.Current;
            IClientMessageDispatcher clientDispatcher = ((ClientObjectContainer)Db()).MessageDispatcher
                                                            ();

            clientDispatcher.Close();
            Runtime4.Sleep(1000);
            Assert.IsFalse(serverDispatcher.IsMessageDispatcherAlive());
        }
        /// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            if (IsEmbedded())
            {
                // This test really doesn't make sense for MTOC, there
                // is no client to ping.
                return;
            }
            IServerMessageDispatcher dispatcher = ServerDispatcher();

            ClientServerPingTestCase.PingThread pingThread = new ClientServerPingTestCase.PingThread
                                                                 (dispatcher);
            pingThread.Start();
            for (int i = 0; i < ItemCount; i++)
            {
                ClientServerPingTestCase.Item item = new ClientServerPingTestCase.Item(i);
                Store(item);
            }
            Assert.AreEqual(ItemCount, Db().QueryByExample(typeof(ClientServerPingTestCase.Item
                                                                  )).Count);
            pingThread.Close();
        }
예제 #17
0
		// CatchAll because we can get expected timeout exceptions
		// although we still want to continue to use the ServerSocket.
		// No nice way to catch a specific exception because 
		// SocketTimeOutException is JDK 1.4 and above.
		//e.printStackTrace();
		private void TriggerClientConnected(IServerMessageDispatcher messageDispatcher)
		{
			if (null != _clientConnected) _clientConnected(null, new ClientConnectionEventArgs
				(messageDispatcher));
		}
예제 #18
0
 public PingThread(IServerMessageDispatcher dispatcher)
 {
     _dispatcher = dispatcher;
 }
예제 #19
0
        public void ProcessAtServer()
        {
            IServerMessageDispatcher serverThread = ServerMessageDispatcher();

            serverThread.UseTransaction(this);
        }
예제 #20
0
        public virtual void ProcessAtServer()
        {
            IServerMessageDispatcher serverThread = ServerMessageDispatcher();

            serverThread.SwitchToMainFile();
        }
			public PingThread(IServerMessageDispatcher dispatcher)
			{
				_dispatcher = dispatcher;
			}
예제 #22
0
			public bool Accept(IServerMessageDispatcher dispatcher)
			{
				return dispatcher.CaresAboutCommitted();
			}
예제 #23
0
		private void AddServerMessageDispatcher(IServerMessageDispatcher dispatcher)
		{
			lock (_dispatchers)
			{
				_dispatchers.Add(dispatcher);
				CheckCaresAboutCommitted();
			}
			TriggerClientConnected(dispatcher);
		}
예제 #24
0
        protected virtual LazyClientObjectSetStub Stub(int queryResultID)
        {
            IServerMessageDispatcher serverThread = ServerMessageDispatcher();

            return(serverThread.QueryResultForID(queryResultID));
        }
예제 #25
0
 public bool Accept(IServerMessageDispatcher dispatcher)
 {
     return(dispatcher.CaresAboutCommitted());
 }
예제 #26
0
        public virtual void ProcessAtServer()
        {
            IServerMessageDispatcher dispatcher = ServerMessageDispatcher();

            dispatcher.CaresAboutCommitted(true);
        }