log.info("Background task 1..."); client.background(request); log.info("Background task 2..."); client.background(request); log.info("Background task 3..."); client.background(request);
ServerJvms jvms = new ServerJvms(grid,2); jvms.start();  try { log.info("Background task 1..."); client.background(request); log.info("Background task 2..."); client.background(request); log.info("Background task 3..."); client.background(request); } finally { jvms.stop(); }
    public void testBackgroundTask() throws Exception    {        GridConfiguration config = new GridConfiguration();        config.setGridName("test");        config.setType(Grid.TYPE_CLIENT);        Grid grid = config.configure();        grid.connect();        Client client = grid.getClient();        List input = new ArrayList();        for (int i = 0; i < 10; i++)            input.add(new MonteCarloPi.Input(17 * i + 1, 1000));        TaskRequest request = new TaskRequest(                MonteCarloPi.class.getName(),                MonteCarloPi.MCPiAggregator.class.getName(),                10, input);        log.info("Background task 1...");        client.background(request);        log.info("Background task 2...");        client.background(request);        log.info("Background task 3...");        client.background(request);    }