I know My question is not spesific. But I need some explanation about ATC.
I can just understand that ATC is that a thread can be effected on other thread. It can be use spesificly for thread terminations.Is it ok?
But I cant find any example for ATC. I need a simple example to understand more. May you give a example or web address about this ATC example?
ATC is "asynchronous transfer of control". It is asynchronous because it triggers an exception in the target thread (an AsynchronouslyInterruptedException - AIE) that is unrelated to the execution of any bytecode being executed by that thread. It transfers control immediately to the first enclosing catch block for AIE that is not itself within asynchronously interruptible code (and there must be one because AIE is a checked exception and Thread.run() can not throw it). ATC is only enabled in code that explicitly declares that it is asynchronously interruptible, by declaring that it throw AIE. This is not transitive: any calls to methods that don't throw AIE will not throw the AIE until returning to the AI-enabled code. Further, ATC is disabled within synchronized code regions.
So ATC is a mechanism to quickly cancel/abort execution of specific sections of code. This might lead to Thread termination, but often it will just lead to cancellation of a computation. It is an extension of the co-operative cancellation mechanism in regular Java - based on the use of Thread.interrupt; but provides a means for code to be responsive to cancellation without having to poll to see if cancellation has been requested.
An example of using this is embodied in the Timed class. Timed extends AIE and allows you to execute AI-code that will have the AIE thrown when a timer expires. The canonical example of this is a calculation that involves successive approximation: the calculation is iterative and on each iteration you get a "better" answer, but you have limited time to perform the calculation. So you cancel the calculation when the allowed time has elapsed and use the result from the previous iteration as the "best answer available in the time given".
Check out www.rtsj.org for some references to books by Dibble, Wellings and Bruno. All three should have some ATC examples within them.