Package com.mozilla.grouperfish.model

Examples of com.mozilla.grouperfish.model.Task


    public String toString() {
        return name;
    }

    public void run() {
        Task task = null;
        try {
            while (!Thread.currentThread().isInterrupted()) {
                task = inQueue.take();
                try {
                    // :TODO: NEXT:
                    // If power fails, tasks can go MIA here.
                    // We should maintain a global map of tasks, check it periodically, and restart tasks that went MIA.
                    // Task update their status there, and clients could check the status using a GET /run/... call.
                    task = handler.handle(task);
                }
                catch (final Fail e) {
                    log.warn(String.format("%s %s: failed with message '%s'", name, task, e.getMessage()));
                    if (task.failures().size() >= NUM_TRIES) {
                        log.error(String.format("%s %s: Error details:", name, task), e);
                        log.error(String.format("%s %s: Retries exhausted. Failing.", name, task));
                        failQueue.put(task);
                    }
                    else {
                        log.warn(String.format("%s %s: recording failure & requeuing...", name, task));
                        inQueue.put(task.fail(e.getMessage()));
                    }
                    continue;
                }
                catch (final Exception e) {
                    log.error(String.format("%s %s: Exception while handling.", name, task));
                    log.error(String.format("%s %s: Error details:", name, task), e);
                    failQueue.put(task.fail(e.getMessage()));
                    continue;
                }

                if (outQueue != null) outQueue.put(task);
                task = null;
View Full Code Here


    /** Run the configured transform over the query results. */
    public void schedule(final Scope ns, final Query query, final TransformConfig transform) {
        Assert.nonNull(query, transform);
        final Index index = indexes.index(ns.bucket(Type.DOCUMENT));
        for (final Query concreteQuery : index.resolve(query)) {
            schedule(new Task(ns, concreteQuery, transform));
        }
    }
View Full Code Here

TOP

Related Classes of com.mozilla.grouperfish.model.Task

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.