try {
roundTrips++;
// Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
boolean isJBossConnection = (this.provider instanceof JBossConnectionProvider);
if (isJBossConnection) {
JBossConnectionProvider jbossProvider = (JBossConnectionProvider) this.provider;
// See https://jira.jboss.org/jira/browse/JOPR-9 for an explanation of why we have to re-set the
// PrincipalInfo prior to every JBoss JMX call.
//jbossProvider.resetPrincipalInfo();
// Login via JAAS before making the call...
jbossProvider.login();
}
Object returnValue;
try {
returnValue = method.invoke(this.remoteServer, args);
} finally {
if (isJBossConnection) {
JBossConnectionProvider jbossProvider = (JBossConnectionProvider) this.provider;
// Logout via JAAS before returning...
jbossProvider.logout();
}
}
return returnValue;
} catch(InvocationTargetException e) {
failures++;