@Test public void testTileStoreCopy() throws InterruptedException { TileStoreManager mgr = workspace.getSubsystemManager(TileStoreManager.class); TileStore src = mgr.get("pyramid"); TileStore dest = mgr.get("filesystem"); TileStoreTransaction ta = dest.acquireTransaction("filesystem"); ExecutorService exec = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); Iterator<TileDataLevel> iter = dest.getTileDataSet("filesystem").getTileDataLevels().iterator(); for (TileDataLevel tm : src.getTileDataSet("utah").getTileDataLevels()) { String id = iter.next().getMetadata().getIdentifier(); int maxx = (int) tm.getMetadata().getNumTilesX(); int maxy = (int) tm.getMetadata().getNumTilesY(); for (int x = 0; x < maxx; ++x) { Worker w = new Worker(x, maxy, tm, ta, id); exec.submit(w); } } exec.shutdown(); exec.awaitTermination(1, TimeUnit.HOURS); }
@Override public Object call() throws Exception { for (int y = 0; y < maxy; ++y) { Tile t = src.getTile(x, y); dest.put(destId, t, x, y); } return null; }