Class ProcessingUnitUtil


  • public final class ProcessingUnitUtil
    extends java.lang.Object
    Processing unit util
    • Method Detail

      • getInstance

        public static ProcessingUnitUtil getInstance()
        Get the instance
        Returns:
        the instance
      • setProcessingUnitInstanceManager

        public void setProcessingUnitInstanceManager​(IProcessingUnitInstanceManager processingUnitInstanceManager)
        Set the processing unit instance manager
        Parameters:
        processingUnitInstanceManager - the processing unit instance manager
      • isProcessingUnitAvailable

        public boolean isProcessingUnitAvailable​(java.lang.String processingUnitClassname)
        Check if the processing unit class is available
        Parameters:
        processingUnitClassname - the class name
        Returns:
        true if it the processing unit is available
      • isProcessingUnit

        public boolean isProcessingUnit​(java.lang.String processingUnitClassname)
        Check if the processing unit class is available
        Parameters:
        processingUnitClassname - the class name
        Returns:
        true if it the processing unit is available
      • isParallelProcessingUnit

        public boolean isParallelProcessingUnit​(java.lang.String processingUnitClassname)
                                         throws java.lang.ClassNotFoundException
        Check if the class is a parallel processing unit
        Parameters:
        processingUnitClassname - the class name
        Returns:
        true if it is a parallel processing unit
        Throws:
        java.lang.ClassNotFoundException - In case the class could not be found
      • isParallelProcessingUnit

        public boolean isParallelProcessingUnit​(java.lang.Class<? extends IProcessingUnit> processingUnitClass)
        Check if the class is a parallel processing unit
        Parameters:
        processingUnitClass - the class
        Returns:
        true if it is a parallel processing unit
      • isParallelProcessingUnit

        public boolean isParallelProcessingUnit​(IProcessingUnit processingUnit)
        Check if the class is a parallel processing unit
        Parameters:
        processingUnit - the processing unit instance
        Returns:
        true if it is a parallel processing unit
      • setMaxNumberOfProcessingUnitCallsPerSecond

        public boolean setMaxNumberOfProcessingUnitCallsPerSecond​(java.lang.String id,
                                                                  java.lang.String name,
                                                                  IProcessingUnit processingUnit,
                                                                  java.lang.Long maxNumberOfProcessingUnitCallsPerSecond)
        Set the max number of processing unit calls per seconds
        Parameters:
        id - the unique id of the processing
        name - the name of the processing
        processingUnit - the processing unit
        maxNumberOfProcessingUnitCallsPerSecond - The max number of processing unit calls per seconds
        Returns:
        true if the processing unit has an own implementation of throttling
      • getBandwidthProcessingUnitThrottling

        public com.github.toolarium.common.bandwidth.IBandwidthThrottling getBandwidthProcessingUnitThrottling​(IProcessingUnit processingUnit)
        Get the bandwidth processing unit throttling
        Parameters:
        processingUnit - the processing unit
        Returns:
        the bandwidth processing unit throttling
      • hasProcessingUnitObjectLockManagerSupport

        public boolean hasProcessingUnitObjectLockManagerSupport​(IProcessingUnit processingUnit)
        Check if the instance has object lock manager support
        Parameters:
        processingUnit - the processing unit
        Returns:
        true if it has support of unit object lock manager
      • createProcessingUnitInstance

        public IProcessingUnit createProcessingUnitInstance​(java.lang.String id,
                                                            java.lang.String name,
                                                            java.lang.Class<? extends IProcessingUnit> processingUnitClass)
                                                     throws ValidationException
        Create the processing unit implementation
        Parameters:
        id - the unique id of the processing
        name - the name of the processing
        processingUnitClass - the class
        Returns:
        the instance
        Throws:
        ValidationException - If the instance of the processing unit cannot be initialized correctly
      • createSingleProcessingUnitInstance

        public IProcessingUnit createSingleProcessingUnitInstance​(java.lang.String id,
                                                                  java.lang.String name,
                                                                  java.lang.Class<? extends IProcessingUnit> processingUnitClass)
                                                           throws ValidationException
        Create the processing unit implementation
        Parameters:
        id - the unique id of the processing
        name - the name of the processing
        processingUnitClass - the class
        Returns:
        the instance
        Throws:
        ValidationException - If the instance of the processing unit cannot be initialized correctly
      • createParallelProcessingUnitInstance

        public IProcessingUnit createParallelProcessingUnitInstance​(java.lang.String id,
                                                                    java.lang.String name,
                                                                    java.lang.Class<? extends IProcessingUnit> processingUnitClass)
                                                             throws ValidationException
        Create the processing unit implementation
        Parameters:
        id - the unique id of the processing
        name - the name of the processing
        processingUnitClass - the class
        Returns:
        the instance
        Throws:
        ValidationException - If the instance of the processing unit cannot be initialized correctly
      • releaseResource

        public void releaseResource​(java.lang.String id,
                                    java.lang.String name,
                                    IProcessingUnit processingUnit)
        Release resource
        Parameters:
        id - the unique id of the processing
        name - the name of the processing
        processingUnit - the processing unit
      • getEmptyProcessingUnitHandler

        public IEmptyProcessingUnitHandler getEmptyProcessingUnitHandler​(IProcessingUnit processingUnit)
        Get the empty processing unit handler
        Parameters:
        processingUnit - the processing unit
        Returns:
        the empty processing unit handler
      • toString

        public java.lang.String toString​(java.lang.String id,
                                         java.lang.String name,
                                         java.lang.Class<? extends IProcessingUnit> processingUnitClass)
        Prepare processing log message
        Parameters:
        id - the id
        name - the name
        processingUnitClass - the processing unit class
        Returns:
        the prepared string
      • toString

        public java.lang.String toString​(java.lang.String id,
                                         java.lang.String name,
                                         java.lang.String processingUnitClass)
        Prepare processing log message
        Parameters:
        id - the id
        name - the name
        processingUnitClass - the processing unit class
        Returns:
        the prepared string
      • toString

        public java.lang.String toString​(java.lang.String id,
                                         java.lang.String name,
                                         java.lang.String processingUnitClass,
                                         IProcessingUnitProgress processingProgress,
                                         ProcessingActionStatus processingActionStatus,
                                         ProcessingRuntimeStatus processingRuntimeStatus)
        Format process unit progress
        Parameters:
        id - the id
        name - the name
        processingUnitClass - the processing unit class
        processingProgress - the progressing unit progress
        processingActionStatus - the action status
        processingRuntimeStatus - the runtime status
        Returns:
        the formatted message
      • toString

        public java.lang.String toString​(java.lang.String id,
                                         java.lang.String name,
                                         java.lang.String processingUnitClass,
                                         IProcessingUnitProgress processingProgress,
                                         ProcessingActionStatus processingActionStatus,
                                         ProcessingRuntimeStatus processingRuntimeStatus,
                                         java.util.List<java.lang.String> messages)
        Format process unit progress
        Parameters:
        id - the id
        name - the name
        processingUnitClass - the processing unit class
        processingProgress - the progressing unit progress
        processingActionStatus - the action status
        processingRuntimeStatus - the runtime status
        messages - the messages
        Returns:
        the formatted message
      • toString

        public java.lang.String toString​(java.lang.String id,
                                         java.lang.String name,
                                         java.lang.String processingUnitClass,
                                         IProcessingUnitProgress processingProgress,
                                         ProcessingActionStatus processingActionStatus,
                                         ProcessingRuntimeStatus processingRuntimeStatus,
                                         java.util.List<java.lang.String> messages,
                                         IProcessingUnitRuntimeTimeMeasurement timeMeasurement,
                                         com.github.toolarium.common.bandwidth.IBandwidthThrottling processingUnitThrottling)
        Format process unit progress
        Parameters:
        id - the id
        name - the name
        processingUnitClass - the processing unit class
        processingProgress - the progressing unit progress
        processingActionStatus - the action status
        processingRuntimeStatus - the runtime status
        messages - the messages
        timeMeasurement - the time measurement
        processingUnitThrottling - the processing unit throttling
        Returns:
        the formatted message
      • toString

        public java.lang.String toString​(java.lang.String id,
                                         java.lang.String name,
                                         java.lang.String processingUnitClass,
                                         java.util.List<Parameter> parameters,
                                         IProcessingUnitContext processingUnitContext,
                                         IProcessingUnitProgress processingProgress,
                                         ProcessingActionStatus processingActionStatus,
                                         ProcessingRuntimeStatus processingRuntimeStatus,
                                         java.util.List<java.lang.String> messages,
                                         IProcessingUnitRuntimeTimeMeasurement timeMeasurement,
                                         com.github.toolarium.common.bandwidth.IBandwidthThrottling processingUnitThrottling)
        Format process unit progress
        Parameters:
        id - the id
        name - the name
        processingUnitClass - the processing unit class
        parameters - the parameters
        processingUnitContext - the processing unit context
        processingProgress - the progressing unit progress
        processingActionStatus - the action status
        processingRuntimeStatus - the runtime status
        messages - the messages
        timeMeasurement - the time measurement
        processingUnitThrottling - the processing unit throttling
        Returns:
        the formatted message
      • toString

        public java.lang.String toString​(java.lang.String id,
                                         java.lang.String name,
                                         java.lang.String processingUnitClass,
                                         java.util.List<Parameter> parameters,
                                         IProcessingUnitContext processingUnitContext,
                                         IProcessingUnitProgress processingProgress,
                                         ProcessingActionStatus processingActionStatus,
                                         ProcessingRuntimeStatus processingRuntimeStatus,
                                         java.util.List<java.lang.String> messages,
                                         IProcessingUnitRuntimeTimeMeasurement timeMeasurement,
                                         com.github.toolarium.common.bandwidth.IBandwidthThrottling processingUnitThrottling,
                                         IProcessingUnitPersistence processingPersistence)
        Format process unit progress
        Parameters:
        id - the id
        name - the name
        processingUnitClass - the processing unit class
        parameters - the parameters
        processingUnitContext - the processing unit context
        processingProgress - the progressing unit progress
        processingActionStatus - the action status
        processingRuntimeStatus - the runtime status
        messages - the messages
        timeMeasurement - the time measurement
        processingUnitThrottling - the processing unit throttling
        processingPersistence - the processing persistence
        Returns:
        the formatted message
      • toString

        public java.lang.String toString​(byte[] persistedState)
        Get the persisted state as string
        Parameters:
        persistedState - the persisted state
        Returns:
        the string re-presenation