1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.chukwa.validationframework.interceptor;
19
20
21 import java.util.List;
22 import org.apache.hadoop.chukwa.Chunk;
23 import org.apache.hadoop.chukwa.datacollection.ChunkQueue;
24
25 public class ChunkQueueInterceptor implements
26 org.apache.hadoop.chukwa.datacollection.ChunkQueue {
27 private ChunkQueue defaultQueue = null;
28
29 public ChunkQueueInterceptor(ChunkQueue defaultQueue) {
30 this.defaultQueue = defaultQueue;
31 }
32
33 @Override
34 public void add(Chunk chunk) throws InterruptedException {
35 ChunkDumper.dump("adaptor", chunk);
36 defaultQueue.add(chunk);
37 }
38
39 @Override
40 public void collect(List<Chunk> chunks, int count)
41 throws InterruptedException {
42 defaultQueue.collect(chunks, count);
43 for (Chunk chunk : chunks) {
44 ChunkDumper.dump("sender", chunk);
45 }
46 }
47
48 @Override
49 public int size() {
50 return defaultQueue.size();
51 }
52
53 }