Class ServerPlatformBase
java.lang.Object
org.eclipse.persistence.platform.server.ServerPlatformBase
- All Implemented Interfaces:
ServerPlatform
- Direct Known Subclasses:
CustomServerPlatform
,JMXServerPlatformBase
,NoServerPlatform
,Oc4jPlatform
,SAPNetWeaver_7_1_Platform
PUBLIC:
Implementation of org.eclipse.persistence.platform.server.ServerPlatform
This is the abstract superclass of all platforms for all servers. Each DatabaseSession contains an instance of the receiver, to help the DatabaseSession determine:
- Which external transaction controller to use
- 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
- How to launch container Threads
Subclasses already exist to provide configurations for Oc4J, WebLogic, JBoss, NetWeaver, GlassFish and WebSphere.
If the user wants a different external transaction controller class or to provide some different behavior than the provided ServerPlatform(s), we recommend subclassing org.eclipse.persistence.platform.server.ServerPlatformBase (or a subclass), and overriding:
- ServerPlatformBase.getExternalTransactionControllerClass()
- ServerPlatformBase.registerMBean()
- ServerPlatformBase.unregisterMBean()
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
INTERNAL: Answer "unknown" as a default for platforms that do not implement getModuleName()protected Class
externalTransactionControllerClass: This is a user-specifiable class defining the class of external transaction controller to be set into the DatabaseSessionstatic final String
This System property "eclipselink.register.dev.mbean" when set to true will enable registration/unregistration of the DevelopmentServices MBeanstatic final String
This System property "eclipselink.register.run.mbean" when set to true will enable registration/unregistration of the RuntimeServices MBeanprotected String
INTERNAL: Server name and version.protected boolean
protected boolean
protected ExecutorService
Allow pooling of threads for asynchronous processing in RCM and other areas.protected int
Allow the thread pool size to be configured. -
Constructor Summary
ConstructorDescriptionServerPlatformBase
(DatabaseSession newDatabaseSession) INTERNAL: Default Constructor: Initialize so that runtime services and JTA are enabled. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clearStatementCache
(Connection connection) INTERNAL: Clears statement cache of the wrapper connection.void
configureProfiler
(Session session) INTERNAL: configureProfiler(): set default performance profiler used in this server.void
INTERNAL: disableJTA(): Configure the receiver such that my external transaction controller class will be ignored, and will NOT be used to populate DatabaseSession's external transaction controller class at runtime.void
INTERNAL: disableRuntimeServices(): Configure the receiver such that no JMX/MBean will be registered to provide runtime services for my DatabaseSession at runtime.void
INTERNAL: enableRuntimeServices(): Configure the receiver such that JMX/MBeans will be registered to provide runtime services for my DatabaseSession at runtime.protected void
INTERNAL: Make sure that the DatabaseSession has not logged in yet.protected void
INTERNAL: externalTransactionControllerNotNullWarning(): When the external transaction controller is being initialized, we warn the developer if they have already defined the external transaction controller in some way other than subclassing ServerPlatformBase.INTERNAL: getDatabaseSession(): Answer the instance of DatabaseSession the receiver is helping.abstract Class
INTERNAL: getExternalTransactionControllerClass(): Answer the class of external transaction controller to use For this server platform.int
INTERNAL: Get JNDIConnector lookupType value for this platform.INTERNAL: getModuleName(): Answer the name of the module (jar name) that my session is associated with.org.eclipse.persistence.internal.helper.JPAClassLoaderHolder
getNewTempClassLoader
(jakarta.persistence.spi.PersistenceUnitInfo puInfo) INTERNAL: JIRA EJBTHREE-572 requires that we use the real classLoader in place of the getNewTempClassLoader().INTERNAL: Get Partition ID.INTERNAL: getServerLog(): Return the ServerLog for this platform Return the default ServerLog in the basePUBLIC: getServerNameAndVersion(): Talk to the relevant server class library, and get the server name and versionINTERNAL: Return the thread pool, initializing if required.int
Return the thread pool size.void
INTERNAL: initializeExternalTransactionController(): Populate the DatabaseSession's external transaction controller with an instance of my transaction controller class.protected void
INTERNAL: initializeServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version Default is "unknown"boolean
isCMP()
INTERNAL: isCMP(): Answer true if we're in the context of CMP (i.e.boolean
isJTA11()
INTERNAL: Check whether JTA 1.1 API is available.boolean
INTERNAL: isJTAEnabled(): Answer true if the DatabaseSession's external transaction controller class will be populated with my transaction controller class at runtime.boolean
INTERNAL: isRuntimeServicesEnabled(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime.boolean
INTERNAL: isRuntimeServicesEnabledDefault(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime.void
launchContainerRunnable
(Runnable runnable) INTERNAL: launchContainerRunnable(Runnable runnable): Use the container library to start the provided Runnable.void
INTERNAL: registerMBean(): Create and deploy the JMX MBean to provide runtime services for my databaseSession.void
INTERNAL: serverSpecificRegisterMBean(): Server specific implementation of the creation and deployment of the JMX MBean to provide runtime services for my databaseSession.void
INTERNAL: serverSpecificUnregisterMBean(): Server specific implementation of the unregistration of the JMX MBean from its server.void
setExternalTransactionControllerClass
(Class newClass) INTERNAL: setExternalTransactionControllerClass(Class newClass): Set the class of external transaction controller to use in the DatabaseSession.void
setIsCMP
(boolean isThisCMP) INTERNAL: setIsCMP(boolean): Define whether or not we're in the context of CMP (i.e.void
setThreadPool
(ExecutorService threadPool) INTERNAL: Set the thread pool to use.void
setThreadPoolSize
(int threadPoolSize) Set the thread pool size.boolean
INTERNAL: shouldUseDriverManager(): Indicates whether DriverManager should be used while connecting DefaultConnector.void
shutdown()
INTERNAL: perform any require shutdown tasks.void
INTERNAL: unregisterMBean(): Unregister the JMX MBean that was providing runtime services for my databaseSession.unwrapConnection
(Connection connection) INTERNAL: This method is used to unwrap the connection wrapped by the application server.boolean
INTERNAL: Some servers may support partitioningboolean
wasFailureCommunicationBased
(SQLException exception, org.eclipse.persistence.internal.databaseaccess.Accessor connection, org.eclipse.persistence.internal.sessions.AbstractSession sessionForProfile) INTERNAL: A call to this method will perform a platform based check on the connection and exception error code to determine if the connection is still valid or if a communication error has occurred.
-
Field Details
-
JMX_REGISTER_DEV_MBEAN_PROPERTY
This System property "eclipselink.register.dev.mbean" when set to true will enable registration/unregistration of the DevelopmentServices MBean- See Also:
-
JMX_REGISTER_RUN_MBEAN_PROPERTY
This System property "eclipselink.register.run.mbean" when set to true will enable registration/unregistration of the RuntimeServices MBean- See Also:
-
DEFAULT_SERVER_NAME_AND_VERSION
INTERNAL: Answer "unknown" as a default for platforms that do not implement getModuleName() -
shouldRegisterDevelopmentBean
protected boolean shouldRegisterDevelopmentBean -
shouldRegisterRuntimeBean
protected boolean shouldRegisterRuntimeBean -
externalTransactionControllerClass
externalTransactionControllerClass: This is a user-specifiable class defining the class of external transaction controller to be set into the DatabaseSession -
serverNameAndVersion
INTERNAL: Server name and version. -
threadPoolSize
protected int threadPoolSizeAllow the thread pool size to be configured. -
threadPool
Allow pooling of threads for asynchronous processing in RCM and other areas.
-
-
Constructor Details
-
ServerPlatformBase
INTERNAL: Default Constructor: Initialize so that runtime services and JTA are enabled. Set the DatabaseSession that I will be helping.- Parameters:
newDatabaseSession
- The instance of DatabaseSession that I am helping.
-
-
Method Details
-
configureProfiler
INTERNAL: configureProfiler(): set default performance profiler used in this server. -
getDatabaseSession
INTERNAL: getDatabaseSession(): Answer the instance of DatabaseSession the receiver is helping.- Specified by:
getDatabaseSession
in interfaceServerPlatform
- Returns:
- DatabaseSession databaseSession
-
getServerNameAndVersion
PUBLIC: getServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version- Specified by:
getServerNameAndVersion
in interfaceServerPlatform
- Returns:
- String serverNameAndVersion
-
initializeServerNameAndVersion
protected void initializeServerNameAndVersion()INTERNAL: initializeServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version Default is "unknown" -
getModuleName
INTERNAL: getModuleName(): Answer the name of the module (jar name) that my session is associated with. Answer "unknown" if there is no module name available. Default behavior is to return "unknown".- Specified by:
getModuleName
in interfaceServerPlatform
- Returns:
- String moduleName
-
getExternalTransactionControllerClass
INTERNAL: getExternalTransactionControllerClass(): Answer the class of external transaction controller to use For this server platform. This is read-only. If the user wants a different external transaction controller class than the provided ServerPlatform(s), we recommend subclassing org.eclipse.persistence.platform.server.ServerPlatformBase (or a subclass), and overriding: ServerPlatformBase.getExternalTransactionControllerClass() for the desired behavior.- Specified by:
getExternalTransactionControllerClass
in interfaceServerPlatform
- Returns:
- Class externalTransactionControllerClass
- See Also:
-
setExternalTransactionControllerClass
INTERNAL: setExternalTransactionControllerClass(Class newClass): Set the class of external transaction controller to use in the DatabaseSession. This is defined by the user via the sessions.xml.- Specified by:
setExternalTransactionControllerClass
in interfaceServerPlatform
- See Also:
-
initializeExternalTransactionController
public void initializeExternalTransactionController()INTERNAL: initializeExternalTransactionController(): Populate the DatabaseSession's external transaction controller with an instance of my transaction controller class. To change the external transaction controller class, we recommend creating a subclass of ServerPlatformBase, and overriding getExternalTransactionControllerClass().- Specified by:
initializeExternalTransactionController
in interfaceServerPlatform
- See Also:
-
externalTransactionControllerNotNullWarning
protected void externalTransactionControllerNotNullWarning()INTERNAL: externalTransactionControllerNotNullWarning(): When the external transaction controller is being initialized, we warn the developer if they have already defined the external transaction controller in some way other than subclassing ServerPlatformBase.- See Also:
-
isJTAEnabled
public boolean isJTAEnabled()INTERNAL: isJTAEnabled(): Answer true if the DatabaseSession's external transaction controller class will be populated with my transaction controller class at runtime. If the transaction controller class is overridden in the DatabaseSession, my transaction controller class will be ignored. Answer true if TopLink will be configured to register for callbacks for beforeCompletion and afterCompletion.- Specified by:
isJTAEnabled
in interfaceServerPlatform
- Returns:
- boolean isJTAEnabled
- See Also:
-
isJTA11
public boolean isJTA11()INTERNAL: Check whether JTA 1.1 API is available.- Returns:
- value of
true
when JTA 1.1 API is available orfalse
otherwise.
-
isRuntimeServicesEnabledDefault
public boolean isRuntimeServicesEnabledDefault()INTERNAL: isRuntimeServicesEnabledDefault(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime. Provide the default value forisRuntimeServicesEnabled()
for a ServerPlatform. By default this isfalse
but some platforms can choose to have MBeans deployed by default.- Specified by:
isRuntimeServicesEnabledDefault
in interfaceServerPlatform
-
isRuntimeServicesEnabled
public boolean isRuntimeServicesEnabled()INTERNAL: isRuntimeServicesEnabled(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime.- Specified by:
isRuntimeServicesEnabled
in interfaceServerPlatform
- Returns:
- boolean isRuntimeServicesEnabled
- See Also:
-
disableRuntimeServices
public void disableRuntimeServices()INTERNAL: disableRuntimeServices(): Configure the receiver such that no JMX/MBean will be registered to provide runtime services for my DatabaseSession at runtime.- Specified by:
disableRuntimeServices
in interfaceServerPlatform
- See Also:
-
enableRuntimeServices
public void enableRuntimeServices()INTERNAL: enableRuntimeServices(): Configure the receiver such that JMX/MBeans will be registered to provide runtime services for my DatabaseSession at runtime.- See Also:
-
disableJTA
public void disableJTA()INTERNAL: disableJTA(): Configure the receiver such that my external transaction controller class will be ignored, and will NOT be used to populate DatabaseSession's external transaction controller class at runtime. TopLink will NOT be configured to register for callbacks for beforeCompletion and afterCompletion.- Specified by:
disableJTA
in interfaceServerPlatform
- See Also:
-
unwrapConnection
INTERNAL: This method is used to unwrap the connection wrapped by the application server. TopLink needs this unwrapped connection for certain database vendor specific support. (i.e. TIMESTAMPTZ,NCHAR,XMLTYPE) Be default we will use the connection's metadata to try to get the connection- Specified by:
unwrapConnection
in interfaceServerPlatform
-
launchContainerRunnable
INTERNAL: launchContainerRunnable(Runnable runnable): Use the container library to start the provided Runnable. Default behavior is to use Thread(runnable).start()- Specified by:
launchContainerRunnable
in interfaceServerPlatform
- Parameters:
runnable
- : the instance of runnable to be "started"
-
ensureNotLoggedIn
protected void ensureNotLoggedIn()INTERNAL: Make sure that the DatabaseSession has not logged in yet. Throw a ValidationException if we have. -
getServerLog
INTERNAL: getServerLog(): Return the ServerLog for this platform Return the default ServerLog in the base- Specified by:
getServerLog
in interfaceServerPlatform
- Returns:
- org.eclipse.persistence.logging.SessionLog
-
getThreadPoolSize
public int getThreadPoolSize()Return the thread pool size.- Specified by:
getThreadPoolSize
in interfaceServerPlatform
-
setThreadPoolSize
public void setThreadPoolSize(int threadPoolSize) Set the thread pool size.- Specified by:
setThreadPoolSize
in interfaceServerPlatform
-
getThreadPool
INTERNAL: Return the thread pool, initializing if required. -
setThreadPool
INTERNAL: Set the thread pool to use. -
isCMP
public boolean isCMP()INTERNAL: isCMP(): Answer true if we're in the context of CMP (i.e. the container created me)- Returns:
- boolean
-
setIsCMP
public void setIsCMP(boolean isThisCMP) INTERNAL: setIsCMP(boolean): Define whether or not we're in the context of CMP (i.e. the container created me) -
shouldUseDriverManager
public boolean shouldUseDriverManager()INTERNAL: shouldUseDriverManager(): Indicates whether DriverManager should be used while connecting DefaultConnector.- Specified by:
shouldUseDriverManager
in interfaceServerPlatform
- Returns:
- boolean
-
wasFailureCommunicationBased
public boolean wasFailureCommunicationBased(SQLException exception, org.eclipse.persistence.internal.databaseaccess.Accessor connection, org.eclipse.persistence.internal.sessions.AbstractSession sessionForProfile) INTERNAL: A call to this method will perform a platform based check on the connection and exception error code to determine if the connection is still valid or if a communication error has occurred. If a communication error has occurred then the query may be retried. If this platform is unable to determine if the error was communication based it will return false forcing the error to be thrown to the user.- Specified by:
wasFailureCommunicationBased
in interfaceServerPlatform
-
getNewTempClassLoader
public org.eclipse.persistence.internal.helper.JPAClassLoaderHolder getNewTempClassLoader(jakarta.persistence.spi.PersistenceUnitInfo puInfo) Description copied from interface:ServerPlatform
INTERNAL: JIRA EJBTHREE-572 requires that we use the real classLoader in place of the getNewTempClassLoader(). The override code should stay in place until the UCL3 loader does not throw a NPE on loadClass()- Specified by:
getNewTempClassLoader
in interfaceServerPlatform
- Parameters:
puInfo
- - the persistence unit info- Returns:
- ClassLoaderHolder - a composite object containing the classLoader and the flag that is true if the classLoader returned is temporary
- See Also:
-
JPAClassLoaderHolder
-
clearStatementCache
INTERNAL: Clears statement cache of the wrapper connection. Required by Oracle proxy authentication: currently connection statement cache becomes invalid on switching to/from proxy session. This method is called by OracleJDBC_10_1_0_2ProxyConnectionCustomizer before opening proxy session and before closing it.- Specified by:
clearStatementCache
in interfaceServerPlatform
-
registerMBean
public void registerMBean()INTERNAL: registerMBean(): Create and deploy the JMX MBean to provide runtime services for my databaseSession. Default is to do nothing.- Specified by:
registerMBean
in interfaceServerPlatform
- See Also:
-
unregisterMBean
public void unregisterMBean()INTERNAL: unregisterMBean(): Unregister the JMX MBean that was providing runtime services for my databaseSession.- Specified by:
unregisterMBean
in interfaceServerPlatform
- See Also:
-
shutdown
public void shutdown()INTERNAL: perform any require shutdown tasks.- Specified by:
shutdown
in interfaceServerPlatform
-
serverSpecificUnregisterMBean
public void serverSpecificUnregisterMBean()INTERNAL: serverSpecificUnregisterMBean(): Server specific implementation of the unregistration of the JMX MBean from its server. Default is to do nothing. This should be subclassed if required. -
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. -
getJNDIConnectorLookupType
public int getJNDIConnectorLookupType()Description copied from interface:ServerPlatform
INTERNAL: Get JNDIConnector lookupType value for this platform.- Specified by:
getJNDIConnectorLookupType
in interfaceServerPlatform
- Returns:
- Return JNDIConnector.COMPOSITE_NAME_LOOKUP.
-
getPartitionID
Description copied from interface:ServerPlatform
INTERNAL: Get Partition ID.- Specified by:
getPartitionID
in interfaceServerPlatform
- Returns:
- partition ID
-
usesPartitions
public boolean usesPartitions()Description copied from interface:ServerPlatform
INTERNAL: Some servers may support partitioning- Specified by:
usesPartitions
in interfaceServerPlatform
- Returns:
- true if server supports partitions, false otherwise
-