use of com.tencent.angel.graph.client.node2vec.data.WalkPath in project angel by Tencent.
the class PathQueue method popBatchPath.
public static Long2ObjectOpenHashMap<long[]> popBatchPath(int psPartId, int batchSize) {
ReentrantLock queueLock = psPartId2Lock.get(psPartId);
queueLock.lock();
Long2ObjectOpenHashMap<long[]> result;
try {
Queue<WalkPath> queue = psPartId2Queue.get(psPartId);
int count = 0;
result = new Long2ObjectOpenHashMap<>(batchSize);
while (!queue.isEmpty() && count < batchSize) {
WalkPath wPath = queue.poll();
result.put(wPath.getHead(), wPath.getPath());
count++;
}
} finally {
queueLock.unlock();
}
return result;
}
use of com.tencent.angel.graph.client.node2vec.data.WalkPath in project angel by Tencent.
the class PathQueue method popBatchPath.
public static void popBatchPath(int psPartId, int batchSize, Long2ObjectOpenHashMap<long[]> result) {
ReentrantLock queueLock = psPartId2Lock.get(psPartId);
queueLock.lock();
try {
Queue<WalkPath> queue = psPartId2Queue.get(psPartId);
int count = 0;
while (!queue.isEmpty() && count < batchSize) {
WalkPath wPath = queue.poll();
result.put(wPath.getHead(), wPath.getPath());
count++;
}
} finally {
queueLock.unlock();
}
}
Aggregations