摘要:
For applying timed operations to non-timed functions, a computer causes the computer to discover, by parsing source code, a caller calling a function. The function does not perform timed operations. The computer further encapsulates the function in a timed method adapter and calls the timed method adapter in place of the function from the caller, passing the timed method adapter an object and an argument for the function. The computer further calls an invoke thread from the set invoker and returns from the set invoker to the timed method adapter. The computer waits for an execution result from the function at the timed method adapter, monitoring for an expiration of a timeout, and invokes the function from the invoke thread, passing the function the object and the argument.
摘要:
An encapsulation module encapsulates a function in a timed method adapter. A caller calls the timed method adapter in place of the function. The timed method adapter calls a set invoker. The set invoker saves an argument, calls an invoke thread, and returns to the timed method adapter. The invoke thread invokes the function and passes the function an object and the argument. The timed method adapter further waits for an execution result from the function and monitors for an expiration of a timeout. If the function returns the execution result before expiration of the timeout, the timed method adapter returns the execution result to the caller. If the timeout expires before the function returns the execution result, the timed method adapter directs the invoke thread to cancel the function and returns a timeout exception to the caller.
摘要翻译:封装模块将功能封装在定时方法适配器中。 来电者呼叫定时方法适配器代替该功能。 定时方法适配器调用set invoker。 set invoker保存一个参数,调用一个调用线程,并返回到定时方法适配器。 调用线程调用该函数并传递函数一个对象和参数。 定时方法适配器进一步等待来自该功能的执行结果并监视超时的到期。 如果该函数在超时到期之前返回执行结果,则定时方法适配器将执行结果返回给调用者。 如果超时在函数返回执行结果之前超时,则定时方法适配器会引导调用线程取消该函数,并向调用者返回超时异常。
摘要:
An encapsulation module encapsulates a function in a timed method adapter. A caller calls the timed method adapter in place of the function. The timed method adapter calls a set invoker. The set invoker saves an argument, calls an invoke thread, and returns to the timed method adapter. The invoke thread invokes the function and passes the function an object and the argument. The timed method adapter further waits for an execution result from the function and monitors for an expiration of a timeout. If the function returns the execution result before expiration of the timeout, the timed method adapter returns the execution result to the caller. If the timeout expires before the function returns the execution result, the timed method adapter directs the invoke thread to cancel the function and returns a timeout exception to the caller.
摘要翻译:封装模块将功能封装在定时方法适配器中。 来电者呼叫定时方法适配器代替该功能。 定时方法适配器调用set invoker。 set invoker保存一个参数,调用一个调用线程,并返回到定时方法适配器。 调用线程调用该函数并传递函数一个对象和参数。 定时方法适配器进一步等待来自该功能的执行结果并监视超时的到期。 如果该函数在超时到期之前返回执行结果,则定时方法适配器将执行结果返回给调用者。 如果超时在函数返回执行结果之前超时,则定时方法适配器会引导调用线程取消该函数,并向调用者返回超时异常。