KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > services > perflog > TrackingInfo


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.services.perflog;
19
20 /**
21  * <p>Used to encapsulate an arbitrary Object with a timestamp. The PerfLogger
22  * maintains a stack of TrackingInfo objects in order to keep track of
23  * arbitrarily nested calls.</p>
24  *
25  * Copyright 2000-2003 Sapient
26  * @author Tim Fennell, December 2000
27  * @version $Revision: 1.5 $ ($Author: dvoet $)
28  */

29 class TrackingInfo {
30     /** <p>Used to store the time the object was created, which is deemed to be
31      * the start time.</p> */

32     protected long startTime = 0;
33
34     /** <p>Used to keep a reference to the object being tracked.</p> */
35     protected Object JavaDoc trackedObject = null;
36
37     /**
38      * <p>Creates a new TrackingInfo object used to keep track of the object
39      * passed in. The startTime attribute is set to the
40      * System.currentTimeMillis() at the time the constructor is invoked.</p>
41      *
42      * @param trackedObject the object being tracked.
43      */

44     TrackingInfo(Object JavaDoc trackedObject) {
45         this.trackedObject = trackedObject;
46         this.startTime = System.currentTimeMillis();
47     }
48
49     /**
50      * <p>Getter for the time the tracking of the object started.</p>
51      *
52      * @return <code>long</code> start time of the track in milliseconds.
53      */

54     long getStartTime() {
55         return this.startTime;
56     }
57
58     /**
59      * <p>Getter for the tracked object.</p>
60      *
61      * @return <code>Object</code> the tracked object.
62      */

63     Object JavaDoc getTrackedObject() {
64         return this.trackedObject;
65     }
66 }
Popular Tags