|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.profile.ProfileCollectorImpl
public final class ProfileCollectorImpl
This is the implementation of ProfileCollector used by the
kernel to collect and report profiling data. It uses a single thread to
consume and report profiling data to ProfileListeners.
The constructor supports the following
properties:
com.sun.sgs.impl.profile.create.mbeanserver
false MBeanServer should be created, rather
than using the existing platform MBeanServer.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.sun.sgs.profile.ProfileCollector |
|---|
ProfileCollector.ProfileLevel |
| Field Summary | |
|---|---|
static String |
CORE_CONSUMER_PREFIX
The standard prefix for consumer names created by core packages. |
static String |
CREATE_MBEAN_SERVER_PROPERTY
The property telling us whether we should use the default platform MBeanServer or create a new one. |
| Constructor Summary | |
|---|---|
ProfileCollectorImpl(ProfileCollector.ProfileLevel level,
Properties appProperties,
ComponentRegistry systemRegistry)
Creates an instance of ProfileCollectorImpl. |
|
| Method Summary | |
|---|---|
void |
addListener(ProfileListener listener,
boolean canRemove)
Adds a ProfileListener as a listener for
profiling data reports. |
void |
addListener(String listenerClassName)
Instantiates and adds a ProfileListener. |
(package private) void |
addParticipant(ProfileParticipantDetail participantDetail)
Tells the collector about a participant of a transaction when that participant has finished participating (i.e., has committed, has prepared read-only, or has aborted). |
(package private) void |
addTransactionListener(TransactionListenerDetail listenerDetail)
Tells the collector about a listener of a transaction when that listener is finished with its work (i.e., after its afterCompletion method has been called). |
(package private) void |
finishTask(int tryCount)
Tells the collector that the current task associated with the calling thread (as associated by a call to startTask) has now successfully finished. |
(package private) void |
finishTask(int tryCount,
Throwable t)
Tells the collector that the current task associated with the calling thread (as associated by a call to startTask) has now finished. |
ProfileConsumer |
getConsumer(String name)
Returns the named ProfileConsumer, or creates a new one with
that name. |
Map<String,ProfileConsumer> |
getConsumers()
Returns a read-only map of ProfileConsumer names to the
ProfileConsumers which have been created through a call to
getConsumer. |
(package private) ProfileReportImpl |
getCurrentProfileReport()
Package private method to get the current profile report, used by the operations, counters, and samples. |
ProfileCollector.ProfileLevel |
getDefaultProfileLevel()
Gets the default system profiling level, which is the default level for any newly created ProfileConsumer. |
List<ProfileListener> |
getListeners()
Returns a read-only list of ProfileListeners which have been
added. |
Object |
getRegisteredMBean(String mBeanName)
Returns the object registered under the given name, or null
if no object has been registered with that name. |
(package private) void |
noteTransactional(byte[] txnId)
Tells the collector that the current task associated with the calling thread (as associated by a call to startTask) is
transactional. |
(package private) void |
notifyListeners(PropertyChangeEvent event)
Package private method to notify listeners of a property change. |
(package private) void |
notifyNodeIdAssigned(long nodeId)
Notifies the collector that the node has been assigned its identifier. |
(package private) void |
notifyThreadAdded()
Notifies the collector that a thread has been added to the scheduler. |
(package private) void |
notifyThreadRemoved()
Notifies the collector that a thread has been removed from the scheduler. |
void |
registerMBean(Object mBean,
String mBeanName)
Registers the given MBean with the current VM's platform MBean server, allowing it to be monitored by tools like JConsole. |
void |
removeListener(ProfileListener listener)
Removes a ProfileListener and calls
ProfileListener.shutdown() on the listener. |
(package private) void |
setAccessedObjectsDetail(AccessedObjectsDetail detail)
Sets the detail for all objects accessed during the task as reported to the AccessCoordinator. |
void |
setDefaultProfileLevel(ProfileCollector.ProfileLevel level)
Sets the default profile level, used as the initial level when creating new ProfileConsumers. |
void |
shutdown()
Shuts down the ProfileCollector, reclaiming resources as necessary. |
(package private) void |
startTask(KernelRunnable task,
Identity owner,
long scheduledStartTime,
int readyCount)
Tells the collector that a new task is starting in the context of the calling thread. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CORE_CONSUMER_PREFIX
public static final String CREATE_MBEAN_SERVER_PROPERTY
| Constructor Detail |
|---|
public ProfileCollectorImpl(ProfileCollector.ProfileLevel level,
Properties appProperties,
ComponentRegistry systemRegistry)
ProfileCollectorImpl.
level - the default system profiling levelappProperties - the application properties, used for instantiating
ProfileListenerssystemRegistry - the system registry, used for instantiating
ProfileListeners| Method Detail |
|---|
public void shutdown()
shutdown in interface ProfileCollectorpublic ProfileCollector.ProfileLevel getDefaultProfileLevel()
ProfileConsumer.
getDefaultProfileLevel in interface ProfileCollectorpublic void setDefaultProfileLevel(ProfileCollector.ProfileLevel level)
ProfileConsumers.
setDefaultProfileLevel in interface ProfileCollectorlevel - the new default profile levelpublic ProfileConsumer getConsumer(String name)
ProfileConsumer, or creates a new one with
that name.
Note that the name must be unique for a new ProfileConsumer to
be created. Consumers created by the core server packages have a prefix
of com.sun.sgs.
to distinguish their namespace. Consumers created by code outside of the
core server packages should create their own unique namespace.
Calling ProfileCollector.getConsumers() will return a map keyed by names already
in use.
getConsumer in interface ProfileCollectorname - the unique name of the profile consumer
ProfileConsumer with the given namepublic Map<String,ProfileConsumer> getConsumers()
ProfileConsumer names to the
ProfileConsumers which have been created through a call to
getConsumer.
getConsumers in interface ProfileCollector
public void addListener(ProfileListener listener,
boolean canRemove)
ProfileListener as a listener for
profiling data reports. The listener is immediately updated on
the current set of operations and the number of scheduler
threads. The listener can be marked as unable to be removed by
removeListener or shutdown by ProfileCollector.shutdown();
if these operations are performed on a listener that does not allow them,
they are silently ignored.
addListener in interface ProfileCollectorlistener - the ProfileListener to addcanRemove - true if this listener can be removed or
shut down by the ProfileCollector. This
parameter should usually be set to true.
public void addListener(String listenerClassName)
throws Exception
ProfileListener. The listener must
implement a constructor of the form (java.util.Properties,
com.sun.sgs.kernel.TaskOwner,
com.sun.sgs.kernel.ComponentRegistry).
The listener is immediately updated on
the current set of operations and the number of scheduler
threads.
addListener in interface ProfileCollectorlistenerClassName - the fully qualified class name of the
listener to instantiate and add.
Exception - if any were generated during instantiationpublic List<ProfileListener> getListeners()
ProfileListeners which have been
added.
getListeners in interface ProfileCollectorpublic void removeListener(ProfileListener listener)
ProfileListener and calls
ProfileListener.shutdown() on the listener. If the
listener has never been added with
addListener, no action is taken.
removeListener in interface ProfileCollectorlistener - the listener to remove
public void registerMBean(Object mBean,
String mBeanName)
throws JMException
registerMBean in interface ProfileCollectormBean - the MBean or MXBean to be registeredmBeanName - the name under which it should be registered
JMException - if there were any problems reported
by the JMX system during registration, including if an object
has already been registered with the mBeanNamepublic Object getRegisteredMBean(String mBeanName)
null
if no object has been registered with that name.
getRegisteredMBean in interface ProfileCollectormBeanName - the name the object was registered under
registerMBean with the given mBeanNamevoid notifyThreadAdded()
void notifyThreadRemoved()
void notifyNodeIdAssigned(long nodeId)
void startTask(KernelRunnable task,
Identity owner,
long scheduledStartTime,
int readyCount)
task - the KernelRunnable that is startingowner - the Identity of the task ownerscheduledStartTime - the requested starting time for the taskreadyCount - the number of ready tasks at the schedulervoid noteTransactional(byte[] txnId)
startTask) is
transactional.
txnId - the identifier for the transactionvoid addParticipant(ProfileParticipantDetail participantDetail)
participantDetail - the detail associated with the participantvoid addTransactionListener(TransactionListenerDetail listenerDetail)
listenerDetail - the detail associated with the listenervoid setAccessedObjectsDetail(AccessedObjectsDetail detail)
AccessCoordinator.
detail - all detail of the accessed objectsvoid finishTask(int tryCount)
startTask) has now successfully finished.
tryCount - the number of times that the task has tried to run
void finishTask(int tryCount,
Throwable t)
startTask) has now finished.
tryCount - the number of times that the task has tried to runt - the Throwable thrown during task executionvoid notifyListeners(PropertyChangeEvent event)
event - the change the listeners will be notified aboutProfileReportImpl getCurrentProfileReport()
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||