XGrid Example

 

public class CalendarGenerator {

    public static void main(String[] args) {


        XgridBatch xgb = new XgridBatch(HOST, PASS, GRID);


        for (int year = 2000; year <= 2050; year++) {

            XgridCommand xgc = new XgridCommand("/usr/bin/cal " + year);

            xgb.addCommand(xgc); // add the command to the batch.

        }


        // Submit the jobs to the Xgrid and wait for them to complete.  

        xgb.submitAndWait();


        // Retrieve the results from the Xgrid.

        ArrayList<XgridResult> results = xgb.getAllResults();


        // Delete the jobs from the Xgrid.

        xgb.deleteAll();

    }

}

The sample code below illustrates how to use dLife’s Xgrid support.  This example uses the unix cal program to generate calendars for the years 2000-2050.