Enter your email address:

    Delivered by FeedBurner

Thread


Thread represent ability provided by Java to make Taft application, because thread in program have duty and function separate. With existence of thread, can make more efficient program in speed matter and also usage of resource, because we earn to divide process in our application at the same time. Thread is generally used for the programming of multitasking, networking, entangling accessing to source energy by concurrent.

There is two way of which can be used in making a thread, that is :



  • Making subclass of thread

To run thread, can be conducted by calling method start(). moment of Start() run, hence in fact run method() of class will be run. Become to make thread, have to define run method() at definition of class.

  • implementation of Interface Runnable

Way of this represent the way of simplest in making thread. Runnable represent abstraction unit, that is class which is implementation this interface only enough function implementation of run(). In function implementation of run(), we will define instruction which developing a thread.

    1. Daemon And of User Thread

There is two Kinds of thread in Java, that is and daemon of user thread. Daemon thread represent thread which is its life cycle depend on especial thread or mains, so that if mains thread end, hence automatically daemon thread-thread also follow to end. While thread user measure up to differ, where if especial thread have, hence thread user will continue to be run.

    1. Sleep

Arranging thread to discontinue its process a moment and give opportunity at other process or thread.

    1. Interrupt

If wishing an thread to discontinue process, hence require to call interrupt method. Interrupt used to give signal at thread to discontinue its process.

    1. Synchronized

Synchronization is block or method owning addition of keyword synchronized, so that if run hence only one thread at one time which can run program block or method. Other Thread will await thread which is executing this method till finish. Synchronization mechanism important in the event of division of data and also resource among thread-thread. Synchronization also lock at data or resource which is processing.


Thread represent ability provided by Java to make Taft application, because thread in program have duty and function separate. With existence of thread, can make more efficient program in speed matter and also usage of resource, because we earn to divide process in our application at the same time. Thread is generally used for the programming of multitasking, networking, entangling accessing to source energy by concurrent.

There is two way of which can be used in making a thread, that is :



  • Making subclass of thread

To run thread, can be conducted by calling method start(). moment of Start() run, hence in fact run method() of class will be run. Become to make thread, have to define run method() at definition of class.

  • implementation of Interface Runnable

Way of this represent the way of simplest in making thread. Runnable represent abstraction unit, that is class which is implementation this interface only enough function implementation of run(). In function implementation of run(), we will define instruction which developing a thread.

    1. Daemon And of User Thread

There is two Kinds of thread in Java, that is and daemon of user thread. Daemon thread represent thread which is its life cycle depend on especial thread or mains, so that if mains thread end, hence automatically daemon thread-thread also follow to end. While thread user measure up to differ, where if especial thread have, hence thread user will continue to be run.

    1. Sleep

Arranging thread to discontinue its process a moment and give opportunity at other process or thread.

    1. Interrupt

If wishing an thread to discontinue process, hence require to call interrupt method. Interrupt used to give signal at thread to discontinue its process.

    1. Synchronized

Synchronization is block or method owning addition of keyword synchronized, so that if run hence only one thread at one time which can run program block or method. Other Thread will await thread which is executing this method till finish. Synchronization mechanism important in the event of division of data and also resource among thread-thread. Synchronization also lock at data or resource which is processing.


Qidzama

Recent Articles

Blog Archive