SlideShare a Scribd company logo
1 of 9
Download to read offline
70 Curso de Java
Threads:
Definindo
prioridades
MinhaThreadRunnable thread1 = new MinhaThreadRunnable("#1", 300);
MinhaThreadRunnable thread2 = new MinhaThreadRunnable("#2", 300);
MinhaThreadRunnable thread3 = new MinhaThreadRunnable("#3", 300);
Thread t1 = new Thread(thread1);
Thread t2 = new Thread(thread2);
Thread t3 = new Thread(thread3);
t1.setPriority(5);
t2.setPriority(1);
t3.setPriority(3);
t1.start();
t2.start();
t3.start();
MinhaThreadRunnable thread1 = new MinhaThreadRunnable("#1", 300);
MinhaThreadRunnable thread2 = new MinhaThreadRunnable("#2", 300);
MinhaThreadRunnable thread3 = new MinhaThreadRunnable("#3", 300);
Thread t1 = new Thread(thread1);
Thread t2 = new Thread(thread2);
Thread t3 = new Thread(thread3);
t1.setPriority(5);
t2.setPriority(1);
t3.setPriority(3);
t1.start();
t2.start();
t3.start();
Valores de 1 a 10
• Valores das prioridades podem ser de 1 a 10
• Prioridade normal tem valor 5
• Pode usar as constantes da classeThread também:
• MIN_PRIORITY
• MAX_PRIORITY
https://github.com/loiane/curso-java-basico
Código Fonte:
Não conhece Git/Github?
http://www.loiane.com/2013/11/
screencast-git-e-github-para-iniciantes
http://loiane.training
Fórum para dúvidas + certificado do curso.
Cadastro em:
Obrigada!
http://loiane.com
facebook.com/loianegroner
twitter.com/loiane
https://github.com/loiane
youtube.com/loianegroner
http://loiane.training

More Related Content

What's hot

Threadlifecycle.36
Threadlifecycle.36Threadlifecycle.36
Threadlifecycle.36
myrajendra
 
Степан Кольцов — Rust — лучше, чем C++
Степан Кольцов — Rust — лучше, чем C++Степан Кольцов — Rust — лучше, чем C++
Степан Кольцов — Rust — лучше, чем C++
Yandex
 

What's hot (20)

14 thread
14 thread14 thread
14 thread
 
Java concurrency - Thread pools
Java concurrency - Thread poolsJava concurrency - Thread pools
Java concurrency - Thread pools
 
Modern C++ Concurrency API
Modern C++ Concurrency APIModern C++ Concurrency API
Modern C++ Concurrency API
 
Threads
ThreadsThreads
Threads
 
Ownership System in Rust
Ownership System in RustOwnership System in Rust
Ownership System in Rust
 
Understanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring EffectsUnderstanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring Effects
 
The Ring programming language version 1.7 book - Part 84 of 196
The Ring programming language version 1.7 book - Part 84 of 196The Ring programming language version 1.7 book - Part 84 of 196
The Ring programming language version 1.7 book - Part 84 of 196
 
Threadlifecycle.36
Threadlifecycle.36Threadlifecycle.36
Threadlifecycle.36
 
Network security
Network securityNetwork security
Network security
 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in Gecko
 
Python import mechanism
Python import mechanismPython import mechanism
Python import mechanism
 
東急Ruby会議向け「rubyの細かい話」
東急Ruby会議向け「rubyの細かい話」東急Ruby会議向け「rubyの細かい話」
東急Ruby会議向け「rubyの細かい話」
 
Alias
AliasAlias
Alias
 
The Ring programming language version 1.10 book - Part 34 of 212
The Ring programming language version 1.10 book - Part 34 of 212The Ring programming language version 1.10 book - Part 34 of 212
The Ring programming language version 1.10 book - Part 34 of 212
 
Introduction to Kernel Programming
Introduction to Kernel ProgrammingIntroduction to Kernel Programming
Introduction to Kernel Programming
 
The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180
 
#5 (Remote Method Invocation)
#5 (Remote Method Invocation)#5 (Remote Method Invocation)
#5 (Remote Method Invocation)
 
The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196
 
Степан Кольцов — Rust — лучше, чем C++
Степан Кольцов — Rust — лучше, чем C++Степан Кольцов — Rust — лучше, чем C++
Степан Кольцов — Rust — лучше, чем C++
 
Threads Advance in System Administration with Linux
Threads Advance in System Administration with LinuxThreads Advance in System Administration with Linux
Threads Advance in System Administration with Linux
 

Viewers also liked

Viewers also liked (20)

[Curso Java Basico] Aula 54: Enumeradores como classe (construtor e metodos)
[Curso Java Basico] Aula 54: Enumeradores como classe (construtor e metodos)[Curso Java Basico] Aula 54: Enumeradores como classe (construtor e metodos)
[Curso Java Basico] Aula 54: Enumeradores como classe (construtor e metodos)
 
[Curso Java Basico] Aula 60: Escopo de Variaveis
[Curso Java Basico] Aula 60: Escopo de Variaveis[Curso Java Basico] Aula 60: Escopo de Variaveis
[Curso Java Basico] Aula 60: Escopo de Variaveis
 
[Curso Java Basico] Aula 73: Threads: resume, suspend e stop
[Curso Java Basico] Aula 73: Threads: resume, suspend e stop[Curso Java Basico] Aula 73: Threads: resume, suspend e stop
[Curso Java Basico] Aula 73: Threads: resume, suspend e stop
 
[Curso Java Basico - Orientacao a Objetos] Aula 31: Modificadores private e p...
[Curso Java Basico - Orientacao a Objetos] Aula 31: Modificadores private e p...[Curso Java Basico - Orientacao a Objetos] Aula 31: Modificadores private e p...
[Curso Java Basico - Orientacao a Objetos] Aula 31: Modificadores private e p...
 
[Curso Java Basico] Aula 74: Threads: deadlocks
[Curso Java Basico] Aula 74: Threads: deadlocks[Curso Java Basico] Aula 74: Threads: deadlocks
[Curso Java Basico] Aula 74: Threads: deadlocks
 
[Curso Java Basico - Exceptions] Aula 51: tipos de erros no Java
[Curso Java Basico - Exceptions] Aula 51: tipos de erros no Java[Curso Java Basico - Exceptions] Aula 51: tipos de erros no Java
[Curso Java Basico - Exceptions] Aula 51: tipos de erros no Java
 
[Curso Java Basico] Aula 64: Classes aninhadas: internas, locais e anonimas
[Curso Java Basico] Aula 64: Classes aninhadas: internas, locais e anonimas[Curso Java Basico] Aula 64: Classes aninhadas: internas, locais e anonimas
[Curso Java Basico] Aula 64: Classes aninhadas: internas, locais e anonimas
 
[Curso Java Basico] Aula 22: Como debugar no Eclipse
[Curso Java Basico] Aula 22: Como debugar no Eclipse[Curso Java Basico] Aula 22: Como debugar no Eclipse
[Curso Java Basico] Aula 22: Como debugar no Eclipse
 
[Curso Java Basico] Aula 71: Threads: metodos e blocos sincronizados (synchro...
[Curso Java Basico] Aula 71: Threads: metodos e blocos sincronizados (synchro...[Curso Java Basico] Aula 71: Threads: metodos e blocos sincronizados (synchro...
[Curso Java Basico] Aula 71: Threads: metodos e blocos sincronizados (synchro...
 
[Curso Java Basico] Aula 72: Threads: notify, wait e notifyAll
[Curso Java Basico] Aula 72: Threads: notify, wait e notifyAll[Curso Java Basico] Aula 72: Threads: notify, wait e notifyAll
[Curso Java Basico] Aula 72: Threads: notify, wait e notifyAll
 
[Curso Java Basico] Aula 58: Autoboxing e Unboxing
[Curso Java Basico] Aula 58: Autoboxing e Unboxing[Curso Java Basico] Aula 58: Autoboxing e Unboxing
[Curso Java Basico] Aula 58: Autoboxing e Unboxing
 
[Curso Java Basico] Aula 23: Como debugar no Netbeans
[Curso Java Basico] Aula 23: Como debugar no Netbeans[Curso Java Basico] Aula 23: Como debugar no Netbeans
[Curso Java Basico] Aula 23: Como debugar no Netbeans
 
[Curso Java Basico] Aula 68: Threads: Interface Runnable
[Curso Java Basico] Aula 68: Threads: Interface Runnable[Curso Java Basico] Aula 68: Threads: Interface Runnable
[Curso Java Basico] Aula 68: Threads: Interface Runnable
 
[Curso Java Basico - Orientacao a Objetos] Aula 26: Classes e metodos com ret...
[Curso Java Basico - Orientacao a Objetos] Aula 26: Classes e metodos com ret...[Curso Java Basico - Orientacao a Objetos] Aula 26: Classes e metodos com ret...
[Curso Java Basico - Orientacao a Objetos] Aula 26: Classes e metodos com ret...
 
[Curso Java Basico - Exceptions] Aula 49: finally
[Curso Java Basico - Exceptions] Aula 49: finally[Curso Java Basico - Exceptions] Aula 49: finally
[Curso Java Basico - Exceptions] Aula 49: finally
 
[Curso Java Basico] Aula 55: Enum: metodos value e valueOf
[Curso Java Basico] Aula 55: Enum: metodos value e valueOf[Curso Java Basico] Aula 55: Enum: metodos value e valueOf
[Curso Java Basico] Aula 55: Enum: metodos value e valueOf
 
[Curso Java Basico - Orientacao a Objetos] Aula 41: Heranca: classes abstratas
[Curso Java Basico - Orientacao a Objetos] Aula 41: Heranca: classes abstratas[Curso Java Basico - Orientacao a Objetos] Aula 41: Heranca: classes abstratas
[Curso Java Basico - Orientacao a Objetos] Aula 41: Heranca: classes abstratas
 
[Curso Java Basico - Orientacao a Objetos] Aula 33: Sobrecarga de metodos e c...
[Curso Java Basico - Orientacao a Objetos] Aula 33: Sobrecarga de metodos e c...[Curso Java Basico - Orientacao a Objetos] Aula 33: Sobrecarga de metodos e c...
[Curso Java Basico - Orientacao a Objetos] Aula 33: Sobrecarga de metodos e c...
 
[Curso Java Basico] Aula 61: Passagem de parametros por valor e referencia
[Curso Java Basico] Aula 61: Passagem de parametros por valor e referencia[Curso Java Basico] Aula 61: Passagem de parametros por valor e referencia
[Curso Java Basico] Aula 61: Passagem de parametros por valor e referencia
 
[Curso Java Basico - Orientacao a Objetos] Aula 38: Herança: Palavra chave super
[Curso Java Basico - Orientacao a Objetos] Aula 38: Herança: Palavra chave super[Curso Java Basico - Orientacao a Objetos] Aula 38: Herança: Palavra chave super
[Curso Java Basico - Orientacao a Objetos] Aula 38: Herança: Palavra chave super
 

Recently uploaded

Recently uploaded (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

[Curso Java Basico] Aula 70: Threads: Definindo prioridades