Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

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

666 Aufrufe

Veröffentlicht am

Curso de Java Completo com Certificado e Fórum para dúvidas: http://loiane.training

Site: http://loiane.training
Blog: http://loiane.com
Facebook: https://www.facebook.com/loianegroner
Github: https://github.com/loiane
Twitter: https://twitter.com/loiane

Veröffentlicht in: Technologie
  • Loggen Sie sich ein, um Kommentare anzuzeigen.

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

  1. 1. 70 Curso de Java Threads: Definindo prioridades
  2. 2. 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();
  3. 3. 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
  4. 4. • 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
  5. 5. https://github.com/loiane/curso-java-basico Código Fonte:
  6. 6. Não conhece Git/Github? http://www.loiane.com/2013/11/ screencast-git-e-github-para-iniciantes
  7. 7. http://loiane.training Fórum para dúvidas + certificado do curso. Cadastro em:
  8. 8. Obrigada!
  9. 9. http://loiane.com facebook.com/loianegroner twitter.com/loiane https://github.com/loiane youtube.com/loianegroner http://loiane.training

×