|
1 | 1 | /**
|
2 | 2 | * Logback: the reliable, generic, fast and flexible logging framework.
|
3 |
| - * Copyright (C) 1999-2015, QOS.ch. All rights reserved. |
| 3 | + * Copyright (C) 1999-2024, QOS.ch. All rights reserved. |
4 | 4 | *
|
5 | 5 | * This program and the accompanying materials are dual-licensed under
|
6 | 6 | * either the terms of the Eclipse Public License v1.0 as published by
|
|
16 | 16 | import java.util.List;
|
17 | 17 |
|
18 | 18 | /**
|
19 |
| - * Internal error messages (statii) are managed by instances of this interface. |
20 |
| - * |
| 19 | + * A component which accepts status events and notifies registered listeners. |
| 20 | + * Maintains event statistics, an event buffer, and a listener registry. |
| 21 | + * |
21 | 22 | * @author Ceki Gülcü
|
| 23 | + * @author Mark Chesney |
22 | 24 | */
|
23 | 25 | public interface StatusManager {
|
24 | 26 |
|
25 | 27 | /**
|
26 |
| - * Add a new status message. |
27 |
| - * |
28 |
| - * @param status |
| 28 | + * Notifies registered listeners of the specified status event and adds it to |
| 29 | + * the end of the event buffer. |
| 30 | + * |
| 31 | + * @param status a status event |
29 | 32 | */
|
30 | 33 | void add(Status status);
|
31 | 34 |
|
32 | 35 | /**
|
33 |
| - * Obtain a copy of the status list maintained by this StatusManager. |
34 |
| - * |
35 |
| - * @return |
| 36 | + * Returns a point-in-time snapshot of the event buffer. |
| 37 | + * |
| 38 | + * @return a snapshot of the event buffer |
36 | 39 | */
|
37 | 40 | List<Status> getCopyOfStatusList();
|
38 | 41 |
|
39 | 42 | /**
|
40 |
| - * Return the highest level of all the statii. |
41 |
| - * |
42 |
| - * @return |
43 |
| - */ |
44 |
| - // int getLevel(); |
45 |
| - |
46 |
| - /** |
47 |
| - * Return the number of status entries. |
48 |
| - * |
49 |
| - * @return |
| 43 | + * Returns the number of events processed since instantiation or the last reset. |
| 44 | + * |
| 45 | + * @return the number of events processed |
50 | 46 | */
|
51 | 47 | int getCount();
|
52 | 48 |
|
53 | 49 | /**
|
54 |
| - * Add a status listener. |
55 |
| - * |
56 |
| - * @param listener |
57 |
| - */ |
58 |
| - |
59 |
| - /** |
60 |
| - * Add a status listener. The StatusManager may decide to skip installation if |
61 |
| - * an earlier instance was already installed. |
62 |
| - * |
63 |
| - * @param listener |
64 |
| - * @return true if actually added, false if skipped |
| 50 | + * Registers the specified listener. |
| 51 | + * <p> |
| 52 | + * Returns {@code true} if the registered listeners changed, and {@code false} |
| 53 | + * if the specified listener is already registered, and the implementation does |
| 54 | + * not permit duplicates. |
| 55 | + * |
| 56 | + * @param listener the listener to register |
| 57 | + * @return {@code true} if the registered listeners changed, {@code false} |
| 58 | + * otherwise |
65 | 59 | */
|
66 | 60 | boolean add(StatusListener listener);
|
67 | 61 |
|
68 | 62 | /**
|
69 |
| - * ); Remove a status listener. |
70 |
| - * |
71 |
| - * @param listener |
| 63 | + * Deregisters the specified listener, if registered. |
| 64 | + * <p> |
| 65 | + * If the implementation permits duplicates, only the first occurrence is |
| 66 | + * deregistered. |
| 67 | + * |
| 68 | + * @param listener the listener to deregister |
72 | 69 | */
|
73 | 70 | void remove(StatusListener listener);
|
74 | 71 |
|
75 | 72 | /**
|
76 |
| - * Clear the list of status messages. |
| 73 | + * Resets event statistics and empties the event buffer. |
77 | 74 | */
|
78 | 75 | void clear();
|
79 | 76 |
|
80 | 77 | /**
|
81 |
| - * Obtain a copy of the status listener list maintained by this StatusManager |
82 |
| - * |
83 |
| - * @return |
| 78 | + * Returns a point-in-time snapshot of the registered listeners. |
| 79 | + * |
| 80 | + * @return a snapshot of the registered listeners |
84 | 81 | */
|
85 | 82 | List<StatusListener> getCopyOfStatusListenerList();
|
86 | 83 |
|
|
0 commit comments