public boolean isFinished() {
return this.isDone;
}
private void produceChunk() throws InterruptedException {
TChunk chunk = new TChunk();
chunk.setSeqId(System.currentTimeMillis());
chunk.setSource(source);
chunk.setStreamName(streamname);
chunk.setApplication(application);
chunk.setDataType(dataType);
chunk.setTags(tags);
List<String> logEvents = new LinkedList<String>();
chunk.setLogEvents(logEvents);
int qSize = messages.size();
if (qSize > maxQueueSize) {
maxQueueSize = qSize;
}
int count = 0;
// Need to be the only one to access
// the messages list
synchronized (wakeUpLink) {
do {
logEvents.add(messages.remove(0));
count++;
} while (!messages.isEmpty() && count < maxMessageCountPerChunk);
}
try {
(new Tracer("honu.client.messageQueueSize [messages, not msec]", messages.size())).logTracer();
(new Tracer("honu.client." + chunk.getApplication() + ".messageQueueSize [messages, not msec]", messages.size())).logTracer();
}catch(Exception ignored) {
}
// Drop on the floor
// TODO instead of dropping on the floor could write to
// a backup file
if (chunkQueue.size() >= maxChunkQueueSize) {
try {
Counter.increment("honu.client.lostChunks");
Counter.increment("honu.client.lostMessages", chunk
.getLogEventsSize());
Counter.increment("honu.client." + chunk.getApplication()
+ ".lostChunks");
Counter.increment("honu.client." + chunk.getApplication()
+ ".lostMessages", chunk.getLogEventsSize());
} catch (Exception ignored) {
}
kv.startMessage("HonuLostStats");
kv.addKeyValue("lostChunk", 1);
kv.addKeyValue("lostLines", chunk.getLogEventsSize());
kv.addKeyValue("RecordType", chunk.getDataType());
kv.addKeyValue("SeqId", chunk.getSeqId());
kv.addKeyValue("period", statFrequency);
log.error(kv.generateMessage());
MessageManager.getInstance().updateLostDataStats(chunk);
} else {