/// <summary> /// Close the given mailbox /// </summary> public void CloseMbox(ErlMbox mbox) { if (m_Mailboxes != null) { m_Mailboxes.Unregister(mbox); } }
/// <summary> /// Determine if two mailboxes are equal /// </summary> public override bool Equals(object o) { if (!(o is ErlMbox)) { return(false); } ErlMbox m = (ErlMbox)o; return(m.m_Self.Equals(m_Self)); }
internal ErlCRUDSubscription(ErlDataStore store, string name, Query query, Mailbox recipient, object correlate = null ) : base(store, name, query, recipient, correlate) { m_ErlBox = store.MakeMailbox(); m_Queue = new ConcurrentQueue<IQueable>(); m_ErlBox.MailboxMessage += (_, msg) => { m_Queue.Enqueue(msg); asyncProcess(); return true; }; m_Store = store; m_Query = query; subscribeCore(); HasLoaded(); }
/// <summary> /// Start current node. This optionally creates a socket listener /// and I/O server /// </summary> protected override void DoStart() { m_Connections = new ConcurrentDictionary <ErlAtom, ErlConnection>(); m_Mailboxes = new Internal.MboxRegistry(this); //bool acceptConnections = true, short port = 0, IPAddress addr = null if (m_IoServer != null) { throw new ErlException("Already started!"); } m_GroupLeader = m_Mailboxes.Create(ConstAtoms.User); if (m_AcceptConnections) { var addr = m_AcceptAddressPort.IsNullOrEmpty() ? new IPEndPoint(0, 0) : m_AcceptAddressPort.ToIPEndPoint(); m_Acceptor = new Internal.ErlAcceptor(this, addr.Port, addr.Address); } m_IoServer = new Internal.ErlIoServer(this); m_RpcServer = new Internal.ErlRpcServer(this); }
/// <summary> /// Close the given mailbox /// </summary> public void CloseMbox(ErlMbox mbox) { m_Mailboxes.Unregister(mbox); }
/// <summary> /// Start current node. This optionally creates a socket listener /// and I/O server /// </summary> protected override void DoStart() { m_Connections = new ConcurrentDictionary<ErlAtom, ErlConnection>(); m_Mailboxes = new Internal.MboxRegistry(this); //bool acceptConnections = true, short port = 0, IPAddress addr = null if (m_IoServer != null) throw new ErlException("Already started!"); m_GroupLeader = m_Mailboxes.Create(ConstAtoms.User); if (m_AcceptConnections) { var addr = m_AcceptAddressPort.IsNullOrEmpty() ? new IPEndPoint(0, 0) : m_AcceptAddressPort.ToIPEndPoint(); m_Acceptor = new Internal.ErlAcceptor(this, addr.Port, addr.Address); } m_IoServer = new Internal.ErlIoServer(this); m_RpcServer = new Internal.ErlRpcServer(this); }
/// <summary> /// Wait for arrival of messages in any one of the given mailboxes /// </summary> /// <param name="mboxes">Mailboxes to wait for messages in</param> /// <param name="msecTimeout">Timeout in milliseconds</param> /// <returns>Index of the first non-empty mailbox or -1 on timeout</returns> public int WaitAny(ErlMbox[] mboxes, int msecTimeout = -1) { for(int i = 0; i < mboxes.Length; i++) if (!mboxes[i].Empty) return i; if (msecTimeout == 0) return -1; int n = WaitHandle.WaitAny(mboxes.Select(m => m.Handle).ToArray(), msecTimeout); return n == WaitHandle.WaitTimeout ? -1 : n; }
public ErlCRUDQueryExecutionContext(ErlDataStore store, ErlMbox erlMBox = null) { this.DataStore = store; ErlMailBox = erlMBox; }
public ErlCRUDQueryExecutionContext(ErlDataStore store, ErlMbox erlMBox = null, DataTimeStamp? ts = null) { this.DataStore = store; ErlMailBox = erlMBox; SubscriptionTimestamp = ts; }
/// <summary> /// Close the given mailbox /// </summary> public void CloseMbox(ErlMbox mbox) { if (m_Mailboxes != null) m_Mailboxes.Unregister(mbox); }