The JMX name is based on the name of the Log. So if you don't set it via {@link #setName(String)}, you'll end up something that Speed4J picks up on its own. Normally, if you use the property file to configure Speed4J, this gets automatically assigned for you.
The PeriodicalLog starts a new Thread to collect the statistics. Don't forget to shut it down with a call to {@link #shutdown()}, or else you might risk a memory leak. This is a common problem with e.g. web applications, where redeployment regularly causes these.
In a web app, you could set up your own ServletContextListener to ensure the proper shutdown:
class MyListener implements ServletContextListener { public void contextInitialized(ServletContextEvent sce) {} public void contextDestroyed(ServletContextEvent sce) { StopWatchFactory.getInstance("myLoggerName").shutdown(); } }PeriodicalLog adds its own JVM-wide shutdown hook, so you don't need to prepare for that.
The size of the log is limited to make sure that it does not grow out of bounds. You may set the value using {@link #setMaxQueueSize(int)}. The default value is {@value #DEFAULT_MAX_QUEUE_SIZE}.
|
|
|
|
|
|
|
|