Exemplo n.º 1
0
 protected override bool SessionUp()
 {
     //		Log.report( "KeepAliveSessionUp", "server", server );
     up = true;
     AlarmManager.staticAdd(this, null, delay * 1000);
     tickle();
     return(true);
 }
Exemplo n.º 2
0
        public void RegisterNotify(Notify newNotify, Object state, int maxDelay)
        {
            if (newNotify == null)
            {
                throw new ArgumentNullException("newNotify == null");
            }

            if (maxDelay < 0)
            {
                throw new ArgumentException("maxDelay < 0");
            }

            bool isNotEmptyOrIsClosed;

            lock (queue)
            {
                if (this.notify != null)
                {
                    throw new Exception("this.notify != null");
                }

                this.notify = newNotify;
                this.state  = state;

                if (maxDelay > 0)
                {
                    alarmSet = true;
                    AlarmManager.staticAdd(this, null, maxDelay);
                }

                isNotEmptyOrIsClosed = !queue.IsEmpty() || queue.IsClosed();
            }

            if (isNotEmptyOrIsClosed)
            {
                fireNotify();
            }
        }