@@ -34,6 +34,7 @@ public class Context implements Externalizable, Loggeable, Pausable {
34
34
private Map pmap ; // persistent (serializable) map
35
35
private long timeout ;
36
36
private boolean resumeOnPause = false ;
37
+ private transient boolean trace = false ;
37
38
38
39
public static String LOGEVT = "LOGEVT" ;
39
40
public static String PROFILER = "PROFILER" ;
@@ -42,10 +43,16 @@ public class Context implements Externalizable, Loggeable, Pausable {
42
43
public Context () {
43
44
super ();
44
45
}
46
+
45
47
/**
46
48
* puts an Object in the transient Map
47
49
*/
48
50
public void put (Object key , Object value ) {
51
+ if (trace ) {
52
+ getProfiler ().checkPoint (
53
+ String .format (" %s='%s' [%s]" , key , value , new Throwable ().getStackTrace ()[1 ].toString ())
54
+ );
55
+ }
49
56
getMap ().put (key , value );
50
57
synchronized (this ) {
51
58
notifyAll ();
@@ -55,9 +62,14 @@ public void put (Object key, Object value) {
55
62
* puts an Object in the transient Map
56
63
*/
57
64
public void put (Object key , Object value , boolean persist ) {
58
- getMap ().put (key , value );
65
+ if (trace ) {
66
+ getProfiler ().checkPoint (
67
+ String .format ("P: %s='%s' [%s]" , key , value , new Throwable ().getStackTrace ()[1 ].toString ())
68
+ );
69
+ }
59
70
if (persist && value instanceof Serializable )
60
71
getPMap ().put (key , value );
72
+ getMap ().put (key , value );
61
73
}
62
74
/**
63
75
* Get
@@ -261,6 +273,13 @@ public synchronized void resume() {
261
273
resumeOnPause = true ;
262
274
}
263
275
}
276
+ public boolean isTrace () {
277
+ return trace ;
278
+ }
279
+ public void setTrace (boolean trace ) {
280
+ getProfiler ();
281
+ this .trace = trace ;
282
+ }
264
283
static final long serialVersionUID = 6056487212221438338L ;
265
284
}
266
285
0 commit comments