| Method from org.jboss.mq.server.jmx.DestinationManager Detail: |
protected void createDestination(String type,
ObjectName name,
String jndiLocation) throws Exception {
log.debug("Attempting to create destination: " + name + "; type=" + type);
server.createMBean(type, name);
server.setAttribute(name, new Attribute("DestinationManager", mqService));
if (jndiLocation != null)
server.setAttribute(name, new Attribute("JNDIName", jndiLocation));
// This destination should be stopped when we are stopped
ArrayList depends = new ArrayList();
depends.add(serviceName);
serviceController.create(name, depends);
serviceController.start(name);
}
|
public void createQueue(String name) throws Exception {
createDestination("org.jboss.mq.server.jmx.Queue", getQueueObjectName(name), null);
}
|
public void createQueue(String name,
String jndiLocation) throws Exception {
createDestination("org.jboss.mq.server.jmx.Queue", getQueueObjectName(name), jndiLocation);
}
|
protected void createService() throws Exception {
super.createService();
jmsServer = new JMSDestinationManager(tempParameters);
jmsServer.setLazyRedeliveryUpdate(lazyRedeliveryUpdate);
}
|
public void createTopic(String name) throws Exception {
createDestination("org.jboss.mq.server.jmx.Topic", getTopicObjectName(name), null);
}
|
public void createTopic(String name,
String jndiLocation) throws Exception {
createDestination("org.jboss.mq.server.jmx.Topic", getTopicObjectName(name), jndiLocation);
}
|
protected void destroyDestination(ObjectName name) throws Exception {
if (log.isDebugEnabled())
{
log.debug("Attempting to destroy destination: " + name);
}
serviceController.stop(name);
server.invoke(name, "removeAllMessages", new Object[] {
}, new String[] {
});
serviceController.destroy(name);
serviceController.remove(name);
}
|
public void destroyQueue(String name) throws Exception {
destroyDestination(getQueueObjectName(name));
}
|
protected void destroyService() throws Exception {
super.destroyService();
jmsServer = null;
}
|
public void destroyTopic(String name) throws Exception {
destroyDestination(getTopicObjectName(name));
}
|
public int getClientCount() {
if (jmsServer == null)
return 0;
return jmsServer.getClientCount();
}
|
public Map getClients() {
if (jmsServer == null)
return null;
return jmsServer.getClients();
}
|
public ObjectName getExpiryDestination() {
return expiryDestination;
}
|
public JMSServerInterceptor getInterceptor() {
return jmsServer;
}
|
public ObjectName getMessageCache() {
return messageCache;
}
Get the value of MessageCache. |
public MessageCounter[] getMessageCounter() throws Exception {
if (jmsServer == null)
return null;
return jmsServer.getMessageCounter();
}
get message counter of all configured destinations |
public int getMessageCounterHistoryDayLimit() {
return tempParameters.messageCounterHistoryDayLimit;
}
Gets the destination message counter history day limit |
public MessageStatistics[] getMessageStatistics() throws Exception {
if (jmsServer == null)
return null;
return MessageCounter.getMessageStatistics(jmsServer.getMessageCounter());
}
|
protected ObjectName getObjectName(MBeanServer server,
ObjectName name) throws MalformedObjectNameException {
// Save our object name to create destination names based on it
mqService = name;
return mqService;
}
|
public ObjectName getPersistenceManager() {
return persistenceManager;
}
Get the value of PersistenceManager. |
protected ObjectName getQueueObjectName(String name) throws MalformedObjectNameException {
return new ObjectName(mqService.getDomain() + ".destination:service=Queue,name=" + name);
}
|
public Class getReceiversImpl() {
return tempParameters.receiversImpl;
}
Get the receivers implemenetation |
public int getRecoveryRetries() {
return tempParameters.recoveryRetries;
}
|
protected ServiceControllerMBean getServiceController() {
return serviceController;
}
|
public ObjectName getStateManager() {
return stateManager;
}
Get the value of StateManager. |
public boolean getTemporaryInMemory() {
return tempParameters.inMemory;
}
Retrieve the temporary topic/queue in memory mode |
public int getTemporaryMaxDepth() {
return tempParameters.maxDepth;
}
Retrieve the temporary topic/queue max depth |
public ObjectName getThreadPool() {
return this.threadPool;
}
|
protected ObjectName getTopicObjectName(String name) throws MalformedObjectNameException {
return new ObjectName(mqService.getDomain() + ".destination:service=Topic,name=" + name);
}
|
public boolean isLazyRedeliveryUpdate() {
return lazyRedeliveryUpdate;
}
Get the lazyRedeliveryUpdate. |
public String listMessageCounter() throws Exception {
if (jmsServer == null)
return null;
MessageCounter[] counter = jmsServer.getMessageCounter();
String ret =
"< table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\" >"
+ "< tr >"
+ "< th >Type< /th >"
+ "< th >Name< /th >"
+ "< th >Subscription< /th >"
+ "< th >Durable< /th >"
+ "< th >Count< /th >"
+ "< th >CountDelta< /th >"
+ "< th >Depth< /th >"
+ "< th >DepthDelta< /th >"
+ "< th >Last Add< /th >"
+ "< /tr >";
String strNameLast = null;
String strTypeLast = null;
String strDestLast = null;
String destData = "";
int destCount = 0;
int countTotal = 0;
int countDeltaTotal = 0;
int depthTotal = 0;
int depthDeltaTotal = 0;
int i = 0; // define outside of for statement, so variable
// still exists after for loop, because it is
// needed during output of last module data string
for (i = 0; i < counter.length; i++)
{
// get counter data
StringTokenizer tokens = new StringTokenizer(counter[i].getCounterAsString(), ",");
String strType = tokens.nextToken();
String strName = tokens.nextToken();
String strSub = tokens.nextToken();
String strDurable = tokens.nextToken();
String strDest = strType + "-" + strName;
String strCount = tokens.nextToken();
String strCountDelta = tokens.nextToken();
String strDepth = tokens.nextToken();
String strDepthDelta = tokens.nextToken();
String strDate = tokens.nextToken();
// update total count / depth values
countTotal += Integer.parseInt(strCount);
depthTotal += Integer.parseInt(strDepth);
countDeltaTotal += Integer.parseInt(strCountDelta);
depthDeltaTotal += Integer.parseInt(strDepthDelta);
if (strCountDelta.equalsIgnoreCase("0"))
strCountDelta = "-"; // looks better
if (strDepthDelta.equalsIgnoreCase("0"))
strDepthDelta = "-"; // looks better
// output destination counter data as HTML table row
// ( for topics with multiple subscriptions output
// type + name field as rowspans, looks better )
if (strDestLast != null && strDestLast.equals(strDest))
{
// still same destination - > append destination subscription data
destData += "< tr bgcolor=\"#" + ((i % 2) == 0 ? "FFFFFF" : "F0F0F0") + "\" >";
destCount += 1;
}
else
{
// start new destination data
if (strDestLast != null)
{
// store last destination data string
ret += "< tr bgcolor=\"#"
+ ((i % 2) == 0 ? "FFFFFF" : "F0F0F0")
+ "\" >< td rowspan=\""
+ destCount
+ "\" >"
+ strTypeLast
+ "< /td >< td rowspan=\""
+ destCount
+ "\" >"
+ strNameLast
+ "< /td >"
+ destData;
destData = "";
}
destCount = 1;
}
// counter data row
destData += "< td >"
+ strSub
+ "< /td >"
+ "< td >"
+ strDurable
+ "< /td >"
+ "< td >"
+ strCount
+ "< /td >"
+ "< td >"
+ strCountDelta
+ "< /td >"
+ "< td >"
+ strDepth
+ "< /td >"
+ "< td >"
+ strDepthDelta
+ "< /td >"
+ "< td >"
+ strDate
+ "< /td >";
// store current destination data for change detection
strTypeLast = strType;
strNameLast = strName;
strDestLast = strDest;
}
if (strDestLast != null)
{
// store last module data string
ret += "< tr bgcolor=\"#"
+ ((i % 2) == 0 ? "FFFFFF" : "F0F0F0")
+ "\" >< td rowspan=\""
+ destCount
+ "\" >"
+ strTypeLast
+ "< /td >< td rowspan=\""
+ destCount
+ "\" >"
+ strNameLast
+ "< /td >"
+ destData;
}
// append summation info
ret += "< tr >"
+ "< td >< ![CDATA[ ]] >< /td >< td >< ![CDATA[ ]] >< /td >"
+ "< td >< ![CDATA[ ]] >< /td >< td >< ![CDATA[ ]] >< /td >< td >"
+ countTotal
+ "< /td >< td >"
+ (countDeltaTotal == 0 ? "-" : Integer.toString(countDeltaTotal))
+ "< /td >< td >"
+ depthTotal
+ "< /td >< td >"
+ (depthDeltaTotal == 0 ? "-" : Integer.toString(depthDeltaTotal))
+ "< /td >< td >Total< /td >< /tr >< /table >";
return ret;
}
List message counter of all configured destinations as HTML table |
public void resetMessageCounter() {
if (jmsServer == null)
return;
jmsServer.resetMessageCounter();
}
Reset message counter of all configured destinations |
public Map retrievePreparedTransactions() {
if (jmsServer == null)
return null;
Map map = jmsServer.getPersistenceManager().getTxManager().getPreparedTransactions();
HashMap result = new HashMap();
for (Iterator i = map.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry) i.next();
Xid xid = (Xid) entry.getKey();
TxManager.PreparedInfo info = (TxManager.PreparedInfo) entry.getValue();
if (xid != null && info != null)
result.put(xid, Boolean.valueOf(info.isInDoubt()));
}
return result;
}
|
public void setExpiryDestination(ObjectName expiryDestination) {
this.expiryDestination = expiryDestination;
}
|
public void setLazyRedeliveryUpdate(boolean lazyRedeliveryUpdate) {
this.lazyRedeliveryUpdate = lazyRedeliveryUpdate;
}
Set the lazyRedeliveryUpdate. |
public void setMessageCache(ObjectName objectName) {
this.messageCache = objectName;
}
Set the value of MessageCache. |
public void setMessageCounterHistoryDayLimit(int days) {
if( days < -1 )
days = -1;
tempParameters.messageCounterHistoryDayLimit = days;
}
Sets the destination message counter history day limit
<0: unlimited, =0: disabled, > 0 maximum day count |
public void setPersistenceManager(ObjectName objectName) {
this.persistenceManager = objectName;
}
Set the value of PersistenceManager. |
public void setReceiversImpl(Class clazz) {
if (clazz != null && Receivers.class.isAssignableFrom(clazz) == false)
throw new IllegalArgumentException("Class " + clazz.getName() + " is not a Receivers implementation");
tempParameters.receiversImpl = clazz;
}
Set the receivers implementation class |
public void setRecoveryRetries(int retries) {
tempParameters.recoveryRetries = retries;
}
|
public void setStateManager(ObjectName objectName) {
this.stateManager = objectName;
}
Set the value of StateManager. |
public void setTemporaryInMemory(boolean mode) {
tempParameters.inMemory = mode;
}
Set the temporary topic/queue in memory mode |
public void setTemporaryMaxDepth(int depth) {
tempParameters.maxDepth = depth;
}
Set the temporary topic/queue max depth |
public void setThreadPool(ObjectName threadPool) {
this.threadPool = threadPool;
}
|
public String showPreparedTransactions() {
if (jmsServer == null)
return null;
Map map = jmsServer.getPersistenceManager().getTxManager().getPreparedTransactions();
JBossStringBuilder buffer = new JBossStringBuilder();
buffer.append("< table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\" >");
buffer.append("< tr >< th >Xid< /th >< th >In Doubt< /th >< th >Local TXIDs< /th >< /tr >");
for (Iterator i = map.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry) i.next();
Xid xid = (Xid) entry.getKey();
TxManager.PreparedInfo info = (TxManager.PreparedInfo) entry.getValue();
if (xid != null && info != null)
{
buffer.append("< tr >< td >");
buffer.append(xid);
buffer.append("< /td >< td >");
buffer.append(info.isInDoubt());
buffer.append("< /td >< td >");
buffer.append(info.getTxids());
buffer.append("< /td >< /tr >");
}
}
buffer.append("< /table >");
return buffer.toString();
}
|
protected void startService() throws Exception {
// Get a proxy to the service controller
serviceController =
(ServiceControllerMBean) MBeanProxyExt.create(
ServiceControllerMBean.class,
ServiceControllerMBean.OBJECT_NAME,
server);
PersistenceManager pm = (PersistenceManager) server.getAttribute(persistenceManager, "Instance");
jmsServer.setPersistenceManager(pm);
StateManager sm = (StateManager) server.getAttribute(stateManager, "Instance");
jmsServer.setStateManager(sm);
// We were either told the message cache or we get it from the
// persistence manager
MessageCache mc;
if (messageCache != null)
mc = (MessageCache) server.getAttribute(messageCache, "Instance");
else
mc = pm.getMessageCacheInstance();
jmsServer.setMessageCache(mc);
ThreadPool tp;
ThreadGroup tg;
if (threadPool == null)
{
tg = new ThreadGroup("JBossMQ Server Threads");
tp = new BasicThreadPool("JMSThread", tg);
}
else
{
tp = (ThreadPool) server.getAttribute(threadPool, "Instance");
if (tp instanceof BasicThreadPool)
tg = ((BasicThreadPool)tp).getThreadGroup();
else
tg = new ThreadGroup("JBossMQ Server Threads");
}
jmsServer.setThreadPool(tp);
jmsServer.setThreadGroup(tg);
jmsServer.startServer();
super.startService();
}
|
protected void stopService() {
jmsServer.stopServer();
}
|