Package org.nuxeo.runtime.reload
Class ReloadComponent
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.runtime.reload.ReloadComponent
- All Implemented Interfaces:
Adaptable
,Component
,Extensible
,ReloadService
,TimestampedService
- Author:
- Bogdan Stefanescu
-
Field Summary
Modifier and TypeFieldDescriptionprotected static org.osgi.framework.Bundle
protected Long
static final String
The reload strategy to adopt for hot reload.static final String
static final String
static final String
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
Fields inherited from interface org.nuxeo.runtime.reload.ReloadService
AFTER_RELOAD_EVENT_ID, BEFORE_RELOAD_EVENT_ID, FLUSH_EVENT_ID, FLUSH_SEAM_EVENT_ID, RELOAD_EVENT_ID, RELOAD_SEAM_EVENT_ID, RELOAD_TOPIC
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(ComponentContext context) Activates the component.protected void
clearJarFileFactoryCache
(ReloadResult result) copyBundlesToDeploy
(ReloadContext context) protected void
Method copied from commons-io:commons-io:2.6 to handle replace if exist on Windows.void
deactivate
(ComponentContext context) Deactivates the component.protected ReloadResult
deployBundles
(List<File> bundlesToDeploy) void
flush()
Sends a runtime event with idReloadService.FLUSH_EVENT_ID
so that listeners can be notified that a flush is needed (after a reload for instance).void
Sends an event that can trigger reset of JaasCache.void
Sends a runtime event with idReloadService.FLUSH_SEAM_EVENT_ID
.protected static File
static org.osgi.framework.Bundle
static org.osgi.framework.BundleContext
getOSGIBundleName
(File file) Returns the OSGI bundle name if given file can be identified as an OSGI bundle, or null.protected static File
Returns the last time one of the flush commands where called on this service instance (ReloadService.flush()
orReloadService.flushJaasCache()
orReloadService.flushSeamComponents()
, or null if never called.protected void
Logs theComponentManager
status.void
reload()
Sends a runtime event with idReloadService.RELOAD_EVENT_ID
so that listeners can be notified that a reload has been done.reloadBundles
(ReloadContext context) Called by ReloadServiceInvoker#hotReloadBundles.void
Reloads runtime framework propertiesvoid
Sends a runtime event with idReloadService.RELOAD_SEAM_EVENT_ID
void
Runs the deployment preprocessor.protected void
Sets the last date date to current date timestampprotected URL
protected URL
toURL
(org.osgi.framework.Bundle bundle) This method needs to be called before bundle uninstallation, otherwiseBundle.getLocation()
throw a NPE.protected void
triggerReload
(String eventId) protected void
triggerReloadWithNewTransaction
(String eventId) protected ReloadResult
undeployBundles
(List<String> bundleNames) Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterContribution, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
Methods inherited from interface org.nuxeo.runtime.service.TimestampedService
getLastModified, setLastModified
-
Field Details
-
RELOAD_STRATEGY_PARAMETER
The reload strategy to adopt for hot reload. Default value isRELOAD_STRATEGY_VALUE_DEFAULT
.- Since:
- 9.3
- See Also:
-
RELOAD_STRATEGY_VALUE_STANDBY
- See Also:
-
RELOAD_STRATEGY_VALUE_RESTART
- See Also:
-
RELOAD_STRATEGY_VALUE_DEFAULT
- See Also:
-
bundle
protected static org.osgi.framework.Bundle bundle -
lastFlushed
-
-
Constructor Details
-
ReloadComponent
public ReloadComponent()
-
-
Method Details
-
getBundleContext
public static org.osgi.framework.BundleContext getBundleContext() -
getBundle
public static org.osgi.framework.Bundle getBundle() -
activate
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
deactivate
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
reload
public void reload()Description copied from interface:ReloadService
Sends a runtime event with idReloadService.RELOAD_EVENT_ID
so that listeners can be notified that a reload has been done.Also calls
ReloadService.reloadProperties()
by default, but not other reload methods as they could alter the running application behaviour.- Specified by:
reload
in interfaceReloadService
- See Also:
-
reloadProperties
Description copied from interface:ReloadService
Reloads runtime framework properties- Specified by:
reloadProperties
in interfaceReloadService
- Throws:
IOException
-
reloadSeamComponents
public void reloadSeamComponents()Description copied from interface:ReloadService
Sends a runtime event with idReloadService.RELOAD_SEAM_EVENT_ID
- Specified by:
reloadSeamComponents
in interfaceReloadService
-
flush
public void flush()Description copied from interface:ReloadService
Sends a runtime event with idReloadService.FLUSH_EVENT_ID
so that listeners can be notified that a flush is needed (after a reload for instance).Also calls
ReloadService.flushJaasCache()
by default, but not other flush methods as they could alter the running application behaviour.- Specified by:
flush
in interfaceReloadService
- See Also:
-
flushJaasCache
public void flushJaasCache()Description copied from interface:ReloadService
Sends an event that can trigger reset of JaasCache.- Specified by:
flushJaasCache
in interfaceReloadService
-
flushSeamComponents
public void flushSeamComponents()Description copied from interface:ReloadService
Sends a runtime event with idReloadService.FLUSH_SEAM_EVENT_ID
.- Specified by:
flushSeamComponents
in interfaceReloadService
-
reloadBundles
Description copied from interface:ReloadService
Called by ReloadServiceInvoker#hotReloadBundles.- Specified by:
reloadBundles
in interfaceReloadService
- Returns:
- the result of hot reload operation
- Throws:
org.osgi.framework.BundleException
-
copyBundlesToDeploy
protected List<File> copyBundlesToDeploy(ReloadContext context) throws org.osgi.framework.BundleException - Throws:
org.osgi.framework.BundleException
-
copyFile
Method copied from commons-io:commons-io:2.6 to handle replace if exist on Windows.- Throws:
IOException
- Since:
- 2021.19
-
deployBundles
protected ReloadResult deployBundles(List<File> bundlesToDeploy) throws org.osgi.framework.BundleException - Throws:
org.osgi.framework.BundleException
-
undeployBundles
protected ReloadResult undeployBundles(List<String> bundleNames) throws org.osgi.framework.BundleException - Throws:
org.osgi.framework.BundleException
-
clearJarFileFactoryCache
-
toURL
This method needs to be called before bundle uninstallation, otherwiseBundle.getLocation()
throw a NPE. -
toURL
-
logComponentManagerStatus
protected void logComponentManagerStatus()Logs theComponentManager
status. -
lastFlushed
Description copied from interface:ReloadService
Returns the last time one of the flush commands where called on this service instance (ReloadService.flush()
orReloadService.flushJaasCache()
orReloadService.flushSeamComponents()
, or null if never called.- Specified by:
lastFlushed
in interfaceReloadService
-
setFlushedNow
protected void setFlushedNow()Sets the last date date to current date timestamp- Since:
- 5.6
-
runDeploymentPreprocessor
Description copied from interface:ReloadService
Runs the deployment preprocessor.- Specified by:
runDeploymentPreprocessor
in interfaceReloadService
- Throws:
IOException
- See Also:
-
getAppDir
-
getWarDir
-
getOSGIBundleName
Description copied from interface:ReloadService
Returns the OSGI bundle name if given file can be identified as an OSGI bundle, or null. The OSGI bundle can be a jar or an exploded jar on file system.- Specified by:
getOSGIBundleName
in interfaceReloadService
-
triggerReloadWithNewTransaction
-
triggerReload
-