PROGRAMMING IN JAVA - LECTURE -56- VARIOUS METHODS & THREAD PRIORITIES - BCA- S3.
Various methods
We have various methods which can be called on Thread class object. These methods are very useful when writing a multithreaded application. Thread class has following important methods.
Method Signature Description
String getName() Retrieves the name of running thread in the current context in String format
void start() This method will start a new thread of execution by calling run() method of Thread/runnable object.
void run() This method is the entry point of the thread. Execution of thread starts from this method.
void sleep(int sleeptime) This method suspend the thread for mentioned time duration in argument (sleeptime in ms)
void yield() By invoking this method the current thread pause its execution temporarily and allow other threads to execute.
void join() This method used to queue up a thread in execution. Once called on thread, current thread will wait till calling thread completes its execution
boolean isAlive() This method will check if thread is alive or dead
Thread priorities
• Thread priorities are the integers which decide how one thread should be treated with respect to the others.
• Thread priority decides when to switch from one running thread to another, process is called context switching
• A thread can voluntarily release control and the highest priority thread that is ready to run is given the CPU.
• A thread can be preempted by a higher priority thread no matter what the lower priority thread is doing. Whenever a higher priority thread wants to run it does.
• To set the priority of the thread setPriority() method is used which is a method of the class Thread Class.
ThreadName.setPriority(intNumber);
• In place of defining the priority in integers, we can use MIN_PRIORITY, NORM_PRIORITY or MAX_PRIORITY
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «PROGRAMMING IN JAVA - LECTURE -56- VARIOUS METHODS & THREAD PRIORITIES - BCA- S3.», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.