Class ActionTrackingServiceImpl

java.lang.Object
org.alfresco.repo.action.ActionTrackingServiceImpl
All Implemented Interfaces:
ActionTrackingService

public class ActionTrackingServiceImpl extends Object implements ActionTrackingService
Action execution tracking service implementation
Author:
Nick Burch
  • Constructor Details

    • ActionTrackingServiceImpl

      public ActionTrackingServiceImpl()
  • Method Details

    • setTransactionService

      public void setTransactionService(TransactionService transactionService)
      Set the transaction service
      Parameters:
      transactionService - the transaction service
    • setNodeService

      public void setNodeService(NodeService nodeService)
      Set the node service
      Parameters:
      nodeService - the node service
    • setRuntimeActionService

      public void setRuntimeActionService(RuntimeActionService runtimeActionService)
      Set the runtime action service
      Parameters:
      runtimeActionService - the runtime action service
    • setExecutingActionsCache

      public void setExecutingActionsCache(SimpleCache<String,ExecutionDetails> executingActionsCache)
      Sets the cache used to store details of currently executing actions, cluster wide.
    • resetNextExecutionId

      protected void resetNextExecutionId()
      Used by unit tests only
    • recordActionPending

      public void recordActionPending(Action action)
      Description copied from interface: ActionTrackingService
      Record that an action has been scheduled for asynchronous execution, and is pending being executed.
      Specified by:
      recordActionPending in interface ActionTrackingService
      Parameters:
      action - the action that has been scheduled
    • recordActionPending

      public void recordActionPending(Action action, NodeRef actionedUponNodeRef)
      Description copied from interface: ActionTrackingService
      Record that an action against a NodeRef has been scheduled for asynchronous execution, and is pending being executed.
      Specified by:
      recordActionPending in interface ActionTrackingService
      Parameters:
      action - the action that has been scheduled
      actionedUponNodeRef - the NodeRef the action is acting on
    • recordActionPending

      public void recordActionPending(ActionImpl action)
    • recordActionPending

      public void recordActionPending(ActionImpl action, NodeRef actionedUponNodeRef)
    • recordActionComplete

      public void recordActionComplete(Action action)
      Description copied from interface: ActionTrackingService
      Record that an action has completed execution without error.
      Specified by:
      recordActionComplete in interface ActionTrackingService
      Parameters:
      action - the action that has been finished
    • recordActionExecuting

      public void recordActionExecuting(Action action)
      Description copied from interface: ActionTrackingService
      Record that an action has begun execution.
      Specified by:
      recordActionExecuting in interface ActionTrackingService
      Parameters:
      action - the action that has begun execution
    • recordActionExecuting

      public void recordActionExecuting(Action action, NodeRef actionedUponNodeRef)
      Description copied from interface: ActionTrackingService
      Record that an action has begun execution.
      Specified by:
      recordActionExecuting in interface ActionTrackingService
      Parameters:
      action - the action that has been scheduled
      actionedUponNodeRef - the NodeRef the action is acting on
    • recordActionFailure

      public void recordActionFailure(Action action, Throwable exception)
      Schedule the recording of the action failure to occur in another transaction
      Specified by:
      recordActionFailure in interface ActionTrackingService
      Parameters:
      action - the action that has failed
    • isCancellationRequested

      public boolean isCancellationRequested(CancellableAction action)
      Description copied from interface: ActionTrackingService
      Has cancellation been requested for the given action? This method is most commonly called by the action in question, to check to see if someone has called ActionTrackingService.requestActionCancellation(CancellableAction) for them.
      Specified by:
      isCancellationRequested in interface ActionTrackingService
      Parameters:
      action - The action to check about
      Returns:
      if cancellation has been requested or not
    • requestActionCancellation

      public void requestActionCancellation(CancellableAction action)
      Description copied from interface: ActionTrackingService
      Requests that the specified Action cancel itself and aborts execution, as soon as possible. Cancellable actions periodically check to see if a cancel has been requested, and will take note of the cancel request once seen.
      Specified by:
      requestActionCancellation in interface ActionTrackingService
      Parameters:
      action - The action to request the cancel of
    • requestActionCancellation

      public void requestActionCancellation(ExecutionSummary executionSummary)
      Description copied from interface: ActionTrackingService
      Requests that the specified Action cancel itself and aborts execution, as soon as possible. Cancellable actions periodically check to see if a cancel has been requested, and will take note of the cancel request once seen. If the specified action is not a cancellable action, nothing will happen.
      Specified by:
      requestActionCancellation in interface ActionTrackingService
      Parameters:
      executionSummary - ExecutionSummary
    • getAllExecutingActions

      public List<ExecutionSummary> getAllExecutingActions()
      Description copied from interface: ActionTrackingService
      Retrieve summary details of all the actions currently executing.
      Specified by:
      getAllExecutingActions in interface ActionTrackingService
      Returns:
      the execution summaries
    • getExecutingActions

      public List<ExecutionSummary> getExecutingActions(Action action)
      Description copied from interface: ActionTrackingService
      Retrieve summary details of all instances of the specified action that are currently executing.
      Specified by:
      getExecutingActions in interface ActionTrackingService
      Returns:
      the execution summaries
    • getExecutingActions

      public List<ExecutionSummary> getExecutingActions(String type)
      Description copied from interface: ActionTrackingService
      Retrieve summary details of all the actions of the given type that are currently executing.
      Specified by:
      getExecutingActions in interface ActionTrackingService
      Parameters:
      type - the action type
      Returns:
      the execution summaries
    • getExecutingActions

      public List<ExecutionSummary> getExecutingActions(String type, NodeRef actionedUponNodeRef)
      Description copied from interface: ActionTrackingService
      Retrieve summary details of all the actions of the given type acting on the given NodeRef that are currently executing.
      Specified by:
      getExecutingActions in interface ActionTrackingService
      Parameters:
      type - the action type
      actionedUponNodeRef - the node the action is acting on
      Returns:
      the execution summaries
    • getExecutionDetails

      public ExecutionDetails getExecutionDetails(ExecutionSummary executionSummary)
      Description copied from interface: ActionTrackingService
      Retrieves the execution details on the given executing action, such as when it started, and what machine it is executing on.
      Specified by:
      getExecutionDetails in interface ActionTrackingService
      Parameters:
      executionSummary - the execution summary
      Returns:
      the execution details
    • generateCacheKey

      protected static String generateCacheKey(Action action)
      Generates the cache key for the specified action.
    • generateCacheKey

      protected static String generateCacheKey(ExecutionSummary summary)
    • buildExecutionDetails

      protected static ExecutionDetails buildExecutionDetails(Action action)
      Builds up the details to be stored in a cache for a specific action
    • buildExecutionDetails

      protected static ExecutionDetails buildExecutionDetails(Action action, NodeRef actionedUponNodeRef)
      Builds up the details to be stored in a cache for a specific action
    • buildExecutionSummary

      protected static ExecutionSummary buildExecutionSummary(String key)
      Turns a cache key back into its constituent parts, for easier access.
    • buildExecutionSummary

      protected static ExecutionSummary buildExecutionSummary(Action action)