You are creating your file writer with append set to true. It's it possible
your topology was run more than once?
On May 6, 2014 6:39 AM, "Bilal Al Fartakh" <[email protected]> wrote:
> I'm using a bolt that receives tuples from another bolt (exclamation bolt
> ) and writes it on a file , the problem I got is that I have duplicated
> results four times , like when I emit a word , I found the word Written four
> times . where's the problem possibly could be ?
>
>
>
>
> public class PrinterBolty extends BaseBasicBolt {
>
> @Override
> public void execute(Tuple tuple, BasicOutputCollector collector) {
>
> try {
>
> BufferedWriter output;
> output = new BufferedWriter(new
> FileWriter("/root/src/storm-starter/hh.txt", true));
> output.newLine();
> output.append(tuple.getString(0));
> output.close();
>
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
> @Override
> public void declareOutputFields(OutputFieldsDeclarer ofd) {
> }
>
> }
>
>
> --
> *Al Fartakh Bilal*
>