public abstract class ServerPlatformBase extends 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 String |
DEFAULT_SERVER_NAME_AND_VERSION
INTERNAL:
Answer "unknown" as a default for platforms that do not implement getModuleName()
|
protected Class |
externalTransactionControllerClass
externalTransactionControllerClass: This is a user-specifiable class defining the class
of external transaction controller to be set into the DatabaseSession
|
static 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 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
|
protected String |
serverNameAndVersion
INTERNAL:
Server name and version.
|
protected boolean |
shouldRegisterDevelopmentBean |
protected boolean |
shouldRegisterRuntimeBean |
protected ExecutorService |
threadPool
Allow pooling of threads for asynchronous processing in RCM and other areas.
|
protected int |
threadPoolSize
Allow the thread pool size to be configured.
|
| 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(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.
|
protected void |
ensureNotLoggedIn()
INTERNAL: Make sure that the DatabaseSession has not logged in yet.
|
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.
|
DatabaseSession |
getDatabaseSession()
INTERNAL: getDatabaseSession(): Answer the instance of DatabaseSession the receiver is helping.
|
abstract Class |
getExternalTransactionControllerClass()
INTERNAL: getExternalTransactionControllerClass(): Answer the class of external transaction controller to use
For this server platform.
|
int |
getJNDIConnectorLookupType()
INTERNAL: Get JNDIConnector lookupType value for this platform.
|
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(jakarta.persistence.spi.PersistenceUnitInfo puInfo)
INTERNAL:
JIRA EJBTHREE-572 requires that we use the real classLoader in place of the getNewTempClassLoader().
|
String |
getPartitionID()
INTERNAL: Get Partition ID.
|
SessionLog |
getServerLog()
INTERNAL: getServerLog(): Return the ServerLog for this platform
Return the default ServerLog in the base
|
String |
getServerNameAndVersion()
PUBLIC: getServerNameAndVersion(): Talk to the relevant server class library, and get the server name
and version
|
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.
|
protected void |
initializeServerNameAndVersion()
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 |
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(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(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 |
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.
|
Connection |
unwrapConnection(Connection connection)
INTERNAL: This method is used to unwrap the connection wrapped by
the application server.
|
boolean |
usesPartitions()
INTERNAL: Some servers may support partitioning
|
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.
|
public static final String JMX_REGISTER_DEV_MBEAN_PROPERTY
public static final String JMX_REGISTER_RUN_MBEAN_PROPERTY
public static final String DEFAULT_SERVER_NAME_AND_VERSION
protected boolean shouldRegisterDevelopmentBean
protected boolean shouldRegisterRuntimeBean
protected Class externalTransactionControllerClass
protected String serverNameAndVersion
protected int threadPoolSize
protected volatile ExecutorService threadPool
public ServerPlatformBase(DatabaseSession newDatabaseSession)
newDatabaseSession - The instance of DatabaseSession that I am helping.public void configureProfiler(Session session)
public DatabaseSession getDatabaseSession()
getDatabaseSession in interface ServerPlatformpublic String getServerNameAndVersion()
getServerNameAndVersion in interface ServerPlatformprotected void initializeServerNameAndVersion()
public String getModuleName()
getModuleName in interface ServerPlatformpublic abstract Class getExternalTransactionControllerClass()
getExternalTransactionControllerClass in interface ServerPlatformJTATransactionController,
isJTAEnabled(),
disableJTA()public void setExternalTransactionControllerClass(Class newClass)
setExternalTransactionControllerClass in interface ServerPlatformJTATransactionController,
isJTAEnabled(),
disableJTA(),
initializeExternalTransactionController()public void initializeExternalTransactionController()
initializeExternalTransactionController in interface ServerPlatformServerPlatformBaseprotected void externalTransactionControllerNotNullWarning()
getExternalTransactionControllerClass()public boolean isJTAEnabled()
isJTAEnabled in interface ServerPlatformgetExternalTransactionControllerClass(),
disableJTA()public boolean isJTA11()
true when JTA 1.1 API is available or false otherwise.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 ServerPlatformpublic boolean isRuntimeServicesEnabled()
isRuntimeServicesEnabled in interface ServerPlatformdisableRuntimeServices()public void disableRuntimeServices()
disableRuntimeServices in interface ServerPlatformisRuntimeServicesEnabled()public void enableRuntimeServices()
isRuntimeServicesEnabled()public void disableJTA()
disableJTA in interface ServerPlatformgetExternalTransactionControllerClass(),
isJTAEnabled()public Connection unwrapConnection(Connection connection)
unwrapConnection in interface ServerPlatformpublic void launchContainerRunnable(Runnable runnable)
launchContainerRunnable in interface ServerPlatformrunnable: - the instance of runnable to be "started"protected void ensureNotLoggedIn()
public SessionLog getServerLog()
getServerLog in interface ServerPlatformpublic int getThreadPoolSize()
getThreadPoolSize in interface ServerPlatformpublic void setThreadPoolSize(int threadPoolSize)
setThreadPoolSize in interface ServerPlatformpublic ExecutorService getThreadPool()
public void setThreadPool(ExecutorService threadPool)
public boolean isCMP()
public void setIsCMP(boolean isThisCMP)
public boolean shouldUseDriverManager()
shouldUseDriverManager in interface ServerPlatformpublic boolean wasFailureCommunicationBased(SQLException exception, org.eclipse.persistence.internal.databaseaccess.Accessor connection, org.eclipse.persistence.internal.sessions.AbstractSession sessionForProfile)
wasFailureCommunicationBased in interface ServerPlatformpublic org.eclipse.persistence.internal.helper.JPAClassLoaderHolder getNewTempClassLoader(jakarta.persistence.spi.PersistenceUnitInfo puInfo)
ServerPlatformgetNewTempClassLoader in interface ServerPlatformpuInfo - - the persistence unit infoJPAClassLoaderHolderpublic void clearStatementCache(Connection connection)
clearStatementCache in interface ServerPlatformpublic void registerMBean()
registerMBean in interface ServerPlatformisRuntimeServicesEnabled(),
disableRuntimeServices(),
unregisterMBean()public void unregisterMBean()
unregisterMBean in interface ServerPlatformisRuntimeServicesEnabled(),
disableRuntimeServices(),
registerMBean()public void shutdown()
shutdown in interface ServerPlatformpublic void serverSpecificUnregisterMBean()
public void serverSpecificRegisterMBean()
public int getJNDIConnectorLookupType()
ServerPlatformgetJNDIConnectorLookupType in interface ServerPlatformpublic String getPartitionID()
ServerPlatformgetPartitionID in interface ServerPlatformpublic boolean usesPartitions()
ServerPlatformusesPartitions in interface ServerPlatformCopyright © 2007–2021 Eclipse.org - EclipseLink Project. All rights reserved.