MessageDrivenBeanMonitorTaskpublic class MessageDrivenBeanMonitorTask extends BeanMonitorTask
Fields Summary |
---|
private final String | displayFormat |
Constructors Summary |
---|
public MessageDrivenBeanMonitorTask(ServerRootMonitor srm, String filter, Timer timer, boolean verbose, File fileName)
super(srm, filter, timer, verbose, fileName);
if (this.filter == null)
getDefaultFilter();
else
{
final StringTokenizer st = new StringTokenizer(this.filter, ":");
if (st.countTokens() < 2 )
throw new MonitorTaskException(localStrings.getString("commands.monitor.message_driven_bean_invalid_filter"));
else if (st.countTokens() == 2)
{
ejbName = st.nextToken();
beanName = st.nextToken();
}
else {
appName = st.nextToken();
ejbName = st.nextToken();
beanName = st.nextToken();
}
verifyFilterValue();
}
final String messageDrivenBeanTitle = localStrings.getString("commands.monitor.message_driven_bean_title", new Object[] {this.filter});
final String title = String.format("%1$50s", messageDrivenBeanTitle);
CLILogger.getInstance().printMessage(title);
displayHeader();
|
Methods Summary |
---|
boolean | checkIfBeanExists(java.util.Map ejbModuleMap)returns true if entitybean exists in ejbmodule
if (!ejbModuleMap.containsKey(ejbName))
{
if (appName == null)
throw new MonitorTaskException(localStrings.getString("commands.monitor.does_not_exist", new Object[] {ejbName}));
else
throw new MonitorTaskException(localStrings.getString("commands.monitor.does_not_exist_in1", new Object[] {ejbName, appName}));
}
else {
final EJBModuleMonitor ejbModuleMonitor = ejbModuleMap.get(ejbName);
final Map<String,MessageDrivenBeanMonitor> messageBeanMap = ejbModuleMonitor.getMessageDrivenBeanMonitorMap();
if (!messageBeanMap.containsKey(beanName))
return false;
else
return true;
}
| private void | displayData(MessageDrivenBeanStats stat)
final String data = String.format(displayFormat,
stat.getMessageCount().getCount(),
stat.getCreateCount().getCount(),
stat.getRemoveCount().getCount());
CLILogger.getInstance().printMessage(data);
if (fileName != null)
{
final String fileData = String.format("%1$s,%2$s,%3$s",
stat.getMessageCount().getCount(),
stat.getCreateCount().getCount(),
stat.getRemoveCount().getCount());
writeToFile(fileData);
}
| public void | displayDetails()
final String details = localStrings.getString("commands.monitor.message_driven_detail");
CLILogger.getInstance().printMessage(details);
| private void | displayHeader()
final String message = localStrings.getString("commands.monitor.message");
final String create = localStrings.getString("commands.monitor.create");
final String remove = localStrings.getString("commands.monitor.remove");
final String header = String.format(displayFormat, message,create,remove);
CLILogger.getInstance().printMessage(header);
if (fileName != null)
{
writeToFile(localStrings.getString("commands.monitor.message_driven_write_to_file"));
}
| java.util.List | getBeansInEjbModule(java.lang.String appName, java.util.Map ejbModuleMap)
List<String> possibleMessageDrivenBeans = new Vector<String>();
final String[] ejbModules = MapUtil.getKeyStrings(ejbModuleMap);
if (ejbModuleMap != null && ejbModuleMap.size() > 0)
{
for (String ejbModule : ejbModules)
{
final EJBModuleMonitor ejbModuleMonitor = ejbModuleMap.get(ejbModule);
final Map<String,MessageDrivenBeanMonitor> messageBeanMap = ejbModuleMonitor.getMessageDrivenBeanMonitorMap();
final String[] messageDrivenBeans = MapUtil.getKeyStrings(messageBeanMap);
for (String messageDrivenBean : messageDrivenBeans)
{
if (appName == null)
possibleMessageDrivenBeans.add(ejbModule+":"+messageDrivenBean);
else
possibleMessageDrivenBeans.add(appName+":"+ejbModule+":"+messageDrivenBean);
}
}
}
return possibleMessageDrivenBeans;
| private MessageDrivenBeanMonitor | getMessageDrivenBeanMonitor(java.util.Map ejbMap)
final EJBModuleMonitor ejbModuleMonitor = ejbMap.get(ejbName);
final Map<String,MessageDrivenBeanMonitor> mdbMap = ejbModuleMonitor.getMessageDrivenBeanMonitorMap();
return mdbMap.get(beanName);
| public void | run()
if (srm == null) {
super.cancelMonitorTask();
return;
}
Map<String,EJBModuleMonitor> ejbMap = null;
if (appName == null)
{
ejbMap = srm.getEJBModuleMonitorMap();
}
else
{
final Map<String,ApplicationMonitor> appMap = srm.getApplicationMonitorMap();
if (appMap == null || appMap.size()<1) {
cancelMonitorTask();
return;
}
final ApplicationMonitor am = appMap.get(appName);
ejbMap = am.getEJBModuleMonitorMap();
}
if (ejbMap == null || ejbMap.size()<1) {
cancelMonitorTask();
return;
}
final MessageDrivenBeanMonitor monitor = getMessageDrivenBeanMonitor(ejbMap);
if (monitor == null) {
cancelMonitorTask();
return;
}
final MessageDrivenBeanStats stat = monitor.getMessageDrivenBeanStats();
if (verbose && counter == NUM_ROWS)
{
displayHeader();
counter = 0; //reset to 0
}
displayData(stat);
if (verbose) counter++;
|
|