Package org.eclipse.persistence.services
Class RuntimeServices
java.lang.Object
org.eclipse.persistence.services.RuntimeServices
- Direct Known Subclasses:
GlassfishRuntimeServices
,JBossRuntimeServices
,MBeanRuntimeServices
,WebLogicRuntimeServices
,WebSphereRuntimeServices
Purpose: Provide a dynamic interface into the EclipseLink Session.
Description: This class is meant to provide a framework for gaining access to configuration of the EclipseLink Session during runtime. It will provide the basis for development of a JMX service and possibly other frameworks.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addNewConnectionPool
(String poolName, int maxSize, int minSize, String platform, String driverClassName, String url, String userName, String password) This method provides client with access to add a new connection pool to a EclipseLink ServerSession.void
Used to clear the statement cache.getApplicationName(): Answer the name of the module (EAR name) that this session is associated with.This method will return the available Connection pools within this Server Sessionprotected String
getCacheTypeFor
(Class identityMapClass) INTERNAL: getCacheTypeFor: Give a more UI-friendly version of the cache typeThis method is used to return those Class Names that have identity Maps in the Session.Object[][]
PUBLIC: Provide an instance of 2 Dimensional Array simulating tabular format information about all classes in the session.Provide a list of instance of ClassSummaryDetail containing information about all classes in the session.Object[][]
Provide an instance of 2 Dimensional Array simulating tabular format information about all classes in the session whose class names match the provided filter.Provide a list of instance of ClassSummaryDetail containing information about the classes in the session whose class names match the provided filter.Return connection pool type.PUBLIC: Answer the EclipseLink log level that is changeable.Return the database platform used by the DatabaseSession.PUBLIC: Answer the EclipseLink log level at deployment time.int
Return db driver class name.Return JDBCConnection detail information.Return the log filename.int
getLogLevel
(String category) Return the log levelReturn the log type, either "EclipseLink", "Java" or the simple name of the logging class used.getMappedClassNamesUsingFilter
(String filter) INTERNAL: This method traverses the EclipseLink descriptors and returns a Vector of the descriptor's reference class names that match the provided filter.getMaxSizeForPool
(String poolName) This method will retrieve the max size of a particular connection poolgetMinSizeForPool
(String poolName) This method will retrieve the min size of a particular connection poolgetModuleName(): Answer the name of the context-root of the application that this session is associated with.This method will SUM and return the number of objects in all Identity Maps in the session.getNumberOfObjectsInIdentityMap
(String className) This method is used to return the number of objects in a particular Identity MapgetNumberOfObjectsInIdentityMapSubCache
(String className) This method is used to return the number of objects in a particular Identity Map's subcache.This method will answer the number of persistent classes contained in the session.getObjectsInIdentityMap
(String className) This method will return a collection of the objects in the Identity Map.getObjectsInIdentityMapSubCacheAsMap
(String className) This method is used to return a Map of the objects in a particular Identity Map's subcache.int
Return the DMS sensor weightThis method is used to get the type of profiling.int
Method returns the value of the Sequence Preallocation sizeprotected org.eclipse.persistence.internal.sessions.AbstractSession
INTERNAL:Answer the name of the EclipseLink session this MBean represents.Answer the type of the EclipseLink session this MBean represents.Method returns if all Parameters should be bound or notboolean
Returns if statements should be cached or notboolean
This method is used to determine if logging is turned onboolean
Method indicates if Performance profile should be loggedboolean
This method will return if profiling is turned on or notgetSizeForPool
(String poolName) This method will retrieve the size of a particular connection poolint
Returns the statement cache size.Return the size of strings after which will be bound into the statement If we are not using a DatabaseLogin, or we're not using string binding, answer 0 (zero).This method will return a long indicating the exact time in Milliseconds that the session connected to the database.This method will return if batchWriting is in use or not.Shows if Byte Array Binding is turned on or notThis method answers true if EclipseLink Performance Profiling is on.This method will return if batchWriting is in use or not.Shows if native SQL is being usedThis method indicates if streams are being used for bindingThis method indicates if Strings are being boundvoid
This method is used to initialize the identity maps in the session.void
initializeIdentityMap
(String className) This method is used to initialize the identity maps specified by className.void
initializeIdentityMaps
(String[] classNames) This method is used to initialize the identity maps specified by the Vector of classNames.void
This method is used to invalidate the identity maps in the session.void
invalidateIdentityMap
(String className) This method is used to invalidate the identity maps specified by className.void
invalidateIdentityMap
(String className, Boolean recurse) This method is used to invalidate the identity maps specified by className.void
invalidateIdentityMaps
(String[] classNamesParam, Boolean recurse) This method is used to invalidate the identity maps specified by the String[] of classNames.boolean
Return whether this session is an EclipseLink JPA session.void
This method will log the types of Identity Maps in the session.void
This method will print the available Connection pools to the SessionLog.void
This method is used to output those Class Names that have identity Maps in the Session.void
This method will log the instance level locks in all Identity Maps in the session.void
printIdentityMapLocks
(String registeredClassName) This method will log the instance level locks in the Identity Map for the given class in the session.void
printObjectsInIdentityMap
(String className) This method will log the objects in the Identity Map.void
This method will log all objects in all Identity Maps in the session.void
This method assumes EclipseLink Profiling (as opposed to Java profiling).void
This method assumes EclipseLink Profiling (as opposed to Java profiling).void
This method assumes EclipseLink Profiling (as opposed to Java profiling).void
This method is used to reset connections from the session to the database.void
setCurrentEclipseLinkLogLevel
(String newLevel) PUBLIC: Set the EclipseLink log level to be used at runtime.void
setLogLevel
(int level) Set the log levelvoid
setProfileWeight
(int weight) This method is used to change DMS sensor weight.void
setProfilingType
(String profileType) This method is used to select the type of profiling.void
setSequencePreallocationSize
(int size) This method provide access for setting the sequence pre-allocation sizeprotected void
setSession
(org.eclipse.persistence.internal.sessions.AbstractSession newSession) INTERNAL: Define the session that this instance is providing runtime services forvoid
setShouldCacheAllStatements
(boolean shouldCacheAllStatements) Method used to set if statements should be cached.void
setShouldLogPerformanceProfiler
(boolean shouldLogPerformanceProfiler) This method is used to turn on Profile logging when using the Performance Profilervoid
setShouldProfilePerformance
(boolean shouldProfile) This method is used to turn on Performance Profilingvoid
setStatementCacheSize
(int size) Used to set the statement cache size.void
This method is used to turn on EclipseLink Performance Profilingvoid
This method is used to turn off all Performance Profiling, DMS or EclipseLink.boolean
Check if a message of the given level would actually be logged.protected void
INTERNAL: Define the deployment time data associated with logging and profilingvoid
updatePoolSize
(String poolName, int maxSize, int minSize) This method allows the client to set the pool size for a particular pool, based on the pool name
-
Field Details
-
session
stores access to the session object that we are controlling -
objectName
-
EclipseLink_Product_Name
- See Also:
-
PLATFORM_NAME
Short name for the server platform - Must override in subclass
-
-
Constructor Details
-
RuntimeServices
public RuntimeServices()Default Constructor -
RuntimeServices
Constructor- Parameters:
session
- the session to be used with these RuntimeServices
-
-
Method Details
-
getSession
protected org.eclipse.persistence.internal.sessions.AbstractSession getSession()INTERNAL: -
getSessionName
Answer the name of the EclipseLink session this MBean represents. -
getShouldLogMessages
public boolean getShouldLogMessages()This method is used to determine if logging is turned on -
setShouldProfilePerformance
public void setShouldProfilePerformance(boolean shouldProfile) This method is used to turn on Performance Profiling -
getShouldProfilePerformance
public boolean getShouldProfilePerformance()This method will return if profiling is turned on or not -
setShouldLogPerformanceProfiler
public void setShouldLogPerformanceProfiler(boolean shouldLogPerformanceProfiler) This method is used to turn on Profile logging when using the Performance Profiler -
getShouldLogPerformanceProfiler
public boolean getShouldLogPerformanceProfiler()Method indicates if Performance profile should be logged -
setShouldCacheAllStatements
public void setShouldCacheAllStatements(boolean shouldCacheAllStatements) Method used to set if statements should be cached. Please note that Statements can not be cached when using an external connection pool -
setStatementCacheSize
public void setStatementCacheSize(int size) Used to set the statement cache size. This is only valid if using cached Statements -
getStatementCacheSize
public int getStatementCacheSize()Returns the statement cache size. Only valid if statements are being cached -
setSequencePreallocationSize
public void setSequencePreallocationSize(int size) This method provide access for setting the sequence pre-allocation size -
getSequencePreallocationSize
public int getSequencePreallocationSize()Method returns the value of the Sequence Preallocation size -
updatePoolSize
This method allows the client to set the pool size for a particular pool, based on the pool name- Parameters:
poolName
- the name of the pool to be updated.maxSize
- the new maximum number of connectionsminSize
- the new minimum number of connections
-
getAvailableConnectionPools
This method will return the available Connection pools within this Server Session- Returns:
- java.util.List the available pools.
-
getSizeForPool
This method will retrieve the size of a particular connection pool- Parameters:
poolName
- the name of the pool to get the size for- Returns:
- java.util.List a list containing two values. The first value is the Maximun size of the pool. The second value is the Minimum size of the pool.
-
addNewConnectionPool
public void addNewConnectionPool(String poolName, int maxSize, int minSize, String platform, String driverClassName, String url, String userName, String password) throws ClassNotFoundException This method provides client with access to add a new connection pool to a EclipseLink ServerSession.- Parameters:
poolName
- the name of the new poolmaxSize
- the maximum number of connections in the poolminSize
- the minimum number of connections in the poolplatform
- the fully qualified name of the EclipseLink platform to use with this pool.driverClassName
- the fully qualified name of the JDBC driver classurl
- the URL of the database to connect touserName
- the user name to connect to the database withpassword
- the password to connect to the database with- Throws:
ClassNotFoundException
- if any of the class names are misspelled.
-
resetAllConnections
public void resetAllConnections()This method is used to reset connections from the session to the database. Please Note that this will not work with a SessionBroker at this time -
getClassesInSession
This method is used to return those Class Names that have identity Maps in the Session. Please note that SubClasses and aggregates will be missing form this list as they do not have separate identity maps.- Returns:
- java.util.List contains all of the classes which have identity maps in the current session.
-
getObjectsInIdentityMap
This method will return a collection of the objects in the Identity Map. There is no particular order to these objects.- Parameters:
className
- the fully qualified classname of the class to the instances of- Throws:
ClassNotFoundException
- thrown then the IdentityMap for that class name could not be found
-
getNumberOfObjectsInIdentityMap
This method is used to return the number of objects in a particular Identity Map- Parameters:
className
- the fully qualified name of the class to get number of instances of.- Throws:
ClassNotFoundException
- thrown then the IdentityMap for that class name could not be found
-
getObjectsInIdentityMapSubCacheAsMap
This method is used to return a Map of the objects in a particular Identity Map's subcache. Only works for those identity Maps with a sub cache (ie Hard Cache Weak Identity Map) This method replaces getObjectsInIdentityMapSubCache(className) which returns a list instead of a Map- Parameters:
className
- the fully qualified name of the class to get number of instances of.- Throws:
ClassNotFoundException
- thrown then the IdentityMap for that class name could not be found
-
getNumberOfObjectsInIdentityMapSubCache
public Integer getNumberOfObjectsInIdentityMapSubCache(String className) throws ClassNotFoundException This method is used to return the number of objects in a particular Identity Map's subcache. Only works for those identity Maps with a sub cache (ie Hard Cache Weak Identity Map)- Parameters:
className
- the fully qualified name of the class to get number of instances of.- Throws:
ClassNotFoundException
- thrown then the IdentityMap for that class name could not be found
-
getLogLevel
Return the log level
- Parameters:
category
- the string representation of an EclipseLink category, e.g. "sql", "transaction" ...- Returns:
- the log level
-
setLogLevel
public void setLogLevel(int level) Set the log level
- Parameters:
level
- the new log level
-
shouldLog
Check if a message of the given level would actually be logged.
- Parameters:
Level
- the log request levelcategory
- the string representation of an EclipseLink category- Returns:
- true if the given message level will be logged
-
getProfileWeight
public int getProfileWeight()Return the DMS sensor weight- Returns:
-
setProfileWeight
public void setProfileWeight(int weight) This method is used to change DMS sensor weight. -
initializeIdentityMap
This method is used to initialize the identity maps specified by className.- Parameters:
className
- the fully qualified classnames identifying the identity map to initialize- Throws:
ClassNotFoundException
-
printIdentityMapLocks
public void printIdentityMapLocks()This method will log the instance level locks in all Identity Maps in the session. -
printIdentityMapLocks
This method will log the instance level locks in the Identity Map for the given class in the session. -
printProfileSummary
public void printProfileSummary()This method assumes EclipseLink Profiling (as opposed to Java profiling). This will log at the INFO level a summary of all elements in the profile. -
printProfileSummaryByClass
public void printProfileSummaryByClass()This method assumes EclipseLink Profiling (as opposed to Java profiling). This will log at the INFO level a summary of all elements in the profile, categorized by Class. -
printProfileSummaryByQuery
public void printProfileSummaryByQuery()This method assumes EclipseLink Profiling (as opposed to Java profiling). This will log at the INFO level a summary of all elements in the profile, categorized by Query. -
getProfilingType
This method is used to get the type of profiling. Possible values are: "EclipseLink" or "None". -
setProfilingType
This method is used to select the type of profiling. Valid values are: "EclipseLink" or "None". These values are not case sensitive. null is considered to be "None". -
setUseEclipseLinkProfiling
public void setUseEclipseLinkProfiling()This method is used to turn on EclipseLink Performance Profiling -
setUseNoProfiling
public void setUseNoProfiling()This method is used to turn off all Performance Profiling, DMS or EclipseLink. -
getUsesEclipseLinkProfiling
This method answers true if EclipseLink Performance Profiling is on. -
getDeployedEclipseLinkLogLevel
PUBLIC: Answer the EclipseLink log level at deployment time. This is read-only. -
getCurrentEclipseLinkLogLevel
PUBLIC: Answer the EclipseLink log level that is changeable. This does not affect the log level in the project (i.e. The next time the application is deployed, changes are forgotten) -
setCurrentEclipseLinkLogLevel
PUBLIC: Set the EclipseLink log level to be used at runtime. This does not affect the log level in the project (i.e. The next time the application is deployed, changes are forgotten)- Parameters:
newLevel
- new log level
-
updateDeploymentTimeData
protected void updateDeploymentTimeData()INTERNAL: Define the deployment time data associated with logging and profiling -
getDeployedSessionProfileWeight
public int getDeployedSessionProfileWeight() -
getDeployedSessionLog
-
getObjectName
-
isJPASession
public boolean isJPASession()Return whether this session is an EclipseLink JPA session. The absence of this function or a value of false will signify that the session belongs to a provider other than EclipseLink.- Returns:
-
getSessionType
Answer the type of the EclipseLink session this MBean represents. Types include: "ServerSession", "DatabaseSession", "SessionBroker" -
getClassSummaryDetailsUsingFilter
Provide an instance of 2 Dimensional Array simulating tabular format information about all classes in the session whose class names match the provided filter. The 2 Dimensional array contains each item with values being row object array. Each row object array represents EclipseLink class details info with respect to below attributes: ["Class Name", "Parent Class Name", "Cache Type", "Configured Size", "Current Size"] -
getClassSummaryDetails
PUBLIC: Provide an instance of 2 Dimensional Array simulating tabular format information about all classes in the session. The 2 Dimensional array contains each item with values being row object array. Each row object array represents EclipseLink class details info with respect to below attributes: ["Class Name", "Parent Class Name", "Cache Type", "Configured Size", "Current Size"] -
getMappedClassNamesUsingFilter
INTERNAL: This method traverses the EclipseLink descriptors and returns a Vector of the descriptor's reference class names that match the provided filter. The filter is a comma separated list of strings to match against.- Parameters:
filter
- A comma separated list of strings to match against.- Returns:
- A Vector of class names that match the filter.
-
getCacheTypeFor
INTERNAL: getCacheTypeFor: Give a more UI-friendly version of the cache type -
getModuleName
getModuleName(): Answer the name of the context-root of the application that this session is associated with. Answer "unknown" if there is no module name available. Default behavior is to return "unknown" - we override this behavior here for WebLogic. -
getApplicationName
getApplicationName(): Answer the name of the module (EAR name) that this session is associated with. Answer "unknown" if there is no application name available. Default behavior is to return "unknown" - we override this behavior here for all platform implementors of JMXEnabledPlatform -
getShouldBindAllParameters
Method returns if all Parameters should be bound or not -
getStringBindingSize
Return the size of strings after which will be bound into the statement If we are not using a DatabaseLogin, or we're not using string binding, answer 0 (zero). -
getUsesBatchWriting
This method will return if batchWriting is in use or not. -
getTimeConnectionEstablished
This method will return a long indicating the exact time in Milliseconds that the session connected to the database. -
getUsesJDBCBatchWriting
This method will return if batchWriting is in use or not. -
getUsesByteArrayBinding
Shows if Byte Array Binding is turned on or not -
getUsesNativeSQL
Shows if native SQL is being used -
getUsesStreamsForBinding
This method indicates if streams are being used for binding -
getUsesStringBinding
This method indicates if Strings are being bound -
getShouldCacheAllStatements
public boolean getShouldCacheAllStatements()Returns if statements should be cached or not -
clearStatementCache
public void clearStatementCache()Used to clear the statement cache. Only valid if statements are being cached -
printAvailableConnectionPools
public void printAvailableConnectionPools()This method will print the available Connection pools to the SessionLog. -
getMaxSizeForPool
This method will retrieve the max size of a particular connection pool- Parameters:
poolName
- the name of the pool to get the max size for- Returns:
- Integer for the max size of the pool. Return -1 if pool doesn't exist.
-
getMinSizeForPool
This method will retrieve the min size of a particular connection pool- Parameters:
poolName
- the name of the pool to get the min size for- Returns:
- Integer for the min size of the pool. Return -1 if pool doesn't exist.
-
printClassesInSession
public void printClassesInSession()This method is used to output those Class Names that have identity Maps in the Session. Please note that SubClasses and aggregates will be missing from this list as they do not have separate identity maps. -
printObjectsInIdentityMap
This method will log the objects in the Identity Map. There is no particular order to these objects.- Parameters:
className
- the fully qualified classname identifying the identity map- Throws:
ClassNotFoundException
- thrown then the IdentityMap for that class name could not be found
-
printAllIdentityMapTypes
public void printAllIdentityMapTypes()This method will log the types of Identity Maps in the session. -
printObjectsInIdentityMaps
public void printObjectsInIdentityMaps()This method will log all objects in all Identity Maps in the session. -
getNumberOfObjectsInAllIdentityMaps
This method will SUM and return the number of objects in all Identity Maps in the session. -
getNumberOfPersistentClasses
This method will answer the number of persistent classes contained in the session. This does not include aggregates. -
getLogType
Return the log type, either "EclipseLink", "Java" or the simple name of the logging class used.- Returns:
- the log type
-
getDatabasePlatform
Return the database platform used by the DatabaseSession.- Returns:
- String databasePlatform
-
getJdbcConnectionDetails
Return JDBCConnection detail information. This includes URL and datasource information. -
getConnectionPoolType
Return connection pool type. Values include: "Internal", "External" and "N/A". -
getDriver
Return db driver class name. This only applies to DefaultConnector. Return "N/A" otherwise. -
getLogFilename
Return the log filename. This returns the fully qualified path of the log file when EclipseLink DefaultSessionLog instance is used. Null is returned otherwise.- Returns:
- String logFilename
-
initializeAllIdentityMaps
public void initializeAllIdentityMaps()This method is used to initialize the identity maps in the session. -
initializeIdentityMaps
This method is used to initialize the identity maps specified by the Vector of classNames.- Parameters:
classNames
- String[] of fully qualified classnames identifying the identity maps to initialize- Throws:
ClassNotFoundException
-
invalidateAllIdentityMaps
public void invalidateAllIdentityMaps()This method is used to invalidate the identity maps in the session. -
invalidateIdentityMaps
public void invalidateIdentityMaps(String[] classNamesParam, Boolean recurse) throws ClassNotFoundException This method is used to invalidate the identity maps specified by the String[] of classNames.- Parameters:
classNamesParam
- String[] of fully qualified classnames identifying the identity maps to invalidaterecurse
- Boolean indicating if we want to invalidate the children identity maps too- Throws:
ClassNotFoundException
-
invalidateIdentityMap
This method is used to invalidate the identity maps specified by className. This does not invalidate the children identity maps- Parameters:
className
- the fully qualified classname identifying the identity map to invalidate- Throws:
ClassNotFoundException
-
invalidateIdentityMap
This method is used to invalidate the identity maps specified by className.- Parameters:
className
- the fully qualified classname identifying the identity map to invalidaterecurse
- Boolean indicating if we want to invalidate the children identity maps too- Throws:
ClassNotFoundException
-
setSession
protected void setSession(org.eclipse.persistence.internal.sessions.AbstractSession newSession) INTERNAL: Define the session that this instance is providing runtime services for- Parameters:
newSession
- The session to be used with these RuntimeServices
-
getClassSummaryDetailsUsingFilterArray
Provide a list of instance of ClassSummaryDetail containing information about the classes in the session whose class names match the provided filter. ClassSummaryDetail is a model specific class that can be used internally by the Portable JMX Framework to convert class attribute to JMX required open type, it has:- 1. model specific type that needs to be converted : ["Class Name", "Parent Class Name", "Cache Type", "Configured Size", "Current Size"] 2. convert methods.- Parameters:
filter
- A comma separated list of strings to match against.- Returns:
- A ArrayList of instance of ClassSummaryDetail containing class information for the class names that match the filter.
-
getClassSummaryDetailsArray
Provide a list of instance of ClassSummaryDetail containing information about all classes in the session. ClassSummaryDetail is a model specific class that can be used internally by the Portable JMX Framework to convert class attribute to JMX required open type, it has:- 1. model specific type that needs to be converted : ["Class Name", "Parent Class Name", "Cache Type", "Configured Size", "Current Size"] 2. convert methods.- Returns:
- A List of instance of ClassSummaryDetail objects containing class information for the class names that match the filter.
-