Class JMXServerPlatformBase
- java.lang.Object
-
- org.eclipse.persistence.platform.server.ServerPlatformBase
-
- org.eclipse.persistence.platform.server.JMXServerPlatformBase
-
- All Implemented Interfaces:
ServerPlatform
- Direct Known Subclasses:
GlassfishPlatform
,JBossPlatform
,WebLogicPlatform
,WebSpherePlatform
public abstract class JMXServerPlatformBase extends ServerPlatformBase
PUBLIC: Subclass of org.eclipse.persistence.platform.server.ServerPlatformBase in support of the JMXEnabledPlatform interfaceThis is the abstract superclass of all platforms for all servers that contain a subclass that implements the JMXEnabledPlatform interface. Each DatabaseSession contains an instance of the receiver, to help the DatabaseSession determine:
- Whether or not to enable JTA (external transaction control)
- How to register/unregister for runtime services (JMX/MBean)
- Whether or not to enable runtime services
Subclasses already exist to provide configurations for Oc4J, WebLogic, JBoss, NetWeaver, GlassFish and WebSphere.
If the versioned platform subclass is JMX enabled by EclipseLink (registers MBeans) then that server platform must implement the JMXEnabledPlatform interface To provide some different behavior than the provided ServerPlatform(s), we recommend subclassing org.eclipse.persistence.platform.server.JMXServerPlatformBase (or a subclass), and overriding:
- JMXEnabledPlatform.prepareServerSpecificServicesMBean()
- See Also:
ServerPlatformBase
- Since:
- EclipseLink 2.1.1
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
APP_SERVER_CLASSLOADER_APPLICATION_PU_SEARCH_STRING_POSTFIX
protected static java.lang.String
APP_SERVER_CLASSLOADER_APPLICATION_PU_SEARCH_STRING_PREFIX
protected static java.lang.String
APP_SERVER_CLASSLOADER_MODULE_EJB_SEARCH_STRING_PREFIX
Override by subclass: Search String in application server session for ejb modulesprotected static java.lang.String
APP_SERVER_CLASSLOADER_MODULE_EJB_WAR_SEARCH_STRING_POSTFIX
protected static java.lang.String
APP_SERVER_CLASSLOADER_MODULE_WAR_SEARCH_STRING_PREFIX
Override by subclass: Search String in application server session for war modulesstatic int
JMX_MBEANSERVER_INDEX_DEFAULT_FOR_MULTIPLE_SERVERS
The default indexed MBeanServer instance to use when multiple MBeanServer instances exist on the platform - usually only in JBossstatic java.lang.String
JMX_REGISTRATION_PREFIX
This is the prefix for all MBeans that are registered with their specific session name appendedprotected javax.management.MBeanServer
mBeanServer
Cache the ServerPlatform MBeanServer for performanceprotected static java.lang.String
OVERRIDE_JMX_APPLICATIONNAME_PROPERTY
This persistence.xml or sessions.xml property is used to override the applicationNameprotected static java.lang.String
OVERRIDE_JMX_MODULENAME_PROPERTY
This persistence.xml or sessions.xml property is used to override the moduleName-
Fields inherited from class org.eclipse.persistence.platform.server.ServerPlatformBase
DEFAULT_SERVER_NAME_AND_VERSION, externalTransactionControllerClass, JMX_REGISTER_DEV_MBEAN_PROPERTY, JMX_REGISTER_RUN_MBEAN_PROPERTY, serverNameAndVersion, shouldRegisterDevelopmentBean, shouldRegisterRuntimeBean, threadPool, threadPoolSize
-
-
Constructor Summary
Constructors Constructor Description JMXServerPlatformBase(DatabaseSession newDatabaseSession)
INTERNAL: Default Constructor: Initialize so that runtime services and JTA are enabled.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.persistence.internal.sessions.AbstractSession
getAbstractSession()
Return the AbstractSession required to log to the non-platform EclipseLink log.java.lang.String
getApplicationName()
INTERNAL: getApplicationName(): Answer the name of the module (EAR name) that this session is associated with.protected java.lang.String
getApplicationName(boolean enableDefault)
INTERNAL: Lazy initialize the application name by first checking for a persistence.xml property override and then deferring to a default name in the absence of a platform override of this functionjavax.management.MBeanServer
getMBeanServer()
INTERNAL: Return the MBeanServer to be used for MBean registration and deregistration.
This MBeanServer reference is lazy loaded and cached on the platform.
There are multiple ways of getting the MBeanServerprotected java.lang.String
getMBeanSessionName()
Remove JMX reserved characters from the session namejava.lang.String
getModuleName()
INTERNAL: getModuleName(): Answer the name of the context-root of the application that this session is associated with.protected java.lang.String
getModuleName(boolean enableDefault)
INTERNAL:protected MBeanRuntimeServicesMBean
getRuntimeServicesMBean()
INTERNAL: Return the cached server specific services MBeanprotected void
initializeApplicationNameAndModuleName()
INTERNAL: Get the applicationName and moduleName from the application server.void
serverSpecificRegisterMBean()
INTERNAL: serverSpecificRegisterMBean(): Server specific implementation of the creation and deployment of the JMX MBean to provide runtime services for my databaseSession.void
serverSpecificUnregisterMBean()
INTERNAL: serverSpecificUnregisterMBean(): Server specific implementation of the de-registration of the JMX MBean from its server during session logout.void
setApplicationName(java.lang.String aName)
INTERNAL:protected void
setModuleName(java.lang.String aName)
INTERNAL;protected void
setRuntimeServicesMBean(MBeanRuntimeServicesMBean runtimeServicesMBean)
INTERNAL: Set the cached server specific services MBean-
Methods inherited from class org.eclipse.persistence.platform.server.ServerPlatformBase
clearStatementCache, configureProfiler, disableJTA, disableRuntimeServices, enableRuntimeServices, ensureNotLoggedIn, externalTransactionControllerNotNullWarning, getDatabaseSession, getExternalTransactionControllerClass, getJNDIConnectorLookupType, getNewTempClassLoader, getPartitionID, getServerLog, getServerNameAndVersion, getThreadPool, getThreadPoolSize, initializeExternalTransactionController, initializeServerNameAndVersion, isCMP, isJTAEnabled, isRuntimeServicesEnabled, isRuntimeServicesEnabledDefault, launchContainerRunnable, registerMBean, setExternalTransactionControllerClass, setIsCMP, setThreadPool, setThreadPoolSize, shouldUseDriverManager, shutdown, unregisterMBean, unwrapConnection, usesPartitions, wasFailureCommunicationBased
-
-
-
-
Field Detail
-
JMX_REGISTRATION_PREFIX
public static final java.lang.String JMX_REGISTRATION_PREFIX
This is the prefix for all MBeans that are registered with their specific session name appended- See Also:
- Constant Field Values
-
JMX_MBEANSERVER_INDEX_DEFAULT_FOR_MULTIPLE_SERVERS
public static final int JMX_MBEANSERVER_INDEX_DEFAULT_FOR_MULTIPLE_SERVERS
The default indexed MBeanServer instance to use when multiple MBeanServer instances exist on the platform - usually only in JBoss- See Also:
- Constant Field Values
-
OVERRIDE_JMX_MODULENAME_PROPERTY
protected static final java.lang.String OVERRIDE_JMX_MODULENAME_PROPERTY
This persistence.xml or sessions.xml property is used to override the moduleName- See Also:
- Constant Field Values
-
OVERRIDE_JMX_APPLICATIONNAME_PROPERTY
protected static final java.lang.String OVERRIDE_JMX_APPLICATIONNAME_PROPERTY
This persistence.xml or sessions.xml property is used to override the applicationName- See Also:
- Constant Field Values
-
APP_SERVER_CLASSLOADER_APPLICATION_PU_SEARCH_STRING_PREFIX
protected static java.lang.String APP_SERVER_CLASSLOADER_APPLICATION_PU_SEARCH_STRING_PREFIX
-
APP_SERVER_CLASSLOADER_APPLICATION_PU_SEARCH_STRING_POSTFIX
protected static java.lang.String APP_SERVER_CLASSLOADER_APPLICATION_PU_SEARCH_STRING_POSTFIX
-
APP_SERVER_CLASSLOADER_MODULE_EJB_SEARCH_STRING_PREFIX
protected static java.lang.String APP_SERVER_CLASSLOADER_MODULE_EJB_SEARCH_STRING_PREFIX
Override by subclass: Search String in application server session for ejb modules
-
APP_SERVER_CLASSLOADER_MODULE_WAR_SEARCH_STRING_PREFIX
protected static java.lang.String APP_SERVER_CLASSLOADER_MODULE_WAR_SEARCH_STRING_PREFIX
Override by subclass: Search String in application server session for war modules
-
APP_SERVER_CLASSLOADER_MODULE_EJB_WAR_SEARCH_STRING_POSTFIX
protected static java.lang.String APP_SERVER_CLASSLOADER_MODULE_EJB_WAR_SEARCH_STRING_POSTFIX
-
mBeanServer
protected javax.management.MBeanServer mBeanServer
Cache the ServerPlatform MBeanServer for performance
-
-
Constructor Detail
-
JMXServerPlatformBase
public JMXServerPlatformBase(DatabaseSession newDatabaseSession)
INTERNAL: Default Constructor: Initialize so that runtime services and JTA are enabled.- Parameters:
newDatabaseSession
- The instance of DatabaseSession that I am helping.
-
-
Method Detail
-
getAbstractSession
protected org.eclipse.persistence.internal.sessions.AbstractSession getAbstractSession()
Return the AbstractSession required to log to the non-platform EclipseLink log. Note: The WeblogicEclipseLinkLog defined for the WebLogic platform currently only supports the following logging categories in the categoryMap HashMap {connection=DebugJpaJdbcJdbc, cache=DebugJpaDataCache, transaction=DebugJpaJdbcJdbc, weaver=DebugJpaEnhance, query=DebugJpaQuery, dms=DebugJpaProfile, sequencing=DebugJpaRuntime, properties=DebugJpaRuntime, ejb=DebugJpaRuntime, jpa_metamodel=DebugJpaMetaData, sql=DebugJpaJdbcSql, ejb_or_metadata=DebugJpaMetaData, event=DebugJpaRuntime, server=DebugJpaRuntime, propagation=DebugJpaDataCache}
-
getMBeanServer
public javax.management.MBeanServer getMBeanServer()
INTERNAL: Return the MBeanServer to be used for MBean registration and deregistration.
This MBeanServer reference is lazy loaded and cached on the platform.
There are multiple ways of getting the MBeanServer
1) MBeanServerFactory static function - working for 3 of 4 servers WebSphere, JBoss and Glassfish in a generic way
We are using method (1)
- JBoss returns 2 MBeanServers in the List - but one of them has a null domain - we don't use that one
- WebLogic may return 2 MBeanServers - in that case we want to register with the one containing the "com.bea" tree 2) ManagementFactory static function - what is the difference in using this one over the one returning a List of servers
3) JNDI lookup
4) Direct server specific native API- Returns:
- the JMX specification MBeanServer
-
serverSpecificRegisterMBean
public void serverSpecificRegisterMBean()
INTERNAL: serverSpecificRegisterMBean(): Server specific implementation of the creation and deployment of the JMX MBean to provide runtime services for my databaseSession. Default is to do nothing. This should be subclassed if required. For platform classes that override the JMXEnabledPlatform - the services MBean is created at platform construction for use during MBean registration here.
-
serverSpecificUnregisterMBean
public void serverSpecificUnregisterMBean()
INTERNAL: serverSpecificUnregisterMBean(): Server specific implementation of the de-registration of the JMX MBean from its server during session logout.- Overrides:
serverSpecificUnregisterMBean
in classServerPlatformBase
- See Also:
ServerPlatformBase.isRuntimeServicesEnabled()
,ServerPlatformBase.disableRuntimeServices()
-
getMBeanSessionName
protected java.lang.String getMBeanSessionName()
Remove JMX reserved characters from the session name- Returns:
-
getRuntimeServicesMBean
protected MBeanRuntimeServicesMBean getRuntimeServicesMBean()
INTERNAL: Return the cached server specific services MBean
-
setRuntimeServicesMBean
protected void setRuntimeServicesMBean(MBeanRuntimeServicesMBean runtimeServicesMBean)
INTERNAL: Set the cached server specific services MBean- Parameters:
runtimeServicesMBean
-
-
getModuleName
protected java.lang.String getModuleName(boolean enableDefault)
INTERNAL:- Parameters:
enableDefault
-- Returns:
-
getModuleName
public java.lang.String getModuleName()
INTERNAL: getModuleName(): Answer the name of the context-root of the application that this session is associated with. Answer "unknown" if there is no module name available. Default behavior is to return "unknown" - we override this behavior here for JBoss. There are 4 levels of implementation. 1) use the property override jboss.moduleName, or 2) perform a reflective jboss.work.executeThreadRuntime.getModuleName() call, or 3) extract the moduleName:persistence_unit from the server specific classloader string representation, or 3) defer to superclass - usually return "unknown"- Specified by:
getModuleName
in interfaceServerPlatform
- Overrides:
getModuleName
in classServerPlatformBase
- Returns:
- String moduleName
-
setModuleName
protected void setModuleName(java.lang.String aName)
INTERNAL;- Parameters:
aName
-
-
getApplicationName
protected java.lang.String getApplicationName(boolean enableDefault)
INTERNAL: Lazy initialize the application name by first checking for a persistence.xml property override and then deferring to a default name in the absence of a platform override of this function- Parameters:
enableDefault
-- Returns:
-
getApplicationName
public java.lang.String getApplicationName()
INTERNAL: getApplicationName(): Answer the name of the module (EAR name) that this session is associated with. Answer "unknown" if there is no application name available. Default behavior is to return "unknown" There are 4 levels of implementation. 1) use the property override weblogic.applicationName, or 2) perform a reflective weblogic.work.executeThreadRuntime.getApplicationName() call, or 3) extract the moduleName:persistence_unit from the application classloader string representation, or 3) defer to this superclass - usually return "unknown"- Returns:
- String applicationName
- See Also:
JMXEnabledPlatform
-
setApplicationName
public void setApplicationName(java.lang.String aName)
INTERNAL:- Parameters:
aName
-
-
initializeApplicationNameAndModuleName
protected void initializeApplicationNameAndModuleName()
INTERNAL: Get the applicationName and moduleName from the application server. This function does not use reflective API on the application server, instead it parses the database session name for the module name, and the classLoader (from the Platform.conversionManager) toString() for the application name.
-
-