Package se.hiq.jee7demo.batch

Source Code of se.hiq.jee7demo.batch.BatchServlet

package se.hiq.jee7demo.batch;

import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchRuntime;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Properties;

/**
* Created by jonashe on 2014-05-03.
*/
@WebServlet("/batch")
public class BatchServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        JobOperator jo = BatchRuntime.getJobOperator();
        long jid = jo.start("myJob", new Properties());

        resp.getWriter().printf("Batch job with id %d started %n", jid);
        resp.getWriter().flush();
    }
}
TOP

Related Classes of se.hiq.jee7demo.batch.BatchServlet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.