KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > profile > Profilable


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.profile;
9
10 /**
11  * The Profilable interface is to mark objects that can be sampled by a Profiler.
12  * The interface provides a method to initialize the profiler, plus two methods
13  * to provide an optimization cue for the object (when it is safe not to track
14  * events).
15  *
16  * @author <a HREF="mailto:bloritsch@apache.org">Berin Loritsch</a>
17  */

18 public interface Profilable
19 {
20     /**
21      * Empty Profilable array for use in hierarchical Profilable systems.
22      */

23     Profilable[] EMPTY_PROFILABLE_ARRAY = new Profilable[] {};
24
25     /**
26      * Obtain a reference to all the ProfilePoints that the Profilable
27      * object wishes to expose. All sampling is done directly through
28      * the ProfilePoints as opposed to the Profilable interface.
29      */

30     ProfilePoint[] getProfilePoints();
31
32     /**
33      * The Profiler will call this method when it begins taking samples.
34      * This is an optimization cue to the Profilable class. It does take
35      * resources to hold ProfilePoints and update them. A class may keep
36      * a <code>boolean</code> to flag whether the ProfilePoints are to be
37      * maintained.
38      */

39     void startProfiling();
40
41     /**
42      * The Profiler will call this method when it no longer is interested
43      * in taking samples. It is an optimization cue to the Profilable
44      * class so that it can release resources and stop maintaining the
45      * ProfilePoints.
46      */

47     void stopProfiling();
48
49     /**
50      * The Profiler will recursively call this method until it receives an
51      * EMPTY_PROFILABLE_ARRAY. This method should never return null.
52      */

53     Profilable[] getChildProfilables();
54 }
55
56
Popular Tags