/// <summary>
        /// Method creates an instance of a message processor and returns a thread ready to run the process.
        /// </summary>
        /// <param name="processor">
        /// A instance of a transport message processor derived from IWsTransportMessageProcessor. This parameter
        /// is passed to the message processor. The message processor calls the ProcessRequest method on this
        /// class from the message processor stub.
        /// </param>
        /// <remarks>
        /// If the current thread count is less than the maximum number of threads allowed, this method
        /// creates a new instance of a MessageProcessor nested class and creates a new thread that
        /// calls the MessageProcessor.ProcessRequest method. If the max thread count is reached
        /// this method returns null.
        /// </remarks>
        public void StartNewThread(IWsTransportMessageProcessor processor)
        {
            // Check thread count
            if (m_threadCount >= m_maxThreadCount)
            {
                System.Ext.Console.Write("Max thread count " + m_threadCount + " exceeded. Request ignored.");
                return;
            }

            // Increment the thread count
            Interlocked.Increment(ref m_threadCount);
            System.Ext.Console.Write("New " + m_transportName + " thread number: " + m_threadCount);

            Thread t = new Thread(new ThreadStart(new MessageProcessor(this, processor).ProcessRequest));

            if (t != null)
            {
                t.Start();
            }
        }
        /// <summary>
        /// Method creates an instance of a message processor and returns a thread ready to run the process.
        /// </summary>
        /// <param name="processor">
        /// A instance of a transport message processor derived from IWsTransportMessageProcessor. This parameter
        /// is passed to the message processor. The message processor calls the ProcessRequest method on this
        /// class from the message processor stub.
        /// </param>
        /// <remarks>
        /// If the current thread count is less than the maximum number of threads allowed, this method
        /// creates a new instance of a MessageProcessor nested class and creates a new thread that
        /// calls the MessageProcessor.ProcessRequest method. If the max thread count is reached
        /// this method returns null.
        /// </remarks>
        public void StartNewThread(IWsTransportMessageProcessor processor, object request)
        {
            int add = processor.AddRequest(request);
            int cnt = processor.ThreadCount;

            if (add >= cnt)
            {
                // Check thread count
                if (cnt >= m_maxThreadCount)
                {
                    return;
                }

                System.Ext.Console.Write("New " + m_transportName + " thread number: " + cnt);

                Thread t = new Thread(new ThreadStart(processor.ProcessRequest));

                if (t != null)
                {
                    t.Start();
                }
            }
        }
        /// <summary>
        /// Method creates an instance of a message processor and returns a thread ready to run the process.
        /// </summary>
        /// <param name="processor">
        /// A instance of a transport message processor derived from IWsTransportMessageProcessor. This parameter
        /// is passed to the message processor. The message processor calls the ProcessRequest method on this
        /// class from the message processor stub.
        /// </param>
        /// <remarks>
        /// If the current thread count is less than the maximum number of threads allowed, this method
        /// creates a new instance of a MessageProcessor nested class and creates a new thread that
        /// calls the MessageProcessor.ProcessRequest method. If the max thread count is reached
        /// this method returns null.
        /// </remarks>
        public void StartNewThread(IWsTransportMessageProcessor processor, object request)
        {
            int add = processor.AddRequest(request);
            int cnt = processor.ThreadCount;

            if(add >= cnt)
            {
                // Check thread count
                if (cnt >= m_maxThreadCount)
                {
                    return;
                }

                System.Ext.Console.Write("New " + m_transportName + " thread number: " + cnt);

                Thread t = new Thread(new ThreadStart(processor.ProcessRequest));

                if (t != null)
                {
                    t.Start();
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Create an instance of a message procesor class.
 /// </summary>
 /// <param name="threadManager">
 /// A refernce to the WsThreadManager class that created this class. This parameter is stored
 /// locally an used to decrement the thread managers current thread count.
 /// </param>
 /// <param name="processor">A instance of an object used to process a request. This instance
 /// is the ThreadStart instance.
 /// </param>
 /// <param name="transportName">String used to display the type of thread being created.</param>
 /// <param name="soapMessage">A byte array containing the soap message to process.</param>
 /// <param name="remoteEP">A IPEndPoint that identifies who sent the request.</param>
 /// <param name="messageCheck">
 /// A optional WsMessageCheck instance. If not null the downstream
 /// processor will ignor this message if it has been previously received.
 /// </param>
 public MessageProcessor(WsThreadManager threadManager, IWsTransportMessageProcessor processor)
 {
     m_threadManager = threadManager;
     m_processor = processor;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Method creates an instance of a message processor and returns a thread ready to run the process.
        /// </summary>
        /// <param name="processor">
        /// A instance of a transport message processor derived from IWsTransportMessageProcessor. This parameter
        /// is passed to the message processor. The message processor calls the ProcessRequest method on this
        /// class from the message processor stub.
        /// </param>
        /// <remarks>
        /// If the current thread count is less than the maximum number of threads allowed, this method
        /// creates a new instance of a MessageProcessor nested class and creates a new thread that
        /// calls the MessageProcessor.ProcessRequest method. If the max thread count is reached
        /// this method returns null.
        /// </remarks>
        public void StartNewThread(IWsTransportMessageProcessor processor)
        {
            // Check thread count
            if (m_threadCount >= m_maxThreadCount)
            {
                System.Ext.Console.Write("Max thread count " + m_threadCount + " exceeded. Request ignored.");
                return;
            }

            // Increment the thread count
            Interlocked.Increment(ref m_threadCount);
            System.Ext.Console.Write("New " + m_transportName + " thread number: " + m_threadCount);

            Thread t = new Thread(new ThreadStart(new MessageProcessor(this, processor).ProcessRequest));

            if (t != null)
            {
                t.Start();
            }
        }
 /// <summary>
 /// Create an instance of a message procesor class.
 /// </summary>
 /// <param name="threadManager">
 /// A refernce to the WsThreadManager class that created this class. This parameter is stored
 /// locally an used to decrement the thread managers current thread count.
 /// </param>
 /// <param name="processor">A instance of an object used to process a request. This instance
 /// is the ThreadStart instance.
 /// </param>
 /// <param name="transportName">String used to display the type of thread being created.</param>
 /// <param name="soapMessage">A byte array containing the soap message to process.</param>
 /// <param name="remoteEP">A IPEndPoint that identifies who sent the request.</param>
 /// <param name="messageCheck">
 /// A optional WsMessageCheck instance. If not null the downstream
 /// processor will ignor this message if it has been previously received.
 /// </param>
 public MessageProcessor(WsThreadManager threadManager, IWsTransportMessageProcessor processor)
 {
     m_threadManager = threadManager;
     m_processor     = processor;
 }