01: /*
02: * Created on 30.05.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: class PerfEventPut {
16: private static PerfEventPut instance = new PerfEventPut();
17: private final static Logger LOG = Logger
18: .getLogger(PerfEventPut.class);
19:
20: private BoundedBufferWrapper bBuffer;
21:
22: private PerfEventPut() {
23:
24: }
25:
26: static PerfEventPut getInstance() {
27: return instance;
28: }
29:
30: void setBuffer(BoundedBufferWrapper b) {
31: bBuffer = b;
32: }
33:
34: void logPerf(PerfEvent pe) {
35:
36: try {
37: LOG.info("Putting (" + pe + ") into buffer. Buffersize: "
38: + bBuffer.size());
39: boolean ok = bBuffer.offer(pe);
40: LOG.info("Putting succeeded: " + ok);
41:
42: } catch (InterruptedException e) {
43: LOG.warn(e);
44: }
45: }
46:
47: }
|