Package org.jdesktop.wonderland.runner

Examples of org.jdesktop.wonderland.runner.RunManager


    // task to periodically update the status of all runners with the remote
    // server
    class RemoteUpdateTask extends TimerTask {
        @Override
        public void run() {
            RunManager rm = RunManager.getInstance();

            try {
                for (Runner r : rm.getAll()) {
                    updateRemoteStatus(r);
                }
            } catch (IOException ioe) {
                logger.log(Level.WARNING, "Error updating", ioe);
            }
View Full Code Here


    @POST
    @Consumes({"application/xml"})
    public Response setRunnerInfo(@PathParam(value="runner") String runner,
                                  RunnerInfo runnerInfo) throws UnsupportedEncodingException
    {
        RunManager rm = RunManager.getInstance();
        String decname;
        try {
            decname = URLDecoder.decode(runner, "UTF-8");
        } catch (IOException ioe) {
            throw new WebServiceException(ioe);
        }
       
        Runner r = rm.get(decname);
        if (r == null) {
            ResponseBuilder rb = Response.status(Status.NOT_ACCEPTABLE);
            return rb.entity("No such runner: " + runner).type("text/plain").build();
        }
        if (!(r instanceof BaseRemoteRunner)) {
View Full Code Here

        boolean wait = false;
        if (waitParam != null) {
            wait = Boolean.parseBoolean(waitParam);
        }

        RunManager rm = RunManager.getInstance();

        Collection<Runner> runners = rm.getAll();
        Collection<StatusWaiter> waiters = new ArrayList<StatusWaiter>();
       
        try {
            if (action.equalsIgnoreCase("start")) {
                for (Runner r : runners) {
                    StatusWaiter w = rm.start(r, wait);
                    if (w != null) {
                        waiters.add(w);
                    }
                }
            } else if (action.equalsIgnoreCase("stop")) {
                for (Runner r : runners) {
                    StatusWaiter w = rm.stop(r, wait);
                    if (w != null) {
                        waiters.add(w);
                    }
                }
            } else if (action.equalsIgnoreCase("restart")) {
                // first stop everyone
                for (Runner r : runners) {
                    StatusWaiter w = rm.stop(r, true);
                    if (w != null) {
                        waiters.add(w);
                    }
                }
               
                // now wait for all runners to stop
                for (StatusWaiter sw : waiters) {
                    try {
                        sw.waitFor();
                    } catch (InterruptedException ie) {
                        // ignore
                    }
                }
                waiters.clear();
               
                // now start everyone back up
                for (Runner r : runners) {
                    StatusWaiter w = rm.start(r, wait);
                    if (w != null) {
                        waiters.add(w);
                    }
                }
            } else {
View Full Code Here

    @Produces({"text/plain", "application/xml", "application/json"})
    public Response get(@PathParam(value="runner") String runner,
                        @PathParam(value="action") String action,
                        @QueryParam(value="wait"String waitParam)
    {
        RunManager rm = RunManager.getInstance();

        try {
            Runner r = rm.get(runner);
            if (r == null) {
                throw new RunnerException("Request for unknown runner: " +
                                          runner);
            }
       
            boolean wait = false;
            if (waitParam != null) {
                wait = Boolean.parseBoolean(waitParam);
            }
            StatusWaiter waiter = null;
           
            if (action.equalsIgnoreCase("start")) {
                waiter = rm.start(r, wait);
            } else if (action.equalsIgnoreCase("stop")) {
                waiter = rm.stop(r, wait);
            } else if (action.equalsIgnoreCase("restart")) {
                // stop the runner and wait for it to stop
                waiter = rm.stop(r, true);
                if (waiter != null) {
                    waiter.waitFor();
                }
               
                // wait for a bit so that everything gets cleaned up
                try {
                    Thread.sleep(ActionResource.getRestartDelay() * 1000);
                } catch (InterruptedException ie) {
                    // oh well
                }

                // restart the runner
                waiter = rm.start(r, wait);
            } else if (action.equalsIgnoreCase("log")) {
                // read the log file
                if (r.getLogFile() != null) {
                    BufferedReader reader = new BufferedReader(
                                                new FileReader(r.getLogFile()));
View Full Code Here

    @Produces({"text/plain", "application/xml", "application/json"})
    public Response get(@PathParam(value="runner") String runner,
                        @PathParam(value="action") String action,
                        @QueryParam(value="name"String nameParam)
    {
        RunManager rm = RunManager.getInstance();

        try {
            Runner r = rm.get(runner);
            if (r == null) {
                throw new RunnerException("Request for unknown runner: " +
                                          runner);
            }
       
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.runner.RunManager

Copyright © 2018 www.massapicom. 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.