public class SystemTimeInterruptMonitor extends AbstractInterruptMonitor
AbstractInterruptMonitor by checking and comparing current system time with user specified limit.
Remarks
This implementation is just a simple solution for simple scenarios. It needs to frequently retrieve and check the system time so itself may have a negative impact on performance to some extent.Example
The following example shows how to monitor the load and save procedure with specified time limit:
SystemTimeInterruptMonitor monitor = new SystemTimeInterruptMonitor(false);
LoadOptions lopts = new LoadOptions();
lopts.setInterruptMonitor(monitor);
monitor.startMonitor(1000); //time limit is 1 second
Workbook wb = new Workbook("Large.xlsx", lopts);
//if the time cost of loading the template file exceeds one second, interruption will be required and exception will be thrown here
//otherwise starts to monitor the save procedure
monitor.startMonitor(1500); //time limit is 1.5 seconds
wb.save("result.xlsx");
| Constructor and Description |
|---|
SystemTimeInterruptMonitor(boolean terminateWithoutException)
Constructs one interruption monitor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getTerminateWithoutException()
|
boolean |
isInterruptionRequested()
This implementation just checks whether the time cost(from the time when starting this monitor to now) is greater than user specified limit.
|
void |
startMonitor(int msLimit)
Starts the monitor with the specified time limit.
|
public SystemTimeInterruptMonitor(boolean terminateWithoutException)
terminateWithoutException - AbstractInterruptMonitor.getTerminateWithoutException()public void startMonitor(int msLimit)
msLimit - time limit(ms) to require the interruption.public boolean isInterruptionRequested()
isInterruptionRequested in class AbstractInterruptMonitorpublic boolean getTerminateWithoutException()
AbstractInterruptMonitor.getTerminateWithoutException().
This property is specified by user when constructing this monitor instance.getTerminateWithoutException in class AbstractInterruptMonitorSee Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.