Package org.geowebcache.seed

Examples of org.geowebcache.seed.GWCTask


            tasks = true;
        }

        while (iter.hasNext()) {
            Entry<Long, GWCTask> entry = iter.next();
            GWCTask task = entry.getValue();

            final long spent = task.getTimeSpent();
            final long remining = task.getTimeRemaining();
            final long tilesDone = task.getTilesDone();
            final long tilesTotal = task.getTilesTotal();

            NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
            nf.setGroupingUsed(true);
            final String tilesTotalStr;
            if (tilesTotal < 0) {
                tilesTotalStr = "Too many to count";
            } else {
                tilesTotalStr = nf.format(tilesTotal);
            }
            final String tilesDoneStr = nf.format(task.getTilesDone());
            String timeSpent = toTimeString(spent, tilesDone, tilesTotal);
            String timeRemaining = toTimeString(remining, tilesDone, tilesTotal);

            doc.append("<tr>");
            doc.append("<td>").append(entry.getKey()).append("</td>");
            doc.append("<td>").append(task.getLayerName()).append("</td>");
            doc.append("<td>").append(task.getType()).append("</td>");
            doc.append("<td>").append(tilesTotalStr).append("</td>");
            doc.append("<td>").append(tilesDoneStr).append("</td>");
            doc.append("<td>").append(timeSpent).append("</td>");
            doc.append("<td>").append(timeRemaining).append("</td>");
            doc.append("<td>(Thread ").append(task.getThreadOffset() + 1).append(" of ")
                    .append(task.getThreadCount()).append(") </td>");
            doc.append("<td>").append(makeThreadKillForm(entry.getKey(), tl)).append("</td>");
            doc.append("<tr>");
        }

        if (tasks) {
View Full Code Here


    private void handleKillAllThreadsPost(Form form, TileLayer tl, Response resp) {
        Iterator<Entry<Long, GWCTask>> runningTasks = seeder.getRunningTasksIterator();
        while (runningTasks.hasNext()) {
            Entry<Long, GWCTask> next = runningTasks.next();
            GWCTask task = next.getValue();
            long taskId = task.getTaskId();
            seeder.terminateGWCTask(taskId);
        }
        StringBuilder doc = new StringBuilder();

        makeHeader(doc);
View Full Code Here

            }

            liveCount = 0;
            Iterator<GWCTask> iter = seedTasks.iterator();
            while (iter.hasNext()) {
                GWCTask task = iter.next();
                if (task.getState() != STATE.DEAD && task.getState() != STATE.DONE) {
                    liveCount++;
                } else {
                    iter.remove();
                }
            }
View Full Code Here

                    + "/" + Long.toHexString(parametersId));
            } else {
                log.trace("Expiring page " + tilePage + "/" + mimeType.getFormat());
            }
        }
        GWCTask truncateTask = createTruncateTaskForPage(layerName, gridSetId, zoomLevel,
                pageGridCoverage, mimeType, parametersId);

        // truncate synchronously. We're already inside the interested thread
        try {
            truncateTask.doAction();
            pageStore.setTruncated(tilePage);
        } catch (InterruptedException e) {
            log.debug("Truncate task interrupted");
            return;
        } catch (GeoWebCacheException e) {
View Full Code Here

            truncateTasks = this.tileBreeder.createTasks(tileRange, GWCTask.TYPE.TRUNCATE, 1,
                    filterUpdate);
        } catch (GeoWebCacheException e) {
            throw new RuntimeException(e);
        }
        GWCTask truncateTask = truncateTasks[0];

        return truncateTask;
    }
View Full Code Here

        int row = 0;

        final String layerName = tl.getName();
        while (iter.hasNext()) {
            GWCTask task = iter.next();
            if (!listAll && !layerName.equals(task.getLayerName())) {
                continue;
            }
            final long spent = task.getTimeSpent();
            final long remining = task.getTimeRemaining();
            final long tilesDone = task.getTilesDone();
            final long tilesTotal = task.getTilesTotal();

            NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
            nf.setGroupingUsed(true);
            final String tilesTotalStr;
            if (tilesTotal < 0) {
                tilesTotalStr = "Too many to count";
            } else {
                tilesTotalStr = nf.format(tilesTotal);
            }
            final String tilesDoneStr = nf.format(task.getTilesDone());
            final STATE state = task.getState();

            final String status = STATE.UNSET.equals(state) || STATE.READY.equals(state) ? "PENDING"
                    : state.toString();

            String timeSpent = toTimeString(spent, tilesDone, tilesTotal);
            String timeRemaining = toTimeString(remining, tilesDone, tilesTotal);

            String bgColor = ++row % 2 == 0 ? "#FFFFFF" : "#DDDDDD";
            doc.append("<tr style=\"background-color:" + bgColor + ";\">");
            doc.append("<td style=\"text-align:right\">").append(task.getTaskId()).append("</td>");
            doc.append("<td>");
            if (!layerName.equals(task.getLayerName())) {
                doc.append("<a href=\"./").append(task.getLayerName()).append("\">");
            }
            doc.append(task.getLayerName());
            if (!layerName.equals(task.getLayerName())) {
                doc.append("</a>");
            }
            doc.append("</td>");
            doc.append("<td>").append(status).append("</td>");
            doc.append("<td>").append(task.getType()).append("</td>");
            doc.append("<td>").append(tilesTotalStr).append("</td>");
            doc.append("<td>").append(tilesDoneStr).append("</td>");
            doc.append("<td>").append(timeSpent).append("</td>");
            doc.append("<td>").append(timeRemaining).append("</td>");
            doc.append("<td>(Task ").append(task.getThreadOffset() + 1).append(" of ")
                    .append(task.getThreadCount()).append(") </td>");
            doc.append("<td>").append(makeThreadKillForm(task.getTaskId(), tl)).append("</td>");
            doc.append("<tr>");
        }

        if (tasks) {
            doc.append("</table>");
View Full Code Here

        }

        List<GWCTask> terminatedTasks = new LinkedList<GWCTask>();
        List<GWCTask> nonTerminatedTasks = new LinkedList<GWCTask>();
        while (tasks.hasNext()) {
            GWCTask task = tasks.next();
            String layerName = task.getLayerName();
            if (!allLayers && !tl.getName().equals(layerName)) {
                continue;
            }
            long taskId = task.getTaskId();
            boolean terminated = seeder.terminateGWCTask(taskId);
            if (terminated) {
                terminatedTasks.add(task);
            } else {
                nonTerminatedTasks.add(task);
View Full Code Here

            }

            liveCount = 0;
            Iterator<GWCTask> iter = seedTasks.iterator();
            while (iter.hasNext()) {
                GWCTask task = iter.next();
                if (task.getState() != STATE.DEAD && task.getState() != STATE.DONE) {
                    liveCount++;
                } else {
                    iter.remove();
                }
            }
View Full Code Here

                    + "/" + parametersId);
            } else {
                log.trace("Expiring page " + tilePage + "/" + mimeType.getFormat());
            }
        }
        GWCTask truncateTask = createTruncateTaskForPage(layerName, gridSetId, zoomLevel,
                pageGridCoverage, mimeType, parametersId);

        // truncate synchronously. We're already inside the interested thread
        try {
            truncateTask.doAction();
            pageStore.setTruncated(tilePage);
        } catch (InterruptedException e) {
            log.debug("Truncate task interrupted");
            return;
        } catch (GeoWebCacheException e) {
View Full Code Here

            truncateTasks = this.tileBreeder.createTasks(tileRange, GWCTask.TYPE.TRUNCATE, 1,
                    filterUpdate);
        } catch (GeoWebCacheException e) {
            throw new RuntimeException(e);
        }
        GWCTask truncateTask = truncateTasks[0];

        return truncateTask;
    }
View Full Code Here

TOP

Related Classes of org.geowebcache.seed.GWCTask

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.