public void getAppServers()

in code/src/main/java/DataProviderSMON.java [101:159]


    public void getAppServers() throws JCoException
    {
        System.out.println("Executing RFC 'TH_SERVER_LIST'...");

        final JCoDestination destination = JCoDestinationManager.getDestination(config.destination_name);

        /*if (function_list == null) { DO NO CACHE DUE TO BUG DUPLICATES */
            function_list = destination.getRepository().getFunction("TH_SERVER_LIST");
        /*} else {
            System.out.println("Use function definition from cache...");
        }*/

        if (function_list == null) {
            throw new RuntimeException("RFC 'TH_SERVER_LIST' not found! Check the SAP user authorization and required SAP release (ST-PI >= SP08)!");
        }

        try {
            function_list.execute(destination);
        } catch (final AbapException e) {
            System.out.println(e.toString());
            throw new RuntimeException("Connection lost: " + e.toString());
        }

        if(config.debug)
            System.out.println(function_list.getTableParameterList().toXML());

        JCoTable result = function_list.getTableParameterList().getTable("LIST");

        Integer monresult = result.getNumRows();

        System.out.println("TH_SERVER_LIST Result Set: " + monresult);
        System.out.println();

        Integer tmpAppServers = 0;
        for (int i = 0; i < monresult; i++) {

            result.setRow(i);

            /*String NAME = result.getString("NAME");*/
            String STATE = result.getString("STATE");

            //01 = Active
            if (STATE.equals("01")) {
                tmpAppServers++;
            }

        }

        if(appServers > 0 && tmpAppServers > 0 && appServers != tmpAppServers)
        {
            System.out.println("Number of App Servers changed - restart /SDF/SMON collector!");
            DeleteSMONJob();
            startSMONJob();
        }

        appServers = tmpAppServers;
        utils.collectResultEmbedded(config.destination_name, "TOTAL_APP_SERVERS",(double) appServers);
        utils.submitResultsEmbedded("TOTAL_APP_SERVERS");
    }