Пример #1
0
        public void Close()
        {
            lock (myLock)
            {
                if (this.closed)
                {
                    return;
                }

                try
                {
                    Tracer.InfoFormat("Closing The Session with Id {0}", this.info.SessionId.ToString());
                    DoClose();
                    Tracer.InfoFormat("Closed The Session with Id {0}", this.info.SessionId.ToString());
                }
                catch (Exception ex)
                {
                    Tracer.ErrorFormat("Error during session close: {0}", ex);
                }
                finally
                {
                    // Make sure we attempt to inform the broker this Session is done.
                    RemoveInfo info = new RemoveInfo();
                    info.ObjectId = this.info.SessionId;
                    info.LastDeliveredSequenceId = this.lastDeliveredSequenceId;
                    this.connection.Oneway(info);
                    this.connection = null;
                    this.closed     = true;
                    this.closing    = false;
                }
            }
        }
        //
        // Write a object instance to data output stream
        //
        public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
        {
            RemoveInfo info = (RemoveInfo)o;

            base.LooseMarshal(wireFormat, o, dataOut);
            LooseMarshalCachedObject(wireFormat, (DataStructure)info.ObjectId, dataOut);
        }
Пример #3
0
        public void DisposeOf(DataStructure objectId)
        {
            RemoveInfo command = new RemoveInfo();

            command.ObjectId = objectId;
            transport.Oneway(command);
        }
Пример #4
0
        internal void DoClose()
        {
            if (!this.unconsumedMessages.Closed)
            {
                Tracer.Debug("Closing down the Consumer");

                if (!this.session.IsTransacted)
                {
                    lock (this.dispatchedMessages)
                    {
                        dispatchedMessages.Clear();
                    }
                }

                this.unconsumedMessages.Close();
                this.session.DisposeOf(this.info.ConsumerId);

                RemoveInfo removeCommand = new RemoveInfo();
                removeCommand.ObjectId = this.info.ConsumerId;

                this.session.Connection.Oneway(removeCommand);
                this.session = null;

                Tracer.Debug("Consumer instnace Closed.");
            }
        }
        void disposeOf(ConsumerInfo consumer, ITransport transport)
        {
            RemoveInfo command = new RemoveInfo();

            command.ObjectId = consumer.ConsumerId;
            transport.Oneway(command);
        }
        void disposeOf(SessionInfo session, ITransport transport)
        {
            RemoveInfo command = new RemoveInfo();

            command.ObjectId = session.SessionId;
            transport.Oneway(command);
        }
        void disposeOf(ProducerInfo producer, ITransport transport)
        {
            RemoveInfo command = new RemoveInfo();

            command.ObjectId = producer.ProducerId;
            transport.Oneway(command);
        }
Пример #8
0
 private void DisposeOf(DataStructure objectId)
 {
     try
     {
         RemoveInfo command = new RemoveInfo();
         command.ObjectId = objectId;
         if (asyncClose)
         {
             Tracer.Info("Asynchronously disposing of Connection.");
             if (connected.Value)
             {
                 transport.Oneway(command);
                 Tracer.Info("Oneway command sent to broker.");
             }
         }
         else
         {
             // Ensure that the object is disposed to avoid potential race-conditions
             // of trying to re-create the same object in the broker faster than
             // the broker can dispose of the object.  Allow up to 5 seconds to process.
             Tracer.Info("Synchronously disposing of Connection.");
             SyncRequest(command, TimeSpan.FromSeconds(5));
             Tracer.Info("Synchronously closed Connection.");
         }
     }
     catch             // (BrokerException)
     {
         // Ignore exceptions while shutting down.
     }
 }
Пример #9
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            var rows = dgvList.SelectedRows;

            if (rows.Count > 0)
            {
                DialogResult result = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel);
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                string id = rows[0].Cells[0].Value.ToString();
                if (bll.Delete(id))
                {
                    RemoveInfo remove = new RemoveInfo()
                    {
                        RId    = Convert.ToInt32(id),
                        RName  = rows[0].Cells[1].Value.ToString(),
                        RTable = "MemberInfo"
                    };
                    RemoveInfoBll removebll = new RemoveInfoBll();
                    removebll.Add(remove);
                    LoadList();
                }
            }
            else
            {
                MessageBox.Show("请选择一行数据");
            }
        }
        //
        // Write a object instance to data output stream
        //
        public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs)
        {
            base.TightMarshal2(wireFormat, o, dataOut, bs);

            RemoveInfo info = (RemoveInfo)o;

            TightMarshalCachedObject2(wireFormat, (DataStructure)info.ObjectId, dataOut, bs);
        }
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
        {
            base.LooseUnmarshal(wireFormat, o, dataIn);

            RemoveInfo info = (RemoveInfo)o;

            info.ObjectId = (DataStructure)LooseUnmarshalCachedObject(wireFormat, dataIn);
        }
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
        {
            base.TightUnmarshal(wireFormat, o, dataIn, bs);

            RemoveInfo info = (RemoveInfo)o;

            info.ObjectId = (DataStructure)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
        }
Пример #13
0
        public void Disjoin(Authentication authentication, RemoveInfo removeInfo)
        {
            var action = new DisjoinAction()
            {
                UserID = authentication.ID, RemoveInfo = removeInfo, AcceptTime = authentication.SignatureDate.DateTime
            };

            this.Post(action);
        }
Пример #14
0
        internal void DoClose()
        {
            Shutdown();
            RemoveInfo removeInfo = new RemoveInfo();

            removeInfo.ObjectId = this.info.SessionId;
            removeInfo.LastDeliveredSequenceId = this.lastDeliveredSequenceId;
            this.connection.Oneway(removeInfo);
        }
Пример #15
0
 private void InvokeKick(Authentication authentication, string userID, string comment, out DomainUser domainUser, out RemoveInfo removeInfo)
 {
     removeInfo = new RemoveInfo(RemoveReason.Kick, comment);
     domainUser = this.users[userID];
     if (domainUser.Authentication != null)
     {
         domainUser.Authentication.Expired -= Authentication_Expired;
         domainUser.Authentication          = null;
     }
 }
        //
        // Write the booleans that this object uses to a BooleanStream
        //
        public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
        {
            RemoveInfo info = (RemoveInfo)o;

            int rc = base.TightMarshal1(wireFormat, info, bs);

            rc += TightMarshalCachedObject1(wireFormat, (DataStructure)info.ObjectId, bs);

            return(rc + 0);
        }
Пример #17
0
        //
        // Write the booleans that this object uses to a BooleanStream
        //
        public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
        {
            RemoveInfo info = (RemoveInfo)o;

            int rc = base.TightMarshal1(wireFormat, o, bs);
            rc += TightMarshalCachedObject1(wireFormat, (DataStructure)info.ObjectId, bs);
            rc += TightMarshalLong1(wireFormat, info.LastDeliveredSequenceId, bs);

            return rc + 0;
        }
Пример #18
0
        internal async Task DoCloseAsync()
        {
            await ShutdownAsync().Await();

            RemoveInfo removeInfo = new RemoveInfo();

            removeInfo.ObjectId = this.info.SessionId;
            removeInfo.LastDeliveredSequenceId = this.lastDeliveredSequenceId;
            this.connection.Oneway(removeInfo);
        }
Пример #19
0
        public int Add(RemoveInfo remove)
        {
            string sql = "insert into RemoveInfo(Rid,RName,RTable) values(@id,@name,@table)";

            SQLiteParameter[] param =
            {
                new SQLiteParameter("@id",    remove.RId),
                new SQLiteParameter("@name",  remove.RName),
                new SQLiteParameter("@table", remove.RTable)
            };
            return(SqliteHelper.ExecuteNonQuery(sql, param));
        }
Пример #20
0
        internal void DoClose()
        {
            Shutdown();
            RemoveInfo removeCommand = new RemoveInfo();

            removeCommand.ObjectId = this.ConsumerId;
            if (Tracer.IsDebugEnabled)
            {
                Tracer.DebugFormat("Remove of Consumer[{0}] sent last delivered Id[{1}].",
                                   this.ConsumerId, this.lastDeliveredSequenceId);
            }
            removeCommand.LastDeliveredSequenceId = lastDeliveredSequenceId;
            this.session.Connection.Oneway(removeCommand);
        }
Пример #21
0
        protected virtual void WriteRemoveInfo(RemoveInfo command, BinaryWriter dataOut)
        {
            StompFrame frame = new StompFrame("UNSUBSCRIBE");
            object     id    = command.ObjectId;

            if (id is ConsumerId)
            {
                ConsumerId consumerId = id as ConsumerId;
                if (command.ResponseRequired)
                {
                    frame.SetProperty("receipt", command.CommandId);
                }
                frame.SetProperty("id", StompHelper.ToStomp(consumerId));
                frame.ToStream(dataOut);
            }
        }
Пример #22
0
        public void Close()
        {
            lock (closedLock)
            {
                if (closed)
                {
                    return;
                }

                DoClose();
                RemoveInfo removeInfo = new RemoveInfo();
                removeInfo.ObjectId = this.info.ProducerId;
                this.session.Connection.Oneway(removeInfo);
                this.session = null;
            }
        }
Пример #23
0
        protected virtual void WriteRemoveInfo(RemoveInfo command, BinaryWriter dataOut)
        {
            var    frame = new StompFrame("UNSUBSCRIBE", _encodeHeaders);
            Object id    = command.ObjectId;

            if (id is not ConsumerId consumerId)
            {
                return;
            }
            if (command.ResponseRequired)
            {
                frame.SetProperty(PropertyKeys.Receipt, command.CommandId);
            }
            frame.SetProperty(PropertyKeys.Id, consumerId.ToString());

            frame.ToStream(dataOut);
        }
Пример #24
0
 internal void Dispose()
 {
     if (!closed)
     {
         this.closed = true;
         try
         {
             RemoveInfo removeIt = new RemoveInfo();
             removeIt.ObjectId = this.info.ConsumerId;
             this.connection.Oneway(removeIt);
         }
         catch (Exception e)
         {
             Tracer.Debug("Failed to send remove for AdvisoryConsumer: " + e.Message);
         }
         this.connection.RemoveDispatcher(this.info.ConsumerId);
     }
 }
Пример #25
0
        public void OnRemoveTrailingWhiteSpaces()
        {
            Mono.TextEditor.TextEditorData data = doc.Editor;
            if (data == null)
            {
                return;
            }

            System.Collections.Generic.List <RemoveInfo> removeList = new System.Collections.Generic.List <RemoveInfo> ();
            int        pos        = data.Document.Length - 1;
            RemoveInfo removeInfo = RemoveInfo.GetRemoveInfo(data.Document, ref pos);

            if (!removeInfo.IsEmpty)
            {
                removeList.Add(removeInfo);
            }

            while (pos >= 0)
            {
                char ch = data.Document.GetCharAt(pos);
                if (ch == '\n' || ch == '\r')
                {
                    if (RemoveInfo.IsWhiteSpace(data.Document.GetCharAt(pos - 1)))
                    {
                        --pos;
                        removeInfo = RemoveInfo.GetRemoveInfo(data.Document, ref pos);
                        if (!removeInfo.IsEmpty)
                        {
                            removeList.Add(removeInfo);
                        }
                    }
                }
                --pos;
            }

            data.Document.BeginAtomicUndo();
            foreach (var info in removeList)
            {
                ((Mono.TextEditor.IBuffer)data.Document).Remove(info.Position, info.Length);
                data.Document.CommitLineUpdate(data.Document.OffsetToLineNumber(info.Position));
            }
            data.Caret.Offset = Math.Min(data.Caret.Offset, data.Document.Length - 1);
            data.Document.EndAtomicUndo();
        }
Пример #26
0
        public void OnRemoveTrailingWhiteSpaces()
        {
            Mono.TextEditor.TextEditorData data = doc.Editor;
            if (data == null)
            {
                return;
            }

            System.Collections.Generic.List <RemoveInfo> removeList = new System.Collections.Generic.List <RemoveInfo> ();
            int        pos        = data.Document.TextLength - 1;
            RemoveInfo removeInfo = RemoveInfo.GetRemoveInfo(data.Document, ref pos);

            if (!removeInfo.IsEmpty)
            {
                removeList.Add(removeInfo);
            }

            while (pos >= 0)
            {
                char ch = data.Document.GetCharAt(pos);
                if (ch == '\n' || ch == '\r')
                {
                    if (RemoveInfo.IsWhiteSpace(data.Document.GetCharAt(pos - 1)))
                    {
                        --pos;
                        removeInfo = RemoveInfo.GetRemoveInfo(data.Document, ref pos);
                        if (!removeInfo.IsEmpty)
                        {
                            removeList.Add(removeInfo);
                        }
                    }
                }
                --pos;
            }
            using (var undo = data.OpenUndoGroup())
            {
                foreach (var info in removeList)
                {
                    data.Document.Remove(info.Position, info.Length);
                    data.Document.CommitLineUpdate(data.Document.OffsetToLineNumber(info.Position));
                }
            }
        }
Пример #27
0
        public void Close()
        {
            lock (closedLock)
            {
                if (closed)
                {
                    return;
                }

                Shutdown();
                RemoveInfo removeInfo = new RemoveInfo();
                removeInfo.ObjectId = this.info.ProducerId;
                this.session.Connection.Oneway(removeInfo);
                if (Tracer.IsDebugEnabled)
                {
                    Tracer.DebugFormat("Remove of Producer[{0}] sent.", this.ProducerId);
                }
            }
        }
Пример #28
0
        public void OnRemoveTrailingWhiteSpaces()
        {
            var data = doc.Editor;

            if (data == null)
            {
                return;
            }

            System.Collections.Generic.List <RemoveInfo> removeList = new System.Collections.Generic.List <RemoveInfo> ();
            int        pos        = data.Length - 1;
            RemoveInfo removeInfo = RemoveInfo.GetRemoveInfo(data, ref pos);

            if (!removeInfo.IsEmpty)
            {
                removeList.Add(removeInfo);
            }

            while (pos >= 0)
            {
                char ch = data.GetCharAt(pos);
                if (ch == '\n' || ch == '\r')
                {
                    if (RemoveInfo.IsWhiteSpace(data.GetCharAt(pos - 1)))
                    {
                        --pos;
                        removeInfo = RemoveInfo.GetRemoveInfo(data, ref pos);
                        if (!removeInfo.IsEmpty)
                        {
                            removeList.Add(removeInfo);
                        }
                    }
                }
                --pos;
            }
            using (var undo = data.OpenUndoGroup()) {
                foreach (var info in removeList)
                {
                    data.RemoveText(info.Position, info.Length);
                }
            }
        }
Пример #29
0
        public async Task CloseAsync()
        {
            using (await closedLock.LockAsync().Await())
            {
                if (closed)
                {
                    return;
                }

                Shutdown();
                RemoveInfo removeInfo = new RemoveInfo();
                removeInfo.ObjectId = this.info.ProducerId;
                this.session.Connection.Oneway(removeInfo);
                if (Tracer.IsDebugEnabled)
                {
                    Tracer.DebugFormat("Remove of Producer[{0}] for destination[{1}] sent.",
                                       this.ProducerId, this.info.Destination);
                }
            }
        }
Пример #30
0
        protected virtual void WriteRemoveInfo(RemoveInfo command, BinaryWriter dataOut)
        {
            StompFrame frame = new StompFrame("UNSUBSCRIBE");
            object     id    = command.ObjectId;

            if (id is ConsumerId)
            {
                ConsumerId consumerId = id as ConsumerId;
                if (command.ResponseRequired)
                {
                    frame.SetProperty("receipt", command.CommandId);
                }
                frame.SetProperty("id", consumerId.ToString());

                if (Tracer.IsDebugEnabled)
                {
                    Tracer.Debug("StompWireFormat - Writing " + frame.ToString());
                }

                frame.ToStream(dataOut);
            }
        }
Пример #31
0
 private SilverVendorStoneRemoveHueGump(Mobile from, SilverVendorStone stone, RemoveInfo[] removelist)
     : base(25, 25)
 {
     m_RemoveList = removelist;
 }
Пример #32
0
        public SilverVendorStoneRemoveHueGump(Mobile mobile, SilverVendorStone stone)
            : base(25, 25)
        {
            m_Stone = stone;

            m_RemoveList = new RemoveInfo[m_Stone.HueList.Count];
            for (int i = 0; i < m_Stone.HueList.Count; i++)
            {
                m_RemoveList[i] = new RemoveInfo((int)m_Stone.HueList[i], (int)m_Stone.HuePrices[i]);
            }

            Closable = false;
            Dragable = false;

            m_Mobile = mobile;

            AddPage(0);

            AddBackground(25, 10, 220, 490, 5054);

            AddImageTiled(33, 20, 200, 470, 2624);
            AddAlphaRegion(33, 20, 200, 470);

            AddLabel(100, 40, 1152, "Vendor Stone Hues");

            AddButton(170, 380, 4005, 4007, 0, GumpButtonType.Reply, 0);
            AddLabel(170, 363, 1152, "Back");
            AddButton(170, 450, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddLabel(170, 403, 1152, "Remove");
            AddLabel(170, 418, 1152, "Selected");
            AddLabel(170, 433, 1152, "Hues");

            for (int i = 0; i < m_Stone.HueList.Count; ++i)
            {
                if ((i % 20) == 0)
                {
                    if (i != 0)
                    {
                        AddButton(170, 315, 0x1196, 0x1196, 1152, GumpButtonType.Page, (i / 20) + 1);
                        AddLabel(170, 300, 1152, "Next page");
                    }

                    AddPage((i / 20) + 1);

                    if (i != 0)
                    {
                        AddButton(170, 275, 0x119a, 0x119a, 1152, GumpButtonType.Page, (i / 20));
                        AddLabel(170, 260, 1152, "Previous page");
                    }
                }

                int hue = (int)m_Stone.HueList[i];
                int price = (int)m_Stone.HuePrices[i];

                AddLabel(70, 60 + ((i % 20) * 20), hue - 1, "" + hue);
                AddLabel(120, 60 + ((i % 20) * 20), 1152, "" + price);
                AddCheck(40, 60 + ((i % 20) * 20), 0x2342, 0x2343, m_RemoveList[i].toRemove, i);
            }
        }