public void unreg6() { PlainMailbox mb = new PlainMailbox(this, 1L); mb.RegisterNotify(notify, null, 30); mb.UnregisterNotify(notify); }
public Mailbox TransportCall(Who recipient, Message msg) { if (msg.MessageId != null) { throw new Exception(" message has already been sent"); } if (msg.InReplyTo != null) { throw new Exception(" message is marked as a reply"); } long mid = idGen.Next(); msg.MessageId = mid; Mailbox mb = new PlainMailbox(this, mid); Register(mb); try { transport.TransportMessage(recipient, msg); } catch (Exception e) { Unregister(mb); throw e; } return(mb); }
public void reg2() { // maxDelay < 0 PlainMailbox mb = new PlainMailbox(this, 1L); mb.RegisterNotify(notify, null, -1); }
private void testConstruct(long messageId) { PlainMailbox mb = new PlainMailbox(this, messageId); Assert.AreEqual(this, mb.GetMailboxManager()); Assert.AreEqual(messageId, mb.GetMessageId()); }
public void reg1() { // notify == null PlainMailbox mb = new PlainMailbox(this, 1L); mb.RegisterNotify(null, null, 0); }
public void reg5() { // this.notify != null PlainMailbox mb = new PlainMailbox(this, 1L); mb.RegisterNotify(notify, null, 0); mb.RegisterNotify(notify1x, null, 0); }
public void unreg5() { // notify != this.notify PlainMailbox mb = new PlainMailbox(this, 1L); mb.RegisterNotify(notify, null, 0); mb.UnregisterNotify(notify1x); }
public void read8() { PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkRead(mb, 1, false, null, null); checkMailbox(mb, true, false, false, false, 0); }
private void checkMailbox(PlainMailbox mb, bool empty, bool full, bool closed, bool unreg, int size) { Assert.AreEqual(empty, mb.IsEmpty()); Assert.AreEqual(full, mb.IsFull()); Assert.AreEqual(closed, mb.IsClosed()); Assert.AreEqual(unreg, unregistered); Assert.AreEqual(size, redelivered.Count); }
public void closeRead1() { // open mailbox and close it for reading while empty. PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkCloseRead(mb, true); checkMailbox(mb, true, false, true, true, 0); }
public void read5() { PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); Thread.Sleep(1000); checkRead(mb, false, null, null); checkMailbox(mb, true, false, true, true, 0); }
public void closeDelivery1() { // open mailbox and close it for delivery while empty. PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkCloseDelivery(mb, true); checkMailbox(mb, true, false, true, true, 0); }
public void full1() { PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkDeliver(mb, true, fred_who, foo_msg); checkMailbox(mb, false, true, false, false, 0); checkDeliver(mb, false, alice_who, bar_msg); checkMailbox(mb, false, true, false, false, 0); }
public void deliver1() { PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkCloseDelivery(mb, true); checkMailbox(mb, true, false, true, true, 0); checkDeliver(mb, false, fred_who, bar_msg); checkMailbox(mb, true, false, true, true, 0); }
public void read4() { PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkCloseDelivery(mb, true); checkMailbox(mb, true, false, true, true, 0); checkRead(mb, false, null, null); checkMailbox(mb, true, false, true, true, 0); }
private void checkRead(PlainMailbox mb, bool present, Who who, Message msg) { Element e = mb.Read(); if (present) { checkElement(e, who, msg); } else { Assert.IsNull(e); } }
public void notify4() { PlainMailbox mb = new PlainMailbox(this, 1L); notify.checkMailboxStatus(false, null, null, false); Object state = new Object(); mb.RegisterNotify(notify, state, 0); notify.checkMailboxStatus(false, null, null, false); mb.Message(alice_who, foo_msg); notify.checkMailboxStatus(true, mb, state, false); }
public void notify1() { PlainMailbox mb = new PlainMailbox(this, 1L); notify.checkMailboxStatus(false, null, null, false); Object state = new Object(); mb.RegisterNotify(notify, state, 0); notify.checkMailboxStatus(false, null, null, false); checkCloseDelivery(mb, true); notify.checkMailboxStatus(true, mb, state, true); }
public void notify3() { PlainMailbox mb = new PlainMailbox(this, 1L); notify.checkMailboxStatus(false, null, null, false); Object state = new Object(); mb.RegisterNotify(notify, state, 0); notify.checkMailboxStatus(false, null, null, false); Thread.Sleep(2000); notify.checkMailboxStatus(false, null, null, false); }
public void closeDelivery3() { // open mailbox and close it for delivery twice. PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkCloseDelivery(mb, true); checkMailbox(mb, true, false, true, true, 0); checkCloseDelivery(mb, false); checkMailbox(mb, true, false, true, true, 0); }
public void closeDelivery2() { // open mailbox and close it for delivery while not empty. PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkDeliver(mb, true, alice_who, foo_msg); checkMailbox(mb, false, true, false, false, 0); checkCloseDelivery(mb, true); checkMailbox(mb, false, true, true, true, 0); }
public void closeRead2() { // open mailbox and close it for reading while not empty. PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkDeliver(mb, true, alice_who, foo_msg); checkMailbox(mb, false, true, false, false, 0); checkCloseRead(mb, true); checkMailbox(mb, true, false, true, true, 1); checkRedelivered(0, alice_who, foo_msg); }
public void read3() { PlainMailbox mb = new PlainMailbox(this, 1L); checkMailbox(mb, true, false, false, false, 0); checkDeliver(mb, true, alice_who, bar_msg); checkMailbox(mb, false, true, false, false, 0); checkCloseDelivery(mb, true); checkMailbox(mb, false, true, true, true, 0); checkRead(mb, true, alice_who, bar_msg); checkMailbox(mb, true, false, true, true, 0); }
public void reg3() { PlainMailbox mb = new PlainMailbox(this, 1L); mb.RegisterNotify(notify, null, 0); }
private void checkCloseDelivery(PlainMailbox mb, bool closed) { Assert.AreEqual(closed, mb.CloseDelivery()); }
private void checkCloseRead(PlainMailbox mb, bool closed) { Assert.AreEqual(closed, mb.CloseRead()); }
public void unreg1() { PlainMailbox mb = new PlainMailbox(this, 1L); mb.UnregisterNotify(notify); }
private void checkDeliver(PlainMailbox mb, bool handled, Who who, Message msg) { Assert.AreEqual(handled, mb.Message(who, msg)); }