01: /*
02: * Created on 08.06.2005
03: *
04: * TODO To change the template for this generated file go to
05: * Window - Preferences - Java - Code Style - Code Templates
06: */
07: package de.schlund.pfixxml.perflogging;
08:
09: import org.apache.log4j.Logger;
10:
11: /**
12: * @author jh
13: *
14: */
15: public class PerfEventTakeThread extends Thread {
16: private final static Logger LOG = Logger
17: .getLogger(PerfEventTakeThread.class);
18: private BoundedBufferWrapper bBuffer;
19:
20: public PerfEventTakeThread(BoundedBufferWrapper b) {
21: bBuffer = b;
22: }
23:
24: /* (non-Javadoc)
25: * @see java.lang.Runnable#run()
26: */
27: public void run() {
28: int bufsize = 0;
29: while (true) {
30: bufsize = bBuffer.size();
31: try {
32: PerfEvent pe = (PerfEvent) bBuffer.take();
33: LOG.info("Took (" + pe + ") from channel. Buffersize: "
34: + bufsize);
35: //testing: Thread.currentThread().sleep(20);
36: PerfStatistic.getInstance().process(pe);
37: } catch (InterruptedException e) {
38: LOG
39: .warn("InterruptedException. Perflogging may be disabled. Buffersize: "
40: + bufsize);
41: return;
42: }
43: }
44:
45: }
46:
47: }
|