@Override
public void putData(final Map<String, Map<Long, Map<String, String>>> value, final TimeUnit timeUnit,
final Runnable callback) {
PERF_LOGGER.debug("Queue size {}", queue.size());
if (!value.isEmpty()) {
DataArchive db = this.dataArchives.get(0);
try {
db.putData(value, timeUnit, null);
} catch (BufferFullException e) {
LOGGER.error("Memory buffer should not be full", e);
}
if (dataArchives.size() == 1) {
callback.run();
} else {
Runnable bulkInsert = new Runnable() {
public void run() {
try {
for (Iterator<DataArchive> it = dataArchives.iterator(); it.hasNext();) {
DataArchive dataArchive = it.next();
if (dataArchive.getLOS() == LOS.fast) {
continue;
}
try {
if (it.hasNext()) {
dataArchive.putData(value, timeUnit, null);
} else {
dataArchive.putData(value, timeUnit, callback);
}
} catch (BufferFullException e) {
dormantArchive = dataArchive;
it.remove();
bufferFullAlert(e.getMessage());