Commit f174ee26 authored by MartinFIT's avatar MartinFIT

Removed tmp file

parent f2efb90e
......@@ -3,6 +3,7 @@ package cz.vutbr.fit.distributedrepository.communication.consumer.handler;
import cz.vutbr.fit.communication.KafkaCriteria;
import cz.vutbr.fit.communication.KafkaRequest;
import cz.vutbr.fit.distributedrepository.service.pcap.dumper.PcapDumper;
import cz.vutbr.fit.distributedrepository.util.FileManager;
import cz.vutbr.fit.persistence.cassandra.entity.CassandraPacket;
import cz.vutbr.fit.persistence.cassandra.repository.PacketRepository;
import cz.vutbr.fit.persistence.mongodb.entity.PacketMetadata;
......@@ -91,6 +92,8 @@ public class LoadPcapHandler extends BaseHandler {
localFile = dstFile = request.getDataSource().getUri();
storePayloadIntoHDFS(localFile, dstFile);
removeTmpFile(localFile);
acknowledge();
}
......@@ -99,6 +102,11 @@ public class LoadPcapHandler extends BaseHandler {
LOGGER.debug("Result PCAP file stored into HDFS.");
}
private void removeTmpFile(String localFile) {
FileManager.RemoveFile(localFile);
LOGGER.debug("Tmp file removed.");
}
private void acknowledge() {
String detailMessage = String.format("Successfully loaded %d packets.", packetsLoaded);
sendAcknowledgement(buildSuccessResponse(request, detailMessage), new byte[]{});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment