Esempio n. 1
0
        /**
         * Prints {@link com.revo.deployr.client.broker.RTaskResult}
         * to console output.
         */
        public static void printRTaskResult(RTask task, RTaskResult result, String error)
        {
            Console.WriteLine("\nTask: " + task);

            if (error != null)
            {
                Console.WriteLine("Status[fail]: cause=" + error);
            }
            else
            {
                switch (result.getType())
                {
                case RTaskType.DISCRETE:
                    if (result.isSuccess())
                    {
                        Console.WriteLine("Status[ok]: [ code : " +
                                          result.getTimeOnCode() + " , server : " +
                                          result.getTimeOnServer() + " , call : " +
                                          result.getTimeOnCall() + " ]");
                    }
                    else
                    {
                        Console.WriteLine("Status[fail]: cause=" + result.getFailure());
                    }
                    break;

                case RTaskType.POOLED:
                    if (result.isSuccess())
                    {
                        Console.WriteLine("Status[ok]: [ code : " +
                                          result.getTimeOnCode() + " , server : " +
                                          result.getTimeOnServer() + " , call : " +
                                          result.getTimeOnCall() + " ]");
                    }
                    else
                    {
                        Console.WriteLine("Status[fail]: cause=" + result.getFailure());
                    }
                    break;

                case RTaskType.BACKGROUND:
                    if (result.isSuccess())
                    {
                        Console.WriteLine("Status[ok]: [ server : " +
                                          result.getTimeOnServer() + " , call : " +
                                          result.getTimeOnCall() + " ]");
                    }
                    else
                    {
                        Console.WriteLine("Status[fail]: cause=" + result.getFailure());
                    }
                    break;
                }
            }
        }
        /**
            * Prints {@link com.revo.deployr.client.broker.RTaskResult}
            * to console output.
            */
        public static void printRTaskResult(RTask task, RTaskResult result, String error)
        {
            Console.WriteLine("\nTask: " + task);

            if(error != null)
            {
                Console.WriteLine("Status[fail]: cause=" + error);
            }
            else
            {

                switch(result.getType())
                {

                    case RTaskType.DISCRETE:
                        if(result.isSuccess())
                        {
                            Console.WriteLine("Status[ok]: [ code : " +
                                    result.getTimeOnCode() + " , server : " +
                                    result.getTimeOnServer() + " , call : " +
                                    result.getTimeOnCall() + " ]");
                        }
                        else
                        {
                            Console.WriteLine("Status[fail]: cause=" + result.getFailure());
                        }
                        break;

                    case RTaskType.POOLED:
                        if(result.isSuccess())
                        {
                            Console.WriteLine("Status[ok]: [ code : " +
                                    result.getTimeOnCode() + " , server : " +
                                    result.getTimeOnServer() + " , call : " +
                                    result.getTimeOnCall() + " ]");
                        }
                        else
                        {
                            Console.WriteLine("Status[fail]: cause=" + result.getFailure());
                        }
                        break;

                    case RTaskType.BACKGROUND:
                        if(result.isSuccess())
                        {
                            Console.WriteLine("Status[ok]: [ server : " +
                                    result.getTimeOnServer() + " , call : " +
                                    result.getTimeOnCall() + " ]");
                        }
                        else
                        {
                            Console.WriteLine("Status[fail]: cause=" + result.getFailure());
                        }
                        break;

                }
            }
        }
        /*
         * Updates RBrokerRuntimeStats for RBroker.
         */
        private void updateBrokerStats(RTaskResult result)
        {
            Interlocked.Increment(ref m_totalTasksRunByBroker);

            if (result.isSuccess())
            {
                Interlocked.Increment(ref m_totalTasksRunToSuccess);
            }
            Interlocked.Add(ref m_totalTaskTimeOnCode, result.getTimeOnCode());
            Interlocked.Add(ref m_totalTaskTimeOnServer, result.getTimeOnServer());
            Interlocked.Add(ref m_totalTaskTimeOnCall, result.getTimeOnCall());
        }
        /*
             * Updates RBrokerRuntimeStats for RBroker.
             */
        private void updateBrokerStats(RTaskResult result)
        {
            Interlocked.Increment(ref m_totalTasksRunByBroker);

                if(result.isSuccess())
                {
                    Interlocked.Increment(ref m_totalTasksRunToSuccess);
                }
                Interlocked.Add(ref m_totalTaskTimeOnCode, result.getTimeOnCode());
                Interlocked.Add(ref m_totalTaskTimeOnServer, result.getTimeOnServer());
                Interlocked.Add(ref m_totalTaskTimeOnCall, result.getTimeOnCall());
        }