Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-dev] Blocking jobs

What happens if I create one Thread and set this for all jobs with
setThread(theOne). They all appear to be running at the same time.

Regards,
Leen Toelen

On 12/2/05, Jean-Philippe Shields <jean-philippe.shields@xxxxxxxxx> wrote:
> You need to implement this pseudo-code:
>
> The basic thing to do is to implement a list in your worker class, fifo or priority depends on you. You put your jobs in that list and then your worker runs on the list getting the first job until the list is empty. I don't think that there is an easy way to do that with Java or Eclipse because it is not a concurrent or parallel framework.
>
> If you intend to use threads, you will also need to implement multithreading security and persistence data on your jobs, which will be very difficult.
>
>         1 - Enqueue jobs in a list (FIFO)
>                 workers.enqueue(job)
>
>                 public void enqueue(JOB job)
>                 {
>                         jobList.add(job);
>                 }
>
>         In Your workers:
>
>         1 - while (!jobList.empty())
>                 {
>                         job = dequeuehead()
>                         //Execute job
>                         job.execute();
>                 }
>
>                 Private Job dequeuehead()
>                 {
>                         Job temp;
>                         temp = jobList.removefirst;
>                         Return temp;
>                 }
>
> I don't know any framework in java suitable for that, but in C++ you would like to use something called ACE: http://www.cs.wustl.edu/~schmidt/ACE.html.
> I Hope it helps a bit.
>
> J.P. Shields
>
> -----Message d'origine-----
> De: pde-dev-bounces@xxxxxxxxxxx [mailto:pde-dev-bounces@xxxxxxxxxxx] De la part de Leen Toelen
> Envoyé: 2 décembre 2005 10:15
> À: Eclipse PDE general developers list.
> Objet: [pde-dev] Blocking jobs
>
> Hi,
>
> I am submitting multiple jobs at once, all of the same Class. I would
> like that only one of these jobs can run at the time, so all jobs of
> the same kind wait until the running job is finished, then take the
> second one etc. Is there an easy way to do so?
>
> Regards,
> Leen Toelen
> _______________________________________________
> pde-dev mailing list
> pde-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/pde-dev
>
> _______________________________________________
> pde-dev mailing list
> pde-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/pde-dev
>


Back to the top