/** @throws Exception if error occur. */ @SuppressWarnings("unchecked") private void checkGar() throws Exception { initGar = true; String garDir = "modules/extdata/p2p/deploy"; String garFileName = "p2p.gar"; File origGarPath = U.resolveIgnitePath(garDir + '/' + garFileName); File tmpPath = new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); if (!tmpPath.mkdir()) throw new IOException("Can not create temp directory"); try { File newGarFile = new File(tmpPath, garFileName); U.copy(origGarPath, newGarFile, false); assert newGarFile.exists(); try { garFile = "file:///" + tmpPath.getAbsolutePath(); try { Ignite ignite1 = startGrid(1); Ignite ignite2 = startGrid(2); Integer res = ignite1 .compute() .<UUID, Integer>execute(TASK_NAME, ignite2.cluster().localNode().id()); assert res != null; } finally { stopGrid(1); stopGrid(2); } } finally { if (newGarFile != null && !newGarFile.delete()) error("Can not delete temp gar file"); } } finally { if (!tmpPath.delete()) error("Can not delete temp directory"); } }