01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.object.appevent;
06:
07: /**
08: * Abstract lock event context, builds on AbstractApplicationEventContext
09: */
10: public abstract class AbstractLockEventContext extends
11: AbstractApplicationEventContext {
12:
13: private static final long serialVersionUID = 4788562594133534828L;
14:
15: private final String className;
16: private final String fieldName;
17: private final Exception exception;
18:
19: /**
20: * Construct new lock event context
21: * @param pojo Object of interest
22: * @param threadName Thread name
23: * @param clientID JVM client ID
24: * @param exception Exception that occurred
25: */
26: public AbstractLockEventContext(Object pojo, String threadName,
27: String clientId, Exception exception) {
28: this (pojo, null, null, threadName, clientId, exception);
29: }
30:
31: /**
32: * Construct new lock event context
33: * @param pojo Object of interest
34: * @param className Class that was being updated
35: * @param fieldName Field that was being updated
36: * @param threadName Thread name
37: * @param clientID JVM client ID
38: * @param exception Exception that occurred
39: */
40: public AbstractLockEventContext(Object pojo, String className,
41: String fieldName, String threadName, String clientId,
42: Exception exception) {
43: super (pojo, threadName, clientId);
44:
45: this .className = className;
46: this .fieldName = fieldName;
47: this .exception = exception;
48: }
49:
50: /**
51: * @return Class that was being updated, may be null
52: */
53: public String getClassName() {
54: return className;
55: }
56:
57: /**
58: * @return Field that was being updated, may be null
59: */
60: public String getFieldName() {
61: return fieldName;
62: }
63:
64: /**
65: * @return Exception that occurred
66: */
67: public Exception getException() {
68: return exception;
69: }
70:
71: /**
72: * @return The stack elements from the {@link #getException()}
73: */
74: public StackTraceElement[] getStackElements() {
75: return exception.getStackTrace();
76: }
77: }
|