Methods Summary |
---|
private void | build()
final String name = StatsHolderMBeanImpl.class.getName();
final String desc = getDescription();
final MBeanAttributeInfo[] mais = mediator.getAttributeInfos();
final MBeanConstructorInfo[] mcis = this.getConstructorInfos();
final MBeanOperationInfo[] mois = this.getOperationInfos();
final MBeanNotificationInfo[] mnis = this.getNotificationInfos();
mi = new MBeanInfo(name, desc, mais, mcis, mois, mnis);
|
private void | changeState(int to)
synchronized(lock) {
state = to;
}
|
private boolean | checkSerializability(java.lang.Object[] objArray)
boolean isSerializable = true;
for(int i = 0; i < objArray.length; i++) {
isSerializable = (isSerializable) && (objArray[i] instanceof java.io.Serializable);
}
return isSerializable;
|
public java.lang.Object | getAttribute(java.lang.String name)
if(name.equals(DOTTED_NAME))
return delegate.getDottedName();
else
return ( mediator.getAttribute(name) );
|
public javax.management.AttributeList | getAttributes(java.lang.String[] names)
final AttributeList list = new AttributeList();
for (int i = 0 ; i < names.length ; i++) {
try {
final Attribute a = new Attribute(names[i], this.getAttribute(names[i]));
list.add(a);
}
catch(Exception e) {
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Error while accessing an attribute named: " + names[i]);
}
//The exception SHOULD BE squelched per the contract of this method
}
}
return ( list );
|
public javax.management.ObjectName[] | getChildren()
final Collection c = delegate.getAllChildren();
final ObjectName[] names = new ObjectName[c.size()];
final Iterator it = c.iterator();
int i = 0;
while (it.hasNext()) {
final StatsHolder s = (StatsHolder) it.next();
names[i++] = s.getObjectName();
}
assert (names.length == i) : "Sizes don't match";
return ( names );
|
private javax.management.MBeanOperationInfo | getChildrenInfo()
final MBeanOperationInfo info = new MBeanOperationInfo(
"getChildren",
"Gets the children of this StatsHolder",
null,
ObjectName[].class.getName(),
MBeanOperationInfo.INFO
);
return ( info );
|
private javax.management.MBeanConstructorInfo[] | getConstructorInfos()
final MBeanConstructorInfo[] cis = new MBeanConstructorInfo[0];
return ( cis ); //we don't want management applications to create instances of this MBean
|
private java.lang.String | getDescription()
return "StatsHolder MBean for: " + StatsHolderMBeanImpl.class.getName();
|
private javax.management.MBeanOperationInfo[] | getJTAOperationInfo(javax.management.MBeanOperationInfo[] mos)
ArrayList opInfo = new ArrayList();
for(int i = 0; i < mos.length ; i++)
opInfo.add(mos[i]);
// not performing any reflection for now, as it is assumed that
// only 3 methods will be added to the MBeanOperationInfo and
// their names and signatures are fixed.
MBeanOperationInfo mInfo = new MBeanOperationInfo(JTA_FREEZE,
"Freezes the transaction service",
null,
void.class.getName(),
MBeanOperationInfo.ACTION);
opInfo.add(mInfo);
mInfo = new MBeanOperationInfo(JTA_UNFREEZE,
"Unfreezes the transaction service",
null,
void.class.getName(),
MBeanOperationInfo.ACTION);
opInfo.add(mInfo);
mInfo = new MBeanOperationInfo(JTA_ROLLBACK,
"Rollsback a given transaction",
new MBeanParameterInfo[] {
new MBeanParameterInfo("txnId",
String.class.getName(),
"Id of the transaction to be rolled back"
)},
void.class.getName(),
MBeanOperationInfo.ACTION);
opInfo.add(mInfo);
mInfo = new MBeanOperationInfo(JTA_ACTIVE_TRANSACTIONS,
"Gets Active Transactions in a Map",
null,
List.class.getName(),
MBeanOperationInfo.ACTION_INFO);
opInfo.add(mInfo);
mInfo = new MBeanOperationInfo(JTA_RUNTIME_RECOVERY_REQUIRED,
"Returns if the recovery is required",
null,
Boolean.class.getName(),
MBeanOperationInfo.ACTION_INFO);
opInfo.add(mInfo);
MBeanOperationInfo[] jtaOpInfo = new MBeanOperationInfo[opInfo.size()];
return (MBeanOperationInfo[])opInfo.toArray(jtaOpInfo);
|
public javax.management.MBeanInfo | getMBeanInfo()
synchronized(lock) {
if (state == MBEANINFO_DONE) {
return mi;
}
}
build();
changeState(MBEANINFO_DONE);
return ( mi );
|
public java.lang.String | getName()
return delegate.getName();
|
private javax.management.MBeanOperationInfo | getNameInfo()
MBeanOperationInfo mInfo = new MBeanOperationInfo("getName",
"Gets the name of this StatsHolder",
null,
String.class.getName(),
MBeanOperationInfo.INFO);
return mInfo;
|
private javax.management.MBeanNotificationInfo[] | getNotificationInfos()
final MBeanNotificationInfo[] mns = new MBeanNotificationInfo[0];
return ( mns );
|
private javax.management.MBeanOperationInfo[] | getOperationInfos()
final ArrayList opInfo = new ArrayList();
opInfo.add(getChildrenInfo());
opInfo.add(getNameInfo());
opInfo.add(getTypeInfo());
// Add the additional ops only for StatsHolders that have an actual Stats object
// associated with them
if(delegate.getStats() != null) {
opInfo.add(getStatisticNameInfo());
opInfo.add(getStatsInfo());
}
MBeanOperationInfo[] mos = new MBeanOperationInfo[opInfo.size()];
mos = (MBeanOperationInfo[])opInfo.toArray(mos);
// if we are dealing with JTAStats, we need to add the additional
// operations freeze, unfreeze & rollback to the MBeanOerationInfo
if(isJta())
return (getJTAOperationInfo(mos));
return ( mos );
|
private javax.management.MBeanOperationInfo | getStatisticNameInfo()
MBeanOperationInfo mInfo = new MBeanOperationInfo("getStatisticNames",
"Gets the names of all the statistics in the given Stats Object",
null,
String[].class.getName(),
MBeanOperationInfo.INFO);
return mInfo;
|
public java.lang.String[] | getStatisticNames()
Stats stats = delegate.getStats();
if (stats != null) {
return stats.getStatisticNames();
} else {
return null;
}
|
public javax.management.j2ee.statistics.Statistic[] | getStatistics()
Stats stats = delegate.getStats();
if (stats == null) {
return null;
}
Statistic[] statArray = stats.getStatistics();
boolean isSerializable = checkSerializability(statArray);
if(isSerializable) {
final Statistic[] hackedArray = StatisticWorkaround.populateDescriptions(statArray);
return hackedArray;
}
else
return null;
|
private javax.management.MBeanOperationInfo | getStatsInfo()
MBeanOperationInfo mInfo = new MBeanOperationInfo("getStatistics",
"returns the results of all the getXXX methods, in the given Stats object",
null,
Statistic[].class.getName(),
MBeanOperationInfo.INFO);
return mInfo;
|
public java.lang.String | getType()
return delegate.getType().getTypeName();
|
private javax.management.MBeanOperationInfo | getTypeInfo()
MBeanOperationInfo mInfo = new MBeanOperationInfo("getType",
"Gets the type of this StatsHolder",
null,
String.class.getName(),
MBeanOperationInfo.INFO);
return mInfo;
|
public java.lang.Object | invoke(java.lang.String method, java.lang.Object[] params, java.lang.String[] sign)
if ("getChildren".equals(method)) {
return ( this.getChildren() );
} else if ("getName".equals(method)) {
return (this.getName());
} else if ("getType".equals(method)) {
return (this.getType());
} else if ("getStatisticNames".equals(method)) {
return (this.getStatisticNames());
} else if ("getStatistics".equals(method)) {
return (this.getStatistics());
} else if(isJTAMethod(method)) {
return(mediator.invoke(method, params, sign));
} else {
final String msg = sm.getString("smi.no_such_method", method);
final Exception ae = new UnsupportedOperationException(msg);
throw new MBeanException(ae);
}
|
private boolean | isJTAMethod(java.lang.String methodName)
return ((JTA_FREEZE.equals(methodName)) ||
(JTA_UNFREEZE.equals(methodName)) ||
(JTA_ACTIVE_TRANSACTIONS.equals(methodName)) ||
(JTA_RUNTIME_RECOVERY_REQUIRED.equals(methodName)) ||
(JTA_ROLLBACK.equals(methodName)));
|
private boolean | isJta()
boolean isJta = false;
final Class cl = delegate.getStatsClass();
if (cl != null) {
if (com.sun.enterprise.admin.monitor.stats.JTAStats.class.getName().equals(cl.getName())) {
isJta = true;
}
}
return ( isJta);
|
public void | postDeregister()
|
public void | postRegister(java.lang.Boolean registered)
if (registered.equals(Boolean.TRUE)) {
registrar.registerDottedName(delegate.getDottedName(),
delegate.getObjectName());
changeState(REGISTERED);
}
|
public void | preDeregister()
registrar.unregisterDottedName(delegate.getDottedName());
|
public javax.management.ObjectName | preRegister(javax.management.MBeanServer mBeanServer, javax.management.ObjectName objectName)
this.registrar = new DottedNameRegistrar(mBeanServer);
return objectName;
|
public void | setAttribute(javax.management.Attribute attribute)
throw new UnsupportedOperationException("NYI");
|
public javax.management.AttributeList | setAttributes(javax.management.AttributeList attributes)
throw new UnsupportedOperationException("NYI");
|