fiftyone.device.example.batch
Class FutureUaProcessor
java.lang.Object
fiftyone.device.example.batch.UaProcessor.Base
fiftyone.device.example.batch.FutureUaProcessor
- All Implemented Interfaces:
- UaProcessor
public class FutureUaProcessor
- extends UaProcessor.Base
Implementation of UaProcessor that uses ExecutorCompletionService to do detections.
All results are stored in memory, so while this class is fast to execute it cannot carry
out large numbers of detections. It's fine for the 20k HTTP User-Agents distributed as a sample.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FutureUaProcessor
public FutureUaProcessor(BufferedReader useragents,
Provider provider,
int numberOfThreads,
int limit)
throws IOException
- Throws:
IOException
getCpuTime
public static long getCpuTime()
- Get CPU time in nanoseconds. The run time may not support resolutions finer than microsecond
- Returns:
- CPU time as long.
process
public void process()
throws Exception
- Description copied from interface:
UaProcessor
- Process the set of UA Headers
- Throws:
Exception - if there was a problem accessing data file.
printStats
public void printStats(PrintWriter output)
- Description copied from interface:
UaProcessor
- Writes timings (overall) of of a detection test
- Specified by:
printStats in interface UaProcessor- Overrides:
printStats in class UaProcessor.Base
- Parameters:
output - a PrintWriter to report the timings on
writeResults
public void writeResults(BufferedWriter writer)
throws IOException
- Description copied from interface:
UaProcessor
- Writes results (for each UA string) of detection test
- Parameters:
writer - a BufferedWriter to write the results to
- Throws:
IOException - if there was a problem accessing data file.
Copyright © 2017 51Degrees. All rights reserved.