public abstract class ServerPlatformBase extends java.lang.Object implements 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:
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:
ServerPlatform
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_SERVER_NAME_AND_VERSION
INTERNAL: Answer "unknown" as a default for platforms that do not implement getModuleName()
|
static java.lang.String |
JMX_REGISTER_DEV_MBEAN_PROPERTY
This System property "eclipselink.register.dev.mbean" when set to true will enable registration/unregistration of the DevelopmentServices MBean
|
static java.lang.String |
JMX_REGISTER_RUN_MBEAN_PROPERTY
This System property "eclipselink.register.run.mbean" when set to true will enable registration/unregistration of the RuntimeServices MBean
|
Constructor and Description |
---|
ServerPlatformBase(DatabaseSession newDatabaseSession)
INTERNAL: Default Constructor: Initialize so that runtime services and JTA are enabled.
|
Modifier and Type | Method and Description |
---|---|
void |
clearStatementCache(java.sql.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 |
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.
|
void |
disableRuntimeServices()
INTERNAL: disableRuntimeServices(): Configure the receiver such that no JMX/MBean will be registered to provide runtime services for my DatabaseSession at runtime.
|
void |
enableRuntimeServices()
INTERNAL: enableRuntimeServices(): Configure the receiver such that JMX/MBeans will be registered to provide runtime services for my DatabaseSession at runtime.
|
DatabaseSession |
getDatabaseSession()
INTERNAL: getDatabaseSession(): Answer the instance of DatabaseSession the receiver is helping.
|
abstract java.lang.Class |
getExternalTransactionControllerClass()
INTERNAL: getExternalTransactionControllerClass(): Answer the class of external transaction controller to use For this server platform.
|
java.lang.String |
getModuleName()
INTERNAL: getModuleName(): Answer the name of the module (jar name) that my session is associated with.
|
org.eclipse.persistence.internal.helper.JPAClassLoaderHolder |
getNewTempClassLoader(javax.persistence.spi.PersistenceUnitInfo puInfo)
INTERNAL: JIRA EJBTHREE-572 requires that we use the real classLoader in place of the getNewTempClassLoader().
|
SessionLog |
getServerLog()
INTERNAL: getServerLog(): Return the ServerLog for this platform Return the default ServerLog in the base
|
java.lang.String |
getServerNameAndVersion()
PUBLIC: getServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version
|
java.util.concurrent.ExecutorService |
getThreadPool()
INTERNAL: Return the thread pool, initializing if required.
|
int |
getThreadPoolSize()
Return the thread pool size.
|
void |
initializeExternalTransactionController()
INTERNAL: initializeExternalTransactionController(): Populate the DatabaseSession's external transaction controller with an instance of my transaction controller class.
|
boolean |
isCMP()
INTERNAL: isCMP(): Answer true if we're in the context of CMP (i.e. the container created me)
|
boolean |
isJTAEnabled()
INTERNAL: isJTAEnabled(): Answer true if the DatabaseSession's external transaction controller class will be populated with my transaction controller class at runtime.
|
boolean |
isRuntimeServicesEnabled()
INTERNAL: isRuntimeServicesEnabled(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime.
|
boolean |
isRuntimeServicesEnabledDefault()
INTERNAL: isRuntimeServicesEnabledDefault(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime.
|
void |
launchContainerRunnable(java.lang.Runnable runnable)
INTERNAL: launchContainerRunnable(Runnable runnable): Use the container library to start the provided Runnable.
|
void |
registerMBean()
INTERNAL: registerMBean(): Create and deploy the JMX MBean to provide runtime services for my databaseSession.
|
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 unregistration of the JMX MBean from its server.
|
void |
setExternalTransactionControllerClass(java.lang.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. the container created me)
|
void |
setThreadPool(java.util.concurrent.ExecutorService threadPool)
INTERNAL: Set the thread pool to use.
|
void |
setThreadPoolSize(int threadPoolSize)
Set the thread pool size.
|
boolean |
shouldUseDriverManager()
INTERNAL: shouldUseDriverManager(): Indicates whether DriverManager should be used while connecting DefaultConnector.
|
void |
shutdown()
INTERNAL: perform any require shutdown tasks.
|
void |
unregisterMBean()
INTERNAL: unregisterMBean(): Unregister the JMX MBean that was providing runtime services for my databaseSession.
|
java.sql.Connection |
unwrapConnection(java.sql.Connection connection)
INTERNAL: This method is used to unwrap the connection wrapped by the application server.
|
boolean |
wasFailureCommunicationBased(java.sql.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.
|
public static final java.lang.String JMX_REGISTER_DEV_MBEAN_PROPERTY
public static final java.lang.String JMX_REGISTER_RUN_MBEAN_PROPERTY
public static final java.lang.String DEFAULT_SERVER_NAME_AND_VERSION
public ServerPlatformBase(DatabaseSession newDatabaseSession)
public void configureProfiler(Session session)
public DatabaseSession getDatabaseSession()
getDatabaseSession
in interface ServerPlatform
public java.lang.String getServerNameAndVersion()
getServerNameAndVersion
in interface ServerPlatform
public java.lang.String getModuleName()
getModuleName
in interface ServerPlatform
public abstract java.lang.Class getExternalTransactionControllerClass()
getExternalTransactionControllerClass
in interface ServerPlatform
JTATransactionController
, isJTAEnabled()
, disableJTA()
public void setExternalTransactionControllerClass(java.lang.Class newClass)
setExternalTransactionControllerClass
in interface ServerPlatform
JTATransactionController
, isJTAEnabled()
, disableJTA()
, initializeExternalTransactionController()
public void initializeExternalTransactionController()
initializeExternalTransactionController
in interface ServerPlatform
ServerPlatformBase
public boolean isJTAEnabled()
isJTAEnabled
in interface ServerPlatform
getExternalTransactionControllerClass()
, disableJTA()
public boolean isRuntimeServicesEnabledDefault()
isRuntimeServicesEnabled()
for a ServerPlatform. By default this is false
but some platforms can choose to have MBeans deployed by default.isRuntimeServicesEnabledDefault
in interface ServerPlatform
public boolean isRuntimeServicesEnabled()
isRuntimeServicesEnabled
in interface ServerPlatform
disableRuntimeServices()
public void disableRuntimeServices()
disableRuntimeServices
in interface ServerPlatform
isRuntimeServicesEnabled()
public void enableRuntimeServices()
isRuntimeServicesEnabled()
public void disableJTA()
disableJTA
in interface ServerPlatform
getExternalTransactionControllerClass()
, isJTAEnabled()
public java.sql.Connection unwrapConnection(java.sql.Connection connection)
unwrapConnection
in interface ServerPlatform
public void launchContainerRunnable(java.lang.Runnable runnable)
launchContainerRunnable
in interface ServerPlatform
Runnable
- runnable: the instance of runnable to be "started"public SessionLog getServerLog()
getServerLog
in interface ServerPlatform
public int getThreadPoolSize()
getThreadPoolSize
in interface ServerPlatform
public void setThreadPoolSize(int threadPoolSize)
setThreadPoolSize
in interface ServerPlatform
public java.util.concurrent.ExecutorService getThreadPool()
public void setThreadPool(java.util.concurrent.ExecutorService threadPool)
public boolean isCMP()
public void setIsCMP(boolean isThisCMP)
public boolean shouldUseDriverManager()
shouldUseDriverManager
in interface ServerPlatform
public boolean wasFailureCommunicationBased(java.sql.SQLException exception, org.eclipse.persistence.internal.databaseaccess.Accessor connection, org.eclipse.persistence.internal.sessions.AbstractSession sessionForProfile)
wasFailureCommunicationBased
in interface ServerPlatform
public org.eclipse.persistence.internal.helper.JPAClassLoaderHolder getNewTempClassLoader(javax.persistence.spi.PersistenceUnitInfo puInfo)
ServerPlatform
getNewTempClassLoader
in interface ServerPlatform
puInfo
- - the persistence unit infoorg.eclipse.persistence.internal.helper.ClassLoaderHolder
public void clearStatementCache(java.sql.Connection connection)
clearStatementCache
in interface ServerPlatform
public void registerMBean()
registerMBean
in interface ServerPlatform
isRuntimeServicesEnabled()
, disableRuntimeServices()
, unregisterMBean()
public void unregisterMBean()
unregisterMBean
in interface ServerPlatform
isRuntimeServicesEnabled()
, disableRuntimeServices()
, registerMBean()
public void shutdown()
shutdown
in interface ServerPlatform
public void serverSpecificUnregisterMBean()
public void serverSpecificRegisterMBean()