|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.util.ObjectFactory<T> mondrian.util.ObjectFactory.Singleton<MemoryMonitor> mondrian.util.MemoryMonitorFactory
public final class MemoryMonitorFactory
The MemoryMonitorFactory
is used to get the application's
MemoryMonitor
. The MemoryMonitorFactory
is
based upon the ObjectFactory.Singleton
generic. The
MemoryMonitorFactory
implementation has a single, default
MemoryMonitor
per JVM instance which can be overridden
using the provided ThreadLocal
variable. Normally, this
ThreadLocal
override should only be used during JUnit testing.
The JUnit test, set the ThreadLocal
variable to the name of its
own implementation of the MemoryMonitor
interface and
then calls the ObjectFactory
getObject
method.
After doing the test, the ThreadLocal
variable should
be cleared.
The ObjectFactory.Singleton
permits the use
of System
properties to provide a class name to the
factory. This can be used to create a MemoryMonitor
that is not the default one. The property name is the
MemoryMonitor
class name, "mondrian.util.MemoryMonitor".
Nested Class Summary |
---|
Nested classes/interfaces inherited from class mondrian.util.ObjectFactory |
---|
ObjectFactory.Context, ObjectFactory.Singleton<T> |
Field Summary |
---|
Fields inherited from class mondrian.util.ObjectFactory.Singleton |
---|
singleInstance, testSingleInstance |
Method Summary | |
---|---|
static void |
clearThreadLocalClassName()
Clears the class name (regardless of whether a class name was set). |
protected boolean |
enabled()
Returns whether the use of a MemoryMonitor is enabled. |
protected String |
getClassName()
Get the class name set in the ThreadLocal or null. |
protected MemoryMonitor |
getDefault(Class[] parameterTypes,
Object[] parameterValues)
The MemoryMonitorFactory 's implementation of the
ObjectFactory 's abstract method which returns
the default MemoryMonitor instance. |
static MemoryMonitor |
getMemoryMonitor()
Access the MemoryMonitorFactory instance. |
protected StringProperty |
getStringProperty()
Return the MemoryMonitorFactory
|
static void |
setThreadLocalClassName(String className)
Sets the class name of a MemoryMonitor implementation. |
Methods inherited from class mondrian.util.ObjectFactory.Singleton |
---|
getObject, getTestObject |
Methods inherited from class mondrian.util.ObjectFactory |
---|
defaultCreationException, getClassName, getObject, getObject, getObject, getObject, removeContext, restoreContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static MemoryMonitor getMemoryMonitor()
MemoryMonitorFactory
instance.
MemoryMonitor
.public static void setThreadLocalClassName(String className)
MemoryMonitor
implementation.
This should be called (obviously) before calling the
MemoryMonitorFactory
getMemoryMonitor
method to get the MemoryMonitor
implementation.
Generally, this is only used for testing.
className
- Class namepublic static void clearThreadLocalClassName()
setThreadLocalClassName
,
the setting whould be done in a try-block and a call to this
clear method should be in the finally-clause of that try-block.
protected boolean enabled()
MemoryMonitor
is enabled.
true
if enabled and false
otherwise.protected String getClassName()
ThreadLocal
or null.
getClassName
in class ObjectFactory<MemoryMonitor>
protected StringProperty getStringProperty()
MemoryMonitorFactory
getStringProperty
in class ObjectFactory<MemoryMonitor>
MemoryMonitorFactory
property nameprotected MemoryMonitor getDefault(Class[] parameterTypes, Object[] parameterValues) throws CreationException
MemoryMonitorFactory
's implementation of the
ObjectFactory
's abstract method which returns
the default MemoryMonitor
instance.
For Java4 or if the MemoryMonitorFactory
is not enabled
then this method returns the "faux" MemoryMonitor
implementation, it does nothing. When enabled and for
Java5 and above JVMs, and instance of the
NotificationMemoryMonitor
is returned.
getDefault
in class ObjectFactory<MemoryMonitor>
CreationException
- if the MemoryMonitor
can not be
created.parameterTypes
- not usedparameterValues
- not used
MemoryMonitor
instance
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |