Class Application
java.lang.Object
ortus.boxlang.runtime.application.Application
I represent an Application in BoxLang
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildAppCacheKey(Key cacheName) Build a cache key for the applicationGet the scope for this applicationgetClassLoader(String loaderKey) Get a class loader by cache keylongCount how many class loaders we have loadedGet the application's class loadersgetName()Get the name of this applicationgetOrCreateSession(Key ID, RequestBoxContext context) Get a session by ID for this application, creating if neccessary if not foundlongHow many sessions are currently trackedReturn the sessions cache objectGet starting listenerGet the start time of the applicationbooleanhasClassLoader(String loaderKey) Verify if the class loader exists by cache keybooleanCheck if the application is runningbooleanHas this application expired.voidrestart(IBoxContext context) Restart this applicationvoidshutdown(boolean force) Shutdown this applicationstart(IBoxContext context) Start the application if not already started.voidstartupAppCaches(RequestBoxContext requestContext) Startup the application caches if any are defined in the settings of the Application.bxvoidstartupAppSchedulers(RequestBoxContext requestContext) Startup the application schedulers if any are defined in the settings of the Application.bxvoidstartupClassLoaderPaths(RequestBoxContext requestContext) Startup the class loader paths from the this.javaSettings.loadPaths
-
Field Details
-
cacheService
The cache service helper
-
-
Constructor Details
-
Application
Constructor- Parameters:
name- The name of the application
-
-
Method Details
-
getClassLoaders
Get the application's class loaders- Returns:
- The class loader map
-
hasClassLoader
Verify if the class loader exists by cache key- Parameters:
loaderKey- The key of the class loader
-
getClassLoader
Get a class loader by cache key- Parameters:
loaderKey- The key of the class loader- Returns:
- The class loader
-
getClassLoaderCount
public long getClassLoaderCount()Count how many class loaders we have loaded -
startupClassLoaderPaths
Startup the class loader paths from the this.javaSettings.loadPaths- Parameters:
requestContext- The request context
-
getStartingListener
Get starting listener- Returns:
- The starting listener
-
start
Start the application if not already started. The sequence of events is: 1. The application start times are recorded and the application is marked as started 2. The application listener is set 3. The class loader paths are set 4. The session storage is set 5. The application is announced to the interceptor service (onApplicationStart) 6. The application listener is called (onApplicationStart)- Parameters:
context- The context starting up the application- Returns:
- The started application
-
startupAppCaches
Startup the application caches if any are defined in the settings of the Application.bxthis.caches = { myCache = { provider = "memory", properties = { // Cache properties maxObjects = 1000, // Default timeout defaultTimeout = 3600, // Default last access timeout defaultLastAccessTimeout = 3600, // Eviction policy evictionPolicy = "LRU" } } }- Parameters:
requestContext- The request context
-
startupAppSchedulers
Startup the application schedulers if any are defined in the settings of the Application.bxthis.schedulers = [ "path.to.Scheduler", "another.Scheduler" ]
- Parameters:
requestContext- The request context
-
buildAppCacheKey
Build a cache key for the application- Parameters:
cacheName- The name of the cache- Returns:
- The cache key for the application
-
getOrCreateSession
Get a session by ID for this application, creating if neccessary if not found- Parameters:
ID- The ID of the sessioncontext- The context of the request that is creating/getting the session- Returns:
- The session object
-
getSessionCount
public long getSessionCount()How many sessions are currently tracked -
getSessionsCache
Return the sessions cache object- Returns:
-
getApplicationScope
Get the scope for this application- Returns:
- The scope
-
getName
Get the name of this application- Returns:
- The name
-
getStartTime
Get the start time of the application- Returns:
- the application start time, or null if not started
-
isExpired
public boolean isExpired()Has this application expired. We look at the application start time and the application timeout to determine if it has expired- Returns:
- True if the application has expired, false otherwise
-
hasStarted
public boolean hasStarted()Check if the application is running- Returns:
- True if the application is running
-
restart
Restart this application -
shutdown
public void shutdown(boolean force) Shutdown this application- Parameters:
force- If true, forces the shutdown of the scheduler
-