Exemple #1
0
        /**
         * Method declaration
         *
         *
         * @param c
         * @param channel
         *
         * @return
         *
         * @throws Exception
         */
        private Result processDisconnect(Tokenizer c,
                                         Channel channel)
        {
            if (!channel.isClosed())
            {
                channel.disconnect();
                cChannel.Insert(channel.getId(), null);
            }

            return(new Result());
        }
Exemple #2
0
        /**
         * Method declaration
         *
         *
         * @param channel
         */
        public void registerChannel(Channel channel)
        {
            int size = cChannel.Count;
            int id   = channel.getId();

            if (id >= size)
            {
                cChannel.Add(channel);
            }

            cChannel.RemoveAt(id);
            cChannel.Insert(id, channel);
        }
Exemple #3
0
        /**
         * Method declaration
         *
         *
         * @param c
         * @param s
         *
         * @throws Exception
         */
        public void write(Channel c, string s)
        {
            if (bRestoring || s == null || s.Equals(""))
            {
                return;
            }

            if (!bReadOnly)
            {
                int id = 0;

                if (c != null)
                {
                    id = c.getId();
                }

                if (id != mLastId)
                {
                    s       = "/*C" + id + "*/" + s;
                    mLastId = id;
                }

                try
                {
                    writeLine(wScript, s);

                    if (bWriteDelay)
                    {
                        bNeedFlush = true;
                    }
                    else
                    {
                        wScript.Flush();
                    }
                }
                catch (IOException e)
                {
                    Trace.error(Trace.FILE_IO_ERROR, sFileScript);
                }

                if (iLogSize > 0 && iLogCount++ > 100)
                {
                    iLogCount = 0;

                    if ((new File(sFileScript)).Length > iLogSize * 1024 * 1024)
                    {
                        checkpoint();
                    }
                }
            }
        }
Exemple #4
0
        /**
         * Method declaration
         *
         *
         * @param c
         * @param s
         *
         * @throws Exception
         */
        public void write(Channel c, string s)
        {
            if (bRestoring || s == null || s.Equals(""))
            {
                return;
            }

            if (!bReadOnly)
            {
                int id = 0;

                if (c != null)
                {
                    id = c.getId();
                }

                if (id != mLastId)
                {
                    s = "/*C" + id + "*/" + s;
                    mLastId = id;
                }

                try
                {
                    writeLine(wScript, s);

                    if (bWriteDelay)
                    {
                        bNeedFlush = true;
                    }
                    else
                    {
                        wScript.Flush();
                    }
                }
                catch (IOException e)
                {
                    Trace.error(Trace.FILE_IO_ERROR, sFileScript);
                }

                if (iLogSize > 0 && iLogCount++ > 100)
                {
                    iLogCount = 0;

                    if ((new File(sFileScript)).Length > iLogSize * 1024 * 1024)
                    {
                        checkpoint();
                    }
                }
            }
        }