[jboss-jira] [JBoss JIRA] Commented: (JBAS-6808) expose cluster partition name via some ManagedObject
Brian Stansberry (JIRA)
jira-events at lists.jboss.org
Thu Jun 4 17:11:56 EDT 2009
[ https://jira.jboss.org/jira/browse/JBAS-6808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12470717#action_12470717 ]
Brian Stansberry commented on JBAS-6808:
----------------------------------------
Accessing the HAPartition MOs:
There can be more than one HAPartition deployed in an AS, so we use the partitionName property as the MO's name, i.e.
@ManagementProperty(use={ViewUse.CONFIGURATION}, description="The partition's name")
@ManagementObjectID(type="HAPartition")
public String getPartitionName()
{
return this.partitionName;
}
So, you can't just look up the HAPartition ManagedComponent via some fixed name. Instead, use the ComponentType:
ManagementView mgtView = getManagementView();
ComponentType type = new ComponentType("MCBean", "HAPartition");
Set<ManagedComponent> hapartitions = mgtView.getComponentsForType(type);
for (ManagedComponent mc : hapartitions)
{
System.out.println("Partition name is " + mc.getProperty("partitionName");
}
> expose cluster partition name via some ManagedObject
> ----------------------------------------------------
>
> Key: JBAS-6808
> URL: https://jira.jboss.org/jira/browse/JBAS-6808
> Project: JBoss Application Server
> Issue Type: Sub-task
> Security Level: Public(Everyone can see)
> Components: ProfileService
> Affects Versions: JBossAS-5.1.0.GA
> Reporter: Ian Springer
> Assignee: Brian Stansberry
> Priority: Critical
> Fix For: JBossAS-5.2.0.Beta1
>
>
> In the as4 plugin, we exposed the following trait:
> <metric property="partitionName" dataType="trait" displayType="summary"
> description="the name of the cluster partition this app server instance belongs to"/>
> which we obtained via JMX as follows:
> private String getPartitionName() {
> ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(
> "jboss:partitionName=%partitionName%,service=DistributedReplicantManager");
> try {
> List<EmsBean> mBeans = loadConnection().queryBeans(queryUtility.getTranslatedQuery());
> if (mBeans.size() == 1) {
> if (queryUtility.setMatchedKeyValues(mBeans.get(0).getBeanName().getKeyProperties())) {
> return queryUtility.getVariableValues().get("partitionName");
> }
> }
> } catch (Exception e) {
> log.error("Could not load partition name as connection could not be loaded");
> }
> return null;
> }
> We need this value exposed via some ManagedObject so we can provide the same trait in the as5 plugin.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list