/** * @param pid PID of the other party. * @param size Size of the space. * @return Token pair. */ private IgnitePair<String> inOutToken(int pid, int size) { while (true) { long idx = tokIdxGen.get(); if (tokIdxGen.compareAndSet(idx, idx + 2)) return F.pair( new File(tokDir, TOKEN_FILE_NAME + idx + "-" + pid + "-" + size).getAbsolutePath(), new File(tokDir, TOKEN_FILE_NAME + (idx + 1) + "-" + pid + "-" + size) .getAbsolutePath()); } }