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
FieldsModifier and TypeFieldDescriptionstatic final StringINTERNAL: Answer "unknown" as a default for platforms that do not implement getModuleName()protected ClassexternalTransactionControllerClass: This is a user-specifiable class defining the class of external transaction controller to be set into the DatabaseSessionstatic final StringThis System property "eclipselink.register.dev.mbean" when set to true will enable registration/unregistration of the DevelopmentServices MBeanstatic final StringThis System property "eclipselink.register.run.mbean" when set to true will enable registration/unregistration of the RuntimeServices MBeanprotected StringINTERNAL: Server name and version.protected booleanprotected booleanprotected ExecutorServiceAllow pooling of threads for asynchronous processing in RCM and other areas.protected intAllow the thread pool size to be configured. -
Constructor Summary
ConstructorsConstructorDescriptionServerPlatformBase(DatabaseSession newDatabaseSession) INTERNAL: Default Constructor: Initialize so that runtime services and JTA are enabled. -
Method Summary
Modifier and TypeMethodDescriptionvoidclearStatementCache(Connection connection) INTERNAL: Clears statement cache of the wrapper connection.voidconfigureProfiler(Session session) INTERNAL: configureProfiler(): set default performance profiler used in this server.voidINTERNAL: 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.voidINTERNAL: disableRuntimeServices(): Configure the receiver such that no JMX/MBean will be registered to provide runtime services for my DatabaseSession at runtime.voidINTERNAL: enableRuntimeServices(): Configure the receiver such that JMX/MBeans will be registered to provide runtime services for my DatabaseSession at runtime.protected voidINTERNAL: Make sure that the DatabaseSession has not logged in yet.protected voidINTERNAL: 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 ClassINTERNAL: getExternalTransactionControllerClass(): Answer the class of external transaction controller to use For this server platform.intINTERNAL: 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.JPAClassLoaderHoldergetNewTempClassLoader(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.intReturn the thread pool size.voidINTERNAL: initializeExternalTransactionController(): Populate the DatabaseSession's external transaction controller with an instance of my transaction controller class.protected voidINTERNAL: initializeServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version Default is "unknown"booleanisCMP()INTERNAL: isCMP(): Answer true if we're in the context of CMP (i.e.booleanisJTA11()INTERNAL: Check whether JTA 1.1 API is available.booleanINTERNAL: isJTAEnabled(): Answer true if the DatabaseSession's external transaction controller class will be populated with my transaction controller class at runtime.booleanINTERNAL: isRuntimeServicesEnabled(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime.booleanINTERNAL: isRuntimeServicesEnabledDefault(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime.voidlaunchContainerRunnable(Runnable runnable) INTERNAL: launchContainerRunnable(Runnable runnable): Use the container library to start the provided Runnable.voidINTERNAL: registerMBean(): Create and deploy the JMX MBean to provide runtime services for my databaseSession.voidINTERNAL: serverSpecificRegisterMBean(): Server specific implementation of the creation and deployment of the JMX MBean to provide runtime services for my databaseSession.voidINTERNAL: serverSpecificUnregisterMBean(): Server specific implementation of the unregistration of the JMX MBean from its server.voidsetExternalTransactionControllerClass(Class newClass) INTERNAL: setExternalTransactionControllerClass(Class newClass): Set the class of external transaction controller to use in the DatabaseSession.voidsetIsCMP(boolean isThisCMP) INTERNAL: setIsCMP(boolean): Define whether or not we're in the context of CMP (i.e.voidsetThreadPool(ExecutorService threadPool) INTERNAL: Set the thread pool to use.voidsetThreadPoolSize(int threadPoolSize) Set the thread pool size.booleanINTERNAL: shouldUseDriverManager(): Indicates whether DriverManager should be used while connecting DefaultConnector.voidshutdown()INTERNAL: perform any require shutdown tasks.voidINTERNAL: 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.booleanINTERNAL: Some servers may support partitioningbooleanwasFailureCommunicationBased(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:
getDatabaseSessionin interfaceServerPlatform- Returns:
- DatabaseSession databaseSession
-
getServerNameAndVersion
PUBLIC: getServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version- Specified by:
getServerNameAndVersionin 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:
getModuleNamein 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:
getExternalTransactionControllerClassin 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:
setExternalTransactionControllerClassin 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:
initializeExternalTransactionControllerin 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:
isJTAEnabledin interfaceServerPlatform- Returns:
- boolean isJTAEnabled
- See Also:
-
isJTA11
public boolean isJTA11()INTERNAL: Check whether JTA 1.1 API is available.- Returns:
- value of
truewhen JTA 1.1 API is available orfalseotherwise.
-
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 isfalsebut some platforms can choose to have MBeans deployed by default.- Specified by:
isRuntimeServicesEnabledDefaultin 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:
isRuntimeServicesEnabledin 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:
disableRuntimeServicesin 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:
disableJTAin 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:
unwrapConnectionin 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:
launchContainerRunnablein 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:
getServerLogin interfaceServerPlatform- Returns:
- org.eclipse.persistence.logging.SessionLog
-
getThreadPoolSize
public int getThreadPoolSize()Return the thread pool size.- Specified by:
getThreadPoolSizein interfaceServerPlatform
-
setThreadPoolSize
public void setThreadPoolSize(int threadPoolSize) Set the thread pool size.- Specified by:
setThreadPoolSizein 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:
shouldUseDriverManagerin 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:
wasFailureCommunicationBasedin interfaceServerPlatform
-
getNewTempClassLoader
public org.eclipse.persistence.internal.helper.JPAClassLoaderHolder getNewTempClassLoader(jakarta.persistence.spi.PersistenceUnitInfo puInfo) Description copied from interface:ServerPlatformINTERNAL: 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:
getNewTempClassLoaderin 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:
clearStatementCachein 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:
registerMBeanin interfaceServerPlatform- See Also:
-
unregisterMBean
public void unregisterMBean()INTERNAL: unregisterMBean(): Unregister the JMX MBean that was providing runtime services for my databaseSession.- Specified by:
unregisterMBeanin interfaceServerPlatform- See Also:
-
shutdown
public void shutdown()INTERNAL: perform any require shutdown tasks.- Specified by:
shutdownin 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:ServerPlatformINTERNAL: Get JNDIConnector lookupType value for this platform.- Specified by:
getJNDIConnectorLookupTypein interfaceServerPlatform- Returns:
- Return JNDIConnector.COMPOSITE_NAME_LOOKUP.
-
getPartitionID
Description copied from interface:ServerPlatformINTERNAL: Get Partition ID.- Specified by:
getPartitionIDin interfaceServerPlatform- Returns:
- partition ID
-
usesPartitions
public boolean usesPartitions()Description copied from interface:ServerPlatformINTERNAL: Some servers may support partitioning- Specified by:
usesPartitionsin interfaceServerPlatform- Returns:
- true if server supports partitions, false otherwise
-