public static IList ForServerDispatcher(IServerMessageDispatcher dispatcher) { var _messages = new ArrayList(); dispatcher.MessageReceived += new _IEventListener4_16 (_messages).OnEvent; return _messages; }
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); } } }
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); }
public static IList ForServerDispatcher(IServerMessageDispatcher dispatcher) { ArrayList _messages = new ArrayList(); dispatcher.MessageReceived += new System.EventHandler<MessageEventArgs>(new _IEventListener4_16 (_messages).OnEvent); return _messages; }
public static IList ForServerDispatcher(IServerMessageDispatcher dispatcher) { ArrayList _messages = new ArrayList(); dispatcher.MessageReceived += new System.EventHandler <MessageEventArgs>(new _IEventListener4_16 (_messages).OnEvent); return(_messages); }
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); }
public virtual Msg ReplyFromServer() { IServerMessageDispatcher dispatcher = ServerMessageDispatcher(); lock (ContainerLock()) { ServerTransaction().Commit(dispatcher); committedInfo = dispatcher.CommittedInfo(); } return(Msg.Ok); }
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); }
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); }
/// <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(); }
// 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)); }
public PingThread(IServerMessageDispatcher dispatcher) { _dispatcher = dispatcher; }
public void ProcessAtServer() { IServerMessageDispatcher serverThread = ServerMessageDispatcher(); serverThread.UseTransaction(this); }
public virtual void ProcessAtServer() { IServerMessageDispatcher serverThread = ServerMessageDispatcher(); serverThread.SwitchToMainFile(); }
public bool Accept(IServerMessageDispatcher dispatcher) { return dispatcher.CaresAboutCommitted(); }
protected virtual LazyClientObjectSetStub Stub(int queryResultID) { IServerMessageDispatcher serverThread = ServerMessageDispatcher(); return(serverThread.QueryResultForID(queryResultID)); }
public bool Accept(IServerMessageDispatcher dispatcher) { return(dispatcher.CaresAboutCommitted()); }
public virtual void ProcessAtServer() { IServerMessageDispatcher dispatcher = ServerMessageDispatcher(); dispatcher.CaresAboutCommitted(true); }