public final class ReusableMessageFactory extends Object implements MessageFactory2, Serializable
MessageFactory
interface that avoids allocating temporary objects where possible.
Message instances are cached in a ThreadLocal and reused when a new message is requested within the same thread.ParameterizedMessageFactory
,
ReusableSimpleMessage
,
ReusableObjectMessage
,
ReusableParameterizedMessage
,
Serialized FormModifier and Type | Field and Description |
---|---|
static ReusableMessageFactory |
INSTANCE
Instance of ReusableMessageFactory..
|
Constructor and Description |
---|
ReusableMessageFactory()
Constructs a message factory.
|
Modifier and Type | Method and Description |
---|---|
Message |
newMessage(CharSequence charSequence)
Creates a new message for the specified CharSequence.
|
Message |
newMessage(Object message)
Creates
ReusableObjectMessage instances. |
Message |
newMessage(String message)
Creates
ReusableSimpleMessage instances. |
Message |
newMessage(String message,
Object... params)
Creates
ReusableParameterizedMessage instances. |
Message |
newMessage(String message,
Object p0)
Creates a new parameterized message.
|
Message |
newMessage(String message,
Object p0,
Object p1)
Creates a new parameterized message.
|
Message |
newMessage(String message,
Object p0,
Object p1,
Object p2)
Creates a new parameterized message.
|
Message |
newMessage(String message,
Object p0,
Object p1,
Object p2,
Object p3)
Creates a new parameterized message.
|
Message |
newMessage(String message,
Object p0,
Object p1,
Object p2,
Object p3,
Object p4)
Creates a new parameterized message.
|
Message |
newMessage(String message,
Object p0,
Object p1,
Object p2,
Object p3,
Object p4,
Object p5)
Creates a new parameterized message.
|
Message |
newMessage(String message,
Object p0,
Object p1,
Object p2,
Object p3,
Object p4,
Object p5,
Object p6)
Creates a new parameterized message.
|
Message |
newMessage(String message,
Object p0,
Object p1,
Object p2,
Object p3,
Object p4,
Object p5,
Object p6,
Object p7)
Creates a new parameterized message.
|
Message |
newMessage(String message,
Object p0,
Object p1,
Object p2,
Object p3,
Object p4,
Object p5,
Object p6,
Object p7,
Object p8)
Creates a new parameterized message.
|
Message |
newMessage(String message,
Object p0,
Object p1,
Object p2,
Object p3,
Object p4,
Object p5,
Object p6,
Object p7,
Object p8,
Object p9)
Creates a new parameterized message.
|
static void |
release(Message message)
Invokes
Clearable.clear() when possible. |
public static final ReusableMessageFactory INSTANCE
public ReusableMessageFactory()
public static void release(Message message)
Clearable.clear()
when possible.
This flag is used internally to verify that a reusable message is no longer in use and
can be reused.message
- the message to make available againpublic Message newMessage(CharSequence charSequence)
MessageFactory2
newMessage
in interface MessageFactory2
charSequence
- the (potentially mutable) CharSequencepublic Message newMessage(String message, Object... params)
ReusableParameterizedMessage
instances.newMessage
in interface MessageFactory
message
- The message pattern.params
- The message parameters.MessageFactory.newMessage(String, Object...)
public Message newMessage(String message, Object p0)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterParameterizedMessageFactory
public Message newMessage(String message, Object p0, Object p1)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterp1
- a message parameterParameterizedMessageFactory
public Message newMessage(String message, Object p0, Object p1, Object p2)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterp1
- a message parameterp2
- a message parameterParameterizedMessageFactory
public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterp1
- a message parameterp2
- a message parameterp3
- a message parameterParameterizedMessageFactory
public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterp1
- a message parameterp2
- a message parameterp3
- a message parameterp4
- a message parameterParameterizedMessageFactory
public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterp1
- a message parameterp2
- a message parameterp3
- a message parameterp4
- a message parameterp5
- a message parameterParameterizedMessageFactory
public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterp1
- a message parameterp2
- a message parameterp3
- a message parameterp4
- a message parameterp5
- a message parameterp6
- a message parameterParameterizedMessageFactory
public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterp1
- a message parameterp2
- a message parameterp3
- a message parameterp4
- a message parameterp5
- a message parameterp6
- a message parameterp7
- a message parameterParameterizedMessageFactory
public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterp1
- a message parameterp2
- a message parameterp3
- a message parameterp4
- a message parameterp5
- a message parameterp6
- a message parameterp7
- a message parameterp8
- a message parameterParameterizedMessageFactory
public Message newMessage(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9)
MessageFactory2
newMessage
in interface MessageFactory2
message
- a message template, the kind of message template depends on the implementation.p0
- a message parameterp1
- a message parameterp2
- a message parameterp3
- a message parameterp4
- a message parameterp5
- a message parameterp6
- a message parameterp7
- a message parameterp8
- a message parameterp9
- a message parameterParameterizedMessageFactory
public Message newMessage(String message)
ReusableSimpleMessage
instances.newMessage
in interface MessageFactory
message
- The message String.MessageFactory.newMessage(String)
public Message newMessage(Object message)
ReusableObjectMessage
instances.newMessage
in interface MessageFactory
message
- The message Object.MessageFactory.newMessage(Object)
Copyright © 1999-1969 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.