Stop method Assignment Help

Assignment Help: >> Threads States - Stop method

Stop method:

The Thread class also declares a method known as stop ( ) which stops a thread.  Its signature is display here:

void stop ( )

At one a thread has been stopped, it cannot be restarted by using resume ( ). Suspending resuming and stopping threads by using java 2

Although the suspend ( ), and stop( ), resume ( )  methods defined through Thread seem to be a  perfectly  convenient  and reasonable  approach  to  maintaining  the  execution  of threads, they must not be used for new Java programs. Here's why. The suspend ( ) method of the Thread class is deprecated in Java 2. This was completed since suspend ( ) could sometimes cause serious system failures. Suppose that a thread has get locks on critical data structures. Those locks are not relinquished if those threads we suspended at that point.  Other threads which might bewailing for those resources could be deadlocked.

The resume( ) function is also deprecated. It does not cause any problems, but cannot be used without the suspend ( ) function as its counterpart.

The stop ( ) methods of the Thread class, too, is deprecated in Java 2 this was completed since this methods could sometimes cause serious system failures.  Suppose that a thread is writing to a critically important data structure and has finished only part of its modifications. That data structure might be left in a corrupted state if thread is stopped at that point.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd