use of com.linkedin.parseq.example.composite.classifier.client.impl.ClientImpl in project parseq by linkedin.
the class ClassifierDriver method main.
public static void main(String[] args) throws InterruptedException {
final long viewerId = 0;
final Set<Long> unclassified = new HashSet<Long>();
for (long i = 0; i < 20; i++) {
unclassified.add(i);
}
final ScheduledExecutorService serviceScheduler = Executors.newSingleThreadScheduledExecutor();
final Client restLiClient = new ClientImpl(serviceScheduler);
final int numCores = Runtime.getRuntime().availableProcessors();
final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(numCores + 1);
final Engine engine = new EngineBuilder().setTaskExecutor(scheduler).setTimerScheduler(scheduler).build();
final ClassifierPlanFactory classifier = new ClassifierPlanFactory(restLiClient);
try {
final Task<Map<Long, Classification>> classifications = classifier.classify(viewerId, unclassified);
engine.run(classifications);
classifications.await();
System.out.println(classifications.get());
ExampleUtil.printTracingResults(classifications);
} finally {
serviceScheduler.shutdownNow();
engine.shutdown();
scheduler.shutdownNow();
}
}
Aggregations