[Java lista] szalkezeles

Zoltan Mozes Zoltan_Mozes at epam.com
2007. Jan. 29., H, 15:16:29 CET


valóban úgy van ahogy Laci mondta

a szál run()-jában kell gondoskodni a többszörös végrehajtásról.

Nehogy azzal kísérletezz hogy magát a start()-ot hívod többször, csak ennyit akartam mondani a Laci által helyesen elmondottakhoz.

Best Regards,
Zoltán Mózes


EPAM Systems
Budapest office, Hungary (GMT+1)

Office phone:        +36 (1) 327-74-XX
Office fax:            +36 (1) 327-74-20
Mobile phone:       +36 (20) XXX-XXX
E-mail:                 Zoltan_Mozes at epam.com

http://www.epam.com

CONFIDENTIALITY CAUTION AND DISCLAIMER
This message is intended only for the use of the individual(s) or entity(ies) to which it is addressed and contains information that is legally privileged and confidential. If you are not the intended recipient, or the person responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. All unintended recipients are obliged to delete this message and destroy any printed copies.

-----Original Message-----
From: javalist-bounces at javagrund.hu [mailto:javalist-bounces at javagrund.hu] On Behalf Of Zoltan Mozes
Sent: Monday, January 29, 2007 3:13 PM
To: javalist at javagrund.hu
Subject: Re: [Java lista] szalkezeles

Bocsánat, egykiegészítés:

szálat NEM lehet újraindítani:

"
When Execution Ends
When the run() method returns, the thread has finished its task and is considered dead. There
is no way out of this state. Once a thread is dead, it cannot be started again; if you want the
thread's task to be performed again, you have to construct and start a new thread instance. The
dead thread continues to exist; it is an object like any other object, and you can still access its
data and call its methods. You just can't make it run again. In other words,
 You can't restart a dead thread by calling its start() or run() methods.
 You can call other methods (besides start() and run()) of a dead thread.
The Thread methods include a method called stop(), which forcibly terminates a thread,
putting it into the dead state. This method is deprecated since JDK 1.2, because it can cause data
corruption or deadlock if you kill a thread that is in a critical section of code. Therefore, if a
thread might need to be killed from another thread, you should call interrupt() on it from the
killing method.

"

Complete Java® 2
Certification: Study Guide,
Fifth Edition
Philip Heller
Simon Roberts
SYBEX®



Best Regards,
Zoltán Mózes


EPAM Systems
Budapest office, Hungary (GMT+1)

Office phone:        +36 (1) 327-74-XX
Office fax:            +36 (1) 327-74-20
Mobile phone:       +36 (20) XXX-XXX
E-mail:                 Zoltan_Mozes at epam.com

http://www.epam.com

CONFIDENTIALITY CAUTION AND DISCLAIMER
This message is intended only for the use of the individual(s) or entity(ies) to which it is addressed and contains information that is legally privileged and confidential. If you are not the intended recipient, or the person responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. All unintended recipients are obliged to delete this message and destroy any printed copies.

-----Original Message-----
From: javalist-bounces at javagrund.hu [mailto:javalist-bounces at javagrund.hu] On Behalf Of Laszlo.Marai at nokia.com
Sent: Monday, January 29, 2007 3:07 PM
To: javalist at javagrund.hu
Subject: Re: [Java lista] szalkezeles

  Hali!

>átirtam a progit
>nem Thread-ot öröklöm, hanem implementálom a Runnable interface-t
>nincs start() metódus sem

Helyes. Es erted, hogy miert?

>a probléma sajnos még fent áll gondolom valahol máshol van a hiba

Igy van. Tovabbra sem szinkronizalsz. Java Utikalauz programozoknak,
217-257, szinkronizacio: 248

>bár az számomra érdekes, hogy miért az után blokkolódik a progi miután 
>lefutt a TimerTask ?

Ezert. Nem erdekes, csak total nem erted. En meg teged nem.

>direkt a TimerTask run metódusa után iratom ki, hogy 
>"lefutott.." ez után 
>vár néhány mp-t
>a futás magában gyorsan megtörténik miért nem fut tovább az a szál ami 
>közben tölti a táblát
>egyáltalán miért áll meg? 

Mert a run metodust egyszer futtatja a Thread, azert. Ha tobbszor
akarod futtatni a benne levo kodot, akkor azt egy ciklusba kell rakni.
Ez kiderulne:
- az elozo levelembol (leirtam)
- a javadocbol (belinkeltem)
- barmelyik normalis java konyvbol.

Neked fizetnek ezert? Most komolyan. Nem erezned jobban magad, ha e-mailek
helyett programot irhatnal? :)

  Ba'ly,
    Atleta
_______________________________________________
Javalist mailing list
Javalist at javagrund.hu
http://javagrund.hu/mailman/listinfo/javalist
_______________________________________________
Javalist mailing list
Javalist at javagrund.hu
http://javagrund.hu/mailman/listinfo/javalist


További információk a(z) Javalist levelezőlistáról