Package com._1c.g5.resourcemanagement
Interface IHostResourceManagementHandle
- All Known Implementing Classes:
HostResourceManagementHandle
public interface IHostResourceManagementHandle
The handle provides the single point of the push/pull communication with the host resource management facility.
The handle is being received on registration of the
The handle protects the resource management facility (being the critical part of the system) from unattended calls of client services and doesn't allow them to break the system resource balance as a result.
IResourcePlan
in the IHostResourceManager
and
should be stored till the end of the client service lifecycle.The handle protects the resource management facility (being the critical part of the system) from unattended calls of client services and doesn't allow them to break the system resource balance as a result.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(IHostResourceManagerListener listener) Adds a listener to the handle's plan activities.
The usual strategy is to register a single listener for all activities of the plan.
There is no need in managing the listener lifecycle - it will be disposed at the end of the resource subsystem lifecycle.int
getPermittedThreads
(String activityName) Gets the number of simultaneous threads that are available for the current activityboolean
isActivityRunning
(String activityName) Checks if the given acitvity is being run at the moment.void
startActivity
(String activityName) Starts an activity registered via the corresponding plan.void
stopActivity
(String activityName) Stops an activity registered via the corresponding plan.void
updateDemands
(String activityName) Updates demands of the selected activity (should be started at the moment of the update).
-
Method Details
-
getPermittedThreads
Gets the number of simultaneous threads that are available for the current activity- Parameters:
activityName
- The name of the activity. Cannot benull
- Returns:
- The number of threads permitted for the selected activity praocessing. Cannot be less then {@code 1)
-
updateDemands
Updates demands of the selected activity (should be started at the moment of the update). The resource management facility should re-balance the resource permissions and notify all affected clients as a result- Parameters:
activityName
- The name of the activity
-
startActivity
Starts an activity registered via the corresponding plan. The activity shouldn't be started at the momemnt of the call.- Parameters:
activityName
- The name of the activity. Cannot benull
.
-
stopActivity
Stops an activity registered via the corresponding plan. The activity should be started at the moment of the call.- Parameters:
activityName
- The name of the activity. Cannot benull
.
-
isActivityRunning
Checks if the given acitvity is being run at the moment.- Parameters:
activityName
- The name of the activity. Cannot benull
.- Returns:
- True in case if the activity is being run. False otherwise.
-
addListener
Adds a listener to the handle's plan activities.
The usual strategy is to register a single listener for all activities of the plan.
There is no need in managing the listener lifecycle - it will be disposed at the end of the resource subsystem lifecycle.- Parameters:
listener
- The listener instance, cannot benull
-