cancelling future

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

cancelling future

Christopher Kin Chung Au

Hi,

 

Currently I have an application which sends out bulk email we use the ExecutorService submit to get a future object back which we store. This future object holds many other future objects which are the actual workers that send out the email. The intention is that we will potentially have many bulk email future objects which in turn hold many email future objects sending out the emails. We want to be able to choose and cancel a designated bulk email future object which in turn stops all the email future objects associated with that bulk email future object while the other bulk email future objects remain intact. I have used the cancel command but whilst the bulk email future object reports that it has been cancelled the email future objects seem to continue to run. I hope this makes sense and any help would be appreciated.

 

Thanks

 

Chris

 

PS the email future objects are created using executorservice.submit.


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: cancelling future

Joe Bowbeer
If you Future impl. can query isCancelled if that would help it be
more responsive to cancellation.  But that probably isn't your
question.

The most common method for cleaning up inside a Future after
cancellation is to override the done method (of FutureTask).  If
isCancelled is true here, then cancel the Futures that are dependent
on yours.

On 2/28/06, Christopher Kin Chung Au <[hidden email]> wrote:

>
> Currently I have an application which sends out bulk email we use the
> ExecutorService submit to get a future object back which we store. This
> future object holds many other future objects which are the actual workers
> that send out the email. The intention is that we will potentially have many
> bulk email future objects which in turn hold many email future objects
> sending out the emails. We want to be able to choose and cancel a designated
> bulk email future object which in turn stops all the email future objects
> associated with that bulk email future object while the other bulk email
> future objects remain intact. I have used the cancel command but whilst the
> bulk email future object reports that it has been cancelled the email future
> objects seem to continue to run. I hope this makes sense and any help would
> be appreciated.
>

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: cancelling future

Joe Bowbeer
I meant to write:

Your Future impl. can query isCancelled if that would help it be more
responsive to cancellation.

On 2/28/06, Joe Bowbeer <[hidden email]> wrote:

> If you Future impl. can query isCancelled if that would help it be
> more responsive to cancellation.  But that probably isn't your
> question.
>
> The most common method for cleaning up inside a Future after
> cancellation is to override the done method (of FutureTask).  If
> isCancelled is true here, then cancel the Futures that are dependent
> on yours.
>
> On 2/28/06, Christopher Kin Chung Au <[hidden email]> wrote:
> >
> > Currently I have an application which sends out bulk email we use the
> > ExecutorService submit to get a future object back which we store. This
> > future object holds many other future objects which are the actual workers
> > that send out the email. The intention is that we will potentially have many
> > bulk email future objects which in turn hold many email future objects
> > sending out the emails. We want to be able to choose and cancel a designated
> > bulk email future object which in turn stops all the email future objects
> > associated with that bulk email future object while the other bulk email
> > future objects remain intact. I have used the cancel command but whilst the
> > bulk email future object reports that it has been cancelled the email future
> > objects seem to continue to run. I hope this makes sense and any help would
> > be appreciated.
> >
>

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: cancelling future

studdugie
In reply to this post by Christopher Kin Chung Au
On 2/28/06, Christopher Kin Chung Au <[hidden email]> wrote:

>
>
>
> Hi,
>
>
>
> Currently I have an application which sends out bulk email we use the
> ExecutorService submit to get a future object back which we store. This
> future object holds many other future objects which are the actual workers
> that send out the email. The intention is that we will potentially have many
> bulk email future objects which in turn hold many email future objects
> sending out the emails. We want to be able to choose and cancel a designated
> bulk email future object which in turn stops all the email future objects
> associated with that bulk email future object while the other bulk email
> future objects remain intact. I have used the cancel command but whilst the
> bulk email future object reports that it has been cancelled the email future
> objects seem to continue to run. I hope this makes sense and any help would
> be appreciated.
>
>
>
> Thanks
>
>
>
> Chris
>
>
>
> PS the email future objects are created using executorservice.submit.
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>
I hesitate to respond to your post in large part because I can't
answer your question about the cascading canceling of Future objects
but I plow ahead anyway because I'm solving the exact same problem
(bulk email) except I've approached it from a completely different
angle than Executors and Futures. So before I waste any of your or my
time rattling on about what I'm doing I'll leave it here and you can
reply to this post if you are interested in my approach. Otherwise
good luck to you.

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: cancelling future

studdugie
In reply to this post by Christopher Kin Chung Au
I hesitate to respond to your post in large part because I can't
answer your question about the cascading canceling of Future objects
but I plow ahead anyway because I'm solving the exact same problem
(bulk email) except I've approached it from a completely different
angle than Executors and Futures. So before I waste any of your or my
time rattling on about what I'm doing I'll leave it here and you can
reply to this post if you are interested in my approach. Otherwise
good luck to you.

Dane

On 2/28/06, Christopher Kin Chung Au <[hidden email]> wrote:

>
>
>
> Hi,
>
>
>
> Currently I have an application which sends out bulk email we use the
> ExecutorService submit to get a future object back which we store. This
> future object holds many other future objects which are the actual workers
> that send out the email. The intention is that we will potentially have many
> bulk email future objects which in turn hold many email future objects
> sending out the emails. We want to be able to choose and cancel a designated
> bulk email future object which in turn stops all the email future objects
> associated with that bulk email future object while the other bulk email
> future objects remain intact. I have used the cancel command but whilst the
> bulk email future object reports that it has been cancelled the email future
> objects seem to continue to run. I hope this makes sense and any help would
> be appreciated.
>
>
>
> Thanks
>
>
>
> Chris
>
>
>
> PS the email future objects are created using executorservice.submit.
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

RE: cancelling future

Christopher Kin Chung Au
In reply to this post by Christopher Kin Chung Au
Hi,

Managed to get the canceling working. I do not think it is the most
elegant way of doing things but it bloody works.

The way I attempted this was that I already kept references of all the
future email processes and just used the drainTo Method to remove them.

Anyway thanks to all who helped.

Chris

-----Original Message-----
From: studdugie [mailto:[hidden email]]
Sent: Friday, 10 March 2006 12:33 AM
To: Christopher Kin Chung Au
Subject: Re: [concurrency-interest] cancelling future

I hesitate to respond to your post in large part because I can't
answer your question about the cascading canceling of Future objects
but I plow ahead anyway because I'm solving the exact same problem
(bulk email) except I've approached it from a completely different
angle than Executors and Futures. So before I waste any of your or my
time rattling on about what I'm doing I'll leave it here and you can
reply to this post if you are interested in my approach. Otherwise
good luck to you.

Dane

On 2/28/06, Christopher Kin Chung Au <[hidden email]> wrote:
>
>
>
> Hi,
>
>
>
> Currently I have an application which sends out bulk email we use the
> ExecutorService submit to get a future object back which we store.
This
> future object holds many other future objects which are the actual
workers
> that send out the email. The intention is that we will potentially
have many
> bulk email future objects which in turn hold many email future objects
> sending out the emails. We want to be able to choose and cancel a
designated
> bulk email future object which in turn stops all the email future
objects
> associated with that bulk email future object while the other bulk
email
> future objects remain intact. I have used the cancel command but
whilst the
> bulk email future object reports that it has been cancelled the email
future
> objects seem to continue to run. I hope this makes sense and any help
would

> be appreciated.
>
>
>
> Thanks
>
>
>
> Chris
>
>
>
> PS the email future objects are created using executorservice.submit.
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest