Methods Summary |
---|
private void | checkDepth(java.lang.Integer startDepthInteger, com.sun.enterprise.admin.event.EventStack eventStack, boolean success)
setDepth( startDepthInteger );
if ( startDepthInteger.intValue() == 0 && success )
{
final ConfigContext configContext = getAdminContext().getAdminConfigContext();
final boolean needFlush = configContext.isChanged();
if ( needFlush )
{
debug( "FlushConfigHook.checkDepth(): CHANGED, need flush");
dumpEventStack( eventStack );
debug( "FlushConfigHook.checkDepth: Config has changed, flushing..." );
try
{
configContext.flush();
}
catch( ConfigException e )
{
throw new ReflectionException( e );
}
debug( "FlushConfigHook.checkDepth: done flushing changed config, sending Notification" );
// NOTE: this uses the ThreadLocal EventStack from the EventContext set set earlie
if ( EVENT_STACK_ISNT_POINTLESS )
{
getAdminNotificationHelper().sendNotification();
debug( "FlushConfigHook.checkDepth: sending Notification of changed config" );
}
}
else
{
debug( "FlushConfigHook.checkDepth(): unchanged, no flush needed");
}
}
|
private void | debug(java.lang.Object args)
if ( mDebug.getDebug() )
{
mDebug.println( args );
}
|
private void | dumpEventStack(com.sun.enterprise.admin.event.EventStack eventStack)
if ( LOG_CONFIG_CHANGES )
{
final List<ConfigChange> changes = TypeCast.asList( eventStack.getConfigChangeList() );
String msg = "CONFIG CHANGES: " + changes.size() + ": \n{";
for ( final com.sun.enterprise.config.ConfigChange configChange : changes )
{
msg += configChange.getConfigChangeType() + "=" + configChange.getName() + ": " +
configChange.getXPath();
}
msg = msg + "}";
debug( msg );
}
|
public com.sun.enterprise.admin.AdminContext | getAdminContext()
return mAdminContext;
|
private com.sun.enterprise.admin.server.core.AdminNotificationHelper | getAdminNotificationHelper()
return mAdminNotificationHelper;
|
public java.lang.Object | getAttribute(javax.management.ObjectName objectName, java.lang.String attrName)
final Object result = mDelegateMBeanServer.getAttribute( objectName, attrName );
return result;
|
public javax.management.AttributeList | getAttributes(javax.management.ObjectName objectName, java.lang.String[] attrNames)
final AttributeList result = mDelegateMBeanServer.getAttributes( objectName, attrNames );
return result;
|
public java.lang.ClassLoader | getClassLoader(javax.management.ObjectName objectName)
return mDelegateMBeanServer.getClassLoader( objectName );
|
public java.lang.ClassLoader | getClassLoaderFor(javax.management.ObjectName objectName)
return mDelegateMBeanServer.getClassLoaderFor( objectName );
|
private static java.lang.Integer | getDepth()
return (Integer)sDepth.get();
|
public javax.management.MBeanInfo | getMBeanInfo(javax.management.ObjectName objectName)
return mDelegateMBeanServer.getMBeanInfo( objectName );
|
public java.lang.Object | invoke(javax.management.ObjectName objectName, java.lang.String operationName, java.lang.Object[] params, java.lang.String[] signature)
Object result = null;
debug( "FlushConfigHook.invoke(): ", objectName, ".", operationName, "{", params, "}", "{", signature, "}" );
if ( USE_OLD_CONFIG_INTERCEPTOR )
{
result = mDelegateMBeanServer.invoke( objectName, operationName, params, signature );
}
else
{
if ( isRelevantInvoke( objectName, operationName ) )
{
debug( "FlushConfigHook.invoke: ", operationName, "() START" );
final Integer startDepthInteger = getDepth();
final int startDepth = startDepthInteger.intValue();
setDepth( startDepth == 0 ? INTEGER_1 : new Integer( startDepth + 1 ) );
final EventStack eventStack = setupEventStack( startDepthInteger );
boolean success = false;
try
{
debug( "FlushConfigHook.invoke: ", operationName, "(): NEW EventStack");
result = mDelegateMBeanServer.invoke( objectName, operationName, params, signature );
success = true;
}
finally
{
checkDepth( startDepthInteger, eventStack, success );
}
}
else
{
result = mSuppliedMBeanServer.invoke( objectName, operationName, params, signature );
}
}
debug( "FlushConfigHook.invoke: ", objectName, operationName, "() DONE" );
return result;
|
private final boolean | isRelevantInvoke(javax.management.ObjectName objectName, java.lang.String operationName)
boolean relevant = false;
final String domain = objectName.getDomain();
if ( ENABLED && domain.equals( "com.sun.appserv" ) )
{
if ( "config".equals( objectName.getKeyProperty( "category" ) ) ||
"server-instance".equals( objectName.getKeyProperty( "type" ) ) )
{
relevant = true;
// common cases, covers probably 90%
if ( operationName.startsWith( "get " ) ||
operationName.startsWith( "is " ) ||
operationName.startsWith( "list" ) )
{
relevant = false;
}
}
}
return relevant;
|
public void | setAttribute(javax.management.ObjectName objectName, javax.management.Attribute attribute)
debug( "FlushConfigHook.setAttribute(): ", objectName, ", ", attribute.getName(), "=", attribute.getValue() );
if ( USE_OLD_CONFIG_INTERCEPTOR )
{
mDelegateMBeanServer.setAttribute( objectName, attribute );
}
else
{
final Integer startDepthInteger = getDepth();
final int startDepth = startDepthInteger.intValue();
setDepth( startDepth == 0 ? INTEGER_1 : new Integer( startDepth + 1 ) );
final EventStack eventStack = setupEventStack( startDepthInteger );
boolean success = false;
try
{
mDelegateMBeanServer.setAttribute( objectName, attribute );
success = true;
}
finally
{
checkDepth( startDepthInteger, eventStack, success );
}
}
|
public javax.management.AttributeList | setAttributes(javax.management.ObjectName objectName, javax.management.AttributeList attributeList)
debug( "FlushConfigHook.setAttributes(): ", objectName, ", ", attributeList);
AttributeList result = null;
if ( USE_OLD_CONFIG_INTERCEPTOR )
{
result = mDelegateMBeanServer.setAttributes( objectName, attributeList );
}
else
{
final Integer startDepthInteger = getDepth();
final int startDepth = startDepthInteger.intValue();
setDepth( startDepth == 0 ? INTEGER_1 : new Integer( startDepth + 1 ) );
final EventStack eventStack = setupEventStack( startDepthInteger );
boolean success = false;
try
{
result = mDelegateMBeanServer.setAttributes( objectName, attributeList );
success = true;
}
finally
{
checkDepth( startDepthInteger, eventStack, success );
}
}
return result;
|
public void | setDelegateMBeanServer(javax.management.MBeanServer mbs)
if ( mbs == null )
{
throw new IllegalArgumentException();
}
if ( mSuppliedMBeanServer != null )
{
throw new IllegalArgumentException( "already have an MBeanServer" );
}
mSuppliedMBeanServer = mbs;
if ( USE_OLD_CONFIG_INTERCEPTOR )
{
debug( "FlushConfigHook.setDelegateMBeanServer(): instantiating ConfigInterceptor" );
final ConfigInterceptor configInterceptor = new ConfigInterceptor( mAdminContext );
mDelegateMBeanServer = (MBeanServer)com.sun.enterprise.admin.util.proxy.ProxyFactory.createProxy(
MBeanServer.class, mSuppliedMBeanServer,
configInterceptor );
debug( "FlushConfigHook.setDelegateMBeanServer(): instantiated ConfigInterceptor" );
}
else
{
mDelegateMBeanServer = mbs;
}
|
private static void | setDepth(java.lang.Integer i) sDepth.set(i);
|
private com.sun.enterprise.admin.event.EventStack | setupEventStack(java.lang.Integer startDepthInteger)
EventStack eventStack = null;
if ( EVENT_STACK_ISNT_POINTLESS )
{
if ( startDepthInteger.intValue() == 0 )
{
debug( "FlushConfigHook.setupEventStack(): startDepth = 0");
eventStack = new EventStack();
eventStack.setConfigContext( getAdminContext().getAdminConfigContext() );
EventContext.setEventStackToThreadLocal(eventStack);
}
else
{
debug( "FlushConfigHook.setupEventStack(): startDepth = ", startDepthInteger);
}
}
return eventStack;
|