fixed constants and made them static finals

This commit is contained in:
Dhruv Parthasarathy 2013-06-26 15:12:55 -07:00
parent e3f0b8770b
commit 235ecce522
2 changed files with 4 additions and 2 deletions

View File

@ -24,6 +24,7 @@ public class UpdateStream implements Runnable
private BlockingQueue<Map<String, Object>> queue;
private ObjectMapper mapper;
private final TypeReference<HashMap<String,Object>> typeRef;
private static final long queueWaitTime = 15L;
public UpdateStream(InputSupplier supplier, BlockingQueue<Map<String, Object>> queue)
{
@ -49,7 +50,7 @@ public class UpdateStream implements Runnable
if (isValid(line)) {
try {
HashMap<String, Object> map = mapper.readValue(line, typeRef);
queue.offer(map, 15L, TimeUnit.SECONDS);
queue.offer(map, queueWaitTime, TimeUnit.SECONDS);
log.info("Successfully added to queue");
}
catch (JsonParseException e) {

View File

@ -27,6 +27,8 @@ public class WebFirehoseFactory implements FirehoseFactory
private final List<String> dimensions;
private final String timeDimension;
private final List<String> renamedDimensions;
private static final int QUEUE_SIZE = 2000;
@JsonCreator
public WebFirehoseFactory(
@ -45,7 +47,6 @@ public class WebFirehoseFactory implements FirehoseFactory
@Override
public Firehose connect() throws IOException
{
final int QUEUE_SIZE = 2000;
final BlockingQueue<Map<String, Object>> queue = new ArrayBlockingQueue<Map<String, Object>>(QUEUE_SIZE);
Runnable updateStream = new UpdateStream(new WebJsonSupplier(dimensions, url), queue);