View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  package ch.elca.el4j.services.statistics.detailed.contextpassing;
18  
19  import ch.elca.el4j.services.statistics.detailed.MeasureId;
20  
21  /**
22   *
23   *  This class contains all fields, which are part of the passed
24   *   context for the detailed statistics. One instance exists per
25   *   thread.
26   *
27   * @svnLink $Revision: 4010 $;$Date: 2009-12-01 10:59:54 +0100 (Di, 01. Dez 2009) $;$Author: jonasha $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/detailed_statistics/common/src/main/java/ch/elca/el4j/services/statistics/detailed/contextpassing/DetailedStatisticsContext.java $
28   *
29   * @author Rashid Waraich (RWA)
30   * @author Philipp Oser (POS)
31   */
32  public class DetailedStatisticsContext implements java.io.Serializable {
33  
34  	/** Std serial version ID. */
35  	private static final long serialVersionUID = 5979980636453006516L;
36  
37  	/**
38  	 * The measuredId.
39  	 */
40  	private MeasureId m_measureId = null;
41  	
42  	/**
43  	 * The depth of the call stack. Starts at 0.
44  	 * It's incremented when a call arrives inbound, it's decremented
45  	 * when the variable arrives outbound.
46  	 */
47  	private int m_depth = 0;
48  	
49  	/**
50  	 * The Sequence number.
51  	 */
52  	private int m_sequenceNumber = 0;
53  	
54  	/**
55  	 * The hierarchy of the method call.
56  	 *
57  	 * This variables are used if a service is called more than once in the
58  	 * same transaction. In such a case, the hierarchy is built more wide.
59  	 * (e.g. [1-1] to [1-2])
60  	 * further calls make the hierarchy more deep (e.g. [1-1] to [1-1-1])
61  	 */
62  	private int[] m_hierarchy = new int[]{0};
63  	
64  	/**
65  	 * The startTime of the (sub) measurement.
66  	 */
67  	private long m_startTime = 0;
68  
69  	/**
70  	 * @return Returns the hierarchy.
71  	 */
72  	public int[] getHierarchy() {
73  		return m_hierarchy.clone();
74  	}
75  	
76  	/**
77  	 * @param hierarchy Is the hierarchy to set.
78  	 */
79  	public void setHierarchy(int[] hierarchy) {
80  		m_hierarchy = hierarchy.clone();
81  	}
82  	
83  	/**
84  	 * @return Returns the measureId.
85  	 */
86  	public MeasureId getMeasureId() {
87  		return m_measureId;
88  	}
89  	
90  	/**
91  	 * @param measureId Is the measureId to set.
92  	 */
93  	public void setMeasureId(MeasureId measureId) {
94  		m_measureId = measureId;
95  	}
96  	
97  	/**
98  	 * @return Returns the sequence.
99  	 */
100 	public int getSequenceNumber() {
101 		return m_sequenceNumber;
102 	}
103 		
104 	/**
105 	 * @param sequence Is the sequence to set.
106 	 */
107 	public void setSequenceNumber(int sequence) {
108 		m_sequenceNumber = sequence;
109 	}
110 	
111 	/**
112 	 * @return Returns the startTime.
113 	 */
114 	public long getStartTime() {
115 		return m_startTime;
116 	}
117 	
118 	/**
119 	 * @param startTime Is the startTime to set.
120 	 */
121 	public void setStartTime(long startTime) {
122 		m_startTime = startTime;
123 	}
124 
125 	/**
126 	 * @return The depth of the call stack.
127 	 */
128 	public int getDepth() {
129 		return m_depth;
130 	}
131 
132 	/**
133 	 * @param depth Set the depth of the call stack.
134 	 */
135 	public void setDepth(int depth) {
136 		this.m_depth = depth;
137 	}
138 }