Skip to content

umermansoor/custom-future-wrapping-callable

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

This code given here explains how to return a custom FutureTask when you submit a Callable to an ExecutorService. This is helpful in the following cases:

  1. To support Interruption-unfriendly task cancellation. java.net.Socket operations are notoriously oblivious to interruptions. Hence, tasks using Socket operations must support non-standard cancellation. (The best approach to do this is to close() to Socket, forcing all of it's blocked methods to throw SocketException.

  2. To return an identifier for Callable. Useful when Tasks are assigned ID's and could be used to track them.

About

For demonstrating how to return Customized Future from Executor Service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages