aspose.cells

Class ThreadInterruptMonitor

Simple implementation of AbstractInterruptMonitor by starting another thread to require the interruption after sleeping user specified limit.
One monitor instance can be used repeatedly, as long as you monitor each process in sequence. It should not be used to monitor multiple procedures concurrently in multi-threads.

Constructor Summary
ThreadInterruptMonitor(terminateWithoutException)
Constructs one interruption monitor.
 
Property Getters/Setters Summary
functionisInterruptionRequested()
This implementation just checks whether the time cost(from the time when starting this monitor to now) is greater than user specified limit.
functiongetTerminateWithoutException()
See TerminateWithoutException. This property is specified by user when constructing this monitor instance.
 
Method Summary
functionfinishMonitor()
Finishes the monitor for one procedure.
functionstartMonitor(msLimit)
Starts the monitor with the specified time limit. The start time to calculate time cost is just when this method is called, so the procedure which needs to be monitored should be started just after this call.
 

    • Constructor Detail

      • ThreadInterruptMonitor

        function ThreadInterruptMonitor(terminateWithoutException)
        Constructs one interruption monitor.
        Parameters:
        terminateWithoutException: boolean - TerminateWithoutException
    • Property Getters/Setters Detail

      • isInterruptionRequested : boolean 

        function isInterruptionRequested()
        
        This implementation just checks whether the time cost(from the time when starting this monitor to now) is greater than user specified limit.
      • getTerminateWithoutException : boolean 

        function getTerminateWithoutException()
        
        See TerminateWithoutException. This property is specified by user when constructing this monitor instance.
    • Method Detail

      • startMonitor

        function startMonitor(msLimit)
        Starts the monitor with the specified time limit. The start time to calculate time cost is just when this method is called, so the procedure which needs to be monitored should be started just after this call.
        Parameters:
        msLimit: Number - time limit(ms) to require the interruption.
      • finishMonitor

        function finishMonitor()
        Finishes the monitor for one procedure. Calling this method after the monitored procedure can release the monitor thread earlier, especially when there is no interruption for it(the time cost of that procedure is less than the specified time limit).