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()
|
protected java.lang.Class |
externalTransactionControllerClass
externalTransactionControllerClass: This is a user-specifiable class defining the class
of external transaction controller to be set into the DatabaseSession
|
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
|
protected java.lang.String |
serverNameAndVersion
INTERNAL:
Server name and version.
|
protected boolean |
shouldRegisterDevelopmentBean |
protected boolean |
shouldRegisterRuntimeBean |
protected java.util.concurrent.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(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.
|
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 java.lang.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.
|
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(PersistenceUnitInfo puInfo)
INTERNAL:
JIRA EJBTHREE-572 requires that we use the real classLoader in place of the getNewTempClassLoader().
|
java.lang.String |
getPartitionID()
INTERNAL: Get Partition ID.
|
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.
|
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. 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 |
usesPartitions()
INTERNAL: Some servers may support partitioning
|
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
protected boolean shouldRegisterDevelopmentBean
protected boolean shouldRegisterRuntimeBean
protected java.lang.Class externalTransactionControllerClass
protected java.lang.String serverNameAndVersion
protected int threadPoolSize
protected volatile java.util.concurrent.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 ServerPlatform
public java.lang.String getServerNameAndVersion()
getServerNameAndVersion
in interface ServerPlatform
protected void initializeServerNameAndVersion()
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
protected void externalTransactionControllerNotNullWarning()
getExternalTransactionControllerClass()
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:
- the instance of runnable to be "started"protected void ensureNotLoggedIn()
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(PersistenceUnitInfo puInfo)
ServerPlatform
getNewTempClassLoader
in interface ServerPlatform
puInfo
- - the persistence unit infoJPAClassLoaderHolder
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()
public int getJNDIConnectorLookupType()
ServerPlatform
getJNDIConnectorLookupType
in interface ServerPlatform
public java.lang.String getPartitionID()
ServerPlatform
getPartitionID
in interface ServerPlatform
public boolean usesPartitions()
ServerPlatform
usesPartitions
in interface ServerPlatform