 |
Hamelin |
.pifferaio.magico.

Registered: Feb 2003
Posts: 662 (0.08 al dì)
Location: ..tra i monti intorno ad Hamelin..
Corso: Ingegneria Informatica
Anno: 3°
Time Online: 7 Days, 7:19:55 [...]
Status: Offline
Edit | Report | IP: Logged |
Mah... ad ogni richiesta di download crei un nuovo thread che gestisce l'operazione. Magari memorizzi in una struttura dati (un'ArrayList, ad esempio) l'elenco dei thread/download (e li rimuovi una volta terminati). Quando poi l'utente manifesta il desiderio di chiudere il programma, iteri sulla struttura dati e fai un join per ognuno dei thread/download ancora attivi. È solo un'idea... probabilmente ce ne sono di migliori.
Comunque, ti consiglio di leggere un'introduzione al multi-threading in Java: nel capitolo corrispondente di TIJ, nel tutorial Sun o al limite qui.
__________________
Bjarne Stroustrup: "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
Andrew S. Tanenbaum: "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."
Edsger Dijkstra: "Computer Science is no more about computers than astronomy is about telescopes."
Robert Firth: "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs."
Donald Knuth: "A mathematical formula should never be 'owned' by anybody! Mathematics belong to God."
|