Class ProcessingUnitRunnable

    • Constructor Detail

      • ProcessingUnitRunnable

        public ProcessingUnitRunnable​(java.lang.String id,
                                      java.lang.String name,
                                      java.lang.Class<? extends IProcessingUnit> processingUnitClass,
                                      java.util.List<Parameter> parameterList,
                                      IProcessingUnitContext processingUnitContext,
                                      IProcessingUnitRunnableListener processingUnitRunnableListener)
        Constructor
        Parameters:
        id - the unique id of this processing
        name - the name of this processing unit runnable
        processingUnitClass - the processing unit class
        parameterList - the parameter list
        processingUnitContext - the processing context.
        processingUnitRunnableListener - the processing unit runnable listener
        Throws:
        ValidationException - This will be throw in case the consistency check failures.
        ProcessingException - Throws this exception in case of initialization failures.
      • ProcessingUnitRunnable

        public ProcessingUnitRunnable​(byte[] suspendedState,
                                      IProcessingUnitRunnableListener processingUnitRunnableListener)
        Constructor
        Parameters:
        suspendedState - the suspended state
        processingUnitRunnableListener - the processing unit runnable listener
        Throws:
        ValidationException - This will be throw in case the consistency check failures.
        ProcessingException - Throws this exception in case of initialization failures.
    • Method Detail

      • setProcessingUnitThrottling

        public void setProcessingUnitThrottling​(java.lang.Long maxNumberOfProcessingUnitCallsPerSecond)
        Defines the max calls per second to throttle the processing unit
        Parameters:
        maxNumberOfProcessingUnitCallsPerSecond - the max number of processing units per second
      • suspendProcessing

        public void suspendProcessing()
        Suspend processing
      • getSuspendedState

        public byte[] getSuspendedState()
        Get suspended state
        Returns:
        the suspended state
      • run

        public void run()
        See Also:
        Runnable.run()
      • throttlingProcessing

        protected void throttlingProcessing()
        Throttling the processing if its defined and needed
      • getProcessingUnitThrottling

        protected com.github.toolarium.common.bandwidth.IBandwidthThrottling getProcessingUnitThrottling()
        Get the processing unit throttling
        Returns:
        the processing unit throttling
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()