Package lumis.portal.monitor
Class MonitorHelper
- java.lang.Object
-
- lumis.portal.monitor.MonitorHelper
-
- All Implemented Interfaces:
AutoCloseable
public class MonitorHelper extends Object implements AutoCloseable
Monitor helper class responsible for providing an easy way to add and remove values in the currentIMonitorContext
.
The basic usage for this class is:
try(MonitorHelper monitorHelper = new MonitorHelper()) { monitorHelper.addWebResourceValues(myWebResource); // for example // do things with web resource values in monitor context } // at this point, web resource values are not in context any more
If a more granular control is required, a block like this can be made:
try(MonitorHelper monitorHelper = new MonitorHelper()) { monitorHelper.addWebResourceValues(myWebResource); // for example // do things with web resource values in monitor context IMonitorValuesProvider myServiceInstanceValueProvider = monitorHelper.addServiceInstanceValues(String serviceInstanceId); // for example // do things with service instance in monitor context monitorHelper.removeAddedValues(myServiceInstanceValueProvider); // no needed to be performed in try-finally because the monitor helper will auto remove all values in #close() // at this point service instance values are not in monitor context any more } // at this point, web resource values are not in context any more
Each instance of this class must be used only in the thread it was created.- Since:
- 9.0.0
- Version:
- $Revision: 23034 $ $Date: 2019-08-05 16:52:47 -0300 (Mon, 05 Aug 2019) $
-
-
Constructor Summary
Constructors Constructor Description MonitorHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IMonitorValuesProvider
addMonitorUserValuesByTrackId(String trackId)
Adds a value provider related toMonitorUser
with the given track identifier.IMonitorValuesProvider
addMonitorUserValuesByUserId(String userId)
Adds a value provider related toMonitorUser
with the given user identifier.IMonitorValuesProvider
addServerValues()
Add a value provider related to the server.IMonitorValuesProvider
addServiceInstanceValues(String serviceInstanceId)
Add a value provider related to the given service instance.IMonitorValuesProvider
addServiceInstanceValues(ServiceInstanceConfig serviceInstanceConfig)
Add a value provider related to the given service instance.IMonitorValuesProvider
addServiceInterfaceInstanceValues(ServiceInterfaceInstanceConfig serviceInterfaceInstanceConfig)
Add a value provider related to the given interface instance.IMonitorValuesProvider
addServiceValues(String serviceId)
Add a value provider related to the given service.IMonitorValuesProvider
addSessionValues(SessionConfig sessionConfig, HttpSession httpSession)
Adds a value provider related toSessionConfig
andHttpSession
.void
addValues(IMonitorValuesProvider valuesProvider)
Adds the given provider in the context.IMonitorValuesProvider
addWebResourceValues(WebResource webResource)
Add a value provider related to the given web resource.void
close()
void
removeAddedValues(IMonitorValuesProvider provider)
Removes the given provider from context.
-
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
removeAddedValues
public void removeAddedValues(IMonitorValuesProvider provider)
Removes the given provider from context.- Parameters:
provider
- the provider.- Since:
- 9.0.0
-
addValues
public void addValues(IMonitorValuesProvider valuesProvider)
Adds the given provider in the context.- Parameters:
valuesProvider
- the provider.- Since:
- 9.0.0
-
addWebResourceValues
public IMonitorValuesProvider addWebResourceValues(WebResource webResource)
Add a value provider related to the given web resource.- Parameters:
webResource
- the web resource.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServiceInstanceValues
public IMonitorValuesProvider addServiceInstanceValues(ServiceInstanceConfig serviceInstanceConfig)
Add a value provider related to the given service instance.- Parameters:
serviceInstanceConfig
- the service instance.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServiceInstanceValues
public IMonitorValuesProvider addServiceInstanceValues(String serviceInstanceId)
Add a value provider related to the given service instance.- Parameters:
serviceInstanceId
- the service instance identifier.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServerValues
public IMonitorValuesProvider addServerValues()
Add a value provider related to the server.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServiceValues
public IMonitorValuesProvider addServiceValues(String serviceId)
Add a value provider related to the given service.- Parameters:
serviceId
- the service identifier.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addServiceInterfaceInstanceValues
public IMonitorValuesProvider addServiceInterfaceInstanceValues(ServiceInterfaceInstanceConfig serviceInterfaceInstanceConfig)
Add a value provider related to the given interface instance.- Parameters:
serviceInterfaceInstanceConfig
- the interface instance.- Returns:
- the created values provider.
- Since:
- 9.0.0
-
addSessionValues
public IMonitorValuesProvider addSessionValues(SessionConfig sessionConfig, HttpSession httpSession) throws PortalException
Adds a value provider related toSessionConfig
andHttpSession
.- Parameters:
sessionConfig
- the LumisXP user session.httpSession
- the application server http session.- Returns:
- the created values provider.
- Throws:
PortalException
- Since:
- 11.0.0
-
addMonitorUserValuesByUserId
public IMonitorValuesProvider addMonitorUserValuesByUserId(String userId)
Adds a value provider related toMonitorUser
with the given user identifier.- Parameters:
userId
- the monitor user identifier.- Returns:
- the created values provider.
- Since:
- 12.0.0
-
addMonitorUserValuesByTrackId
public IMonitorValuesProvider addMonitorUserValuesByTrackId(String trackId)
Adds a value provider related toMonitorUser
with the given track identifier.- Parameters:
trackId
- the monitor user track identifier.- Returns:
- the created values provider.
- Since:
- 12.0.0
-
-