|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.qpid.server.logging.actors.CurrentActor
public class CurrentActor
The CurrentActor is a ThreadLocal wrapper that allows threads in the broker to retrieve an actor to perform logging. This approach is used so for two reasons: 1) We do not have to pass a logging actor around the system 2) We can set new actors at the point we have enough information. i.e. - Set a low level ConnectionActor when processing bytes from the wire. - Set a ChannelActor when we are processing the frame - Set a SubscriptionActor when we are handling the subscription.
The code performing the logging need not worry about what type of actor is currently set so can perform its logging. The resulting log entry though will contain customised details from the the currently set Actor. The Actor model also allows the pre-creation of fixed messages so the performance impact of the additional logging data is minimised. This class does not perform any checks to ensure that there is an Actor set when calling remove or get. As a result the application developer must ensure that they have called set before they attempt to use the actor via get or remove the set actor. The checking of the return via get should not be done as the logging is desired. It is preferable to cause the NullPointerException to highlight the programming error rather than miss a log message. The same is true for the remove. A NPE will occur if no set has been called highlighting the programming error.
Constructor Summary | |
---|---|
CurrentActor()
|
Method Summary | |
---|---|
static LogActor |
get()
Return the current head of the list of LogActors. |
static void |
remove()
Remove the current LogActor. |
static void |
set(LogActor actor)
Set a new LogActor to be the Current Actor This pushes the Actor in to the LIFO Queue |
static void |
setDefault(LogActor defaultActor)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CurrentActor()
Method Detail |
---|
public static void set(LogActor actor)
actor
- The new LogActorpublic static void remove()
public static LogActor get()
public static void setDefault(LogActor defaultActor)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |