I have a requirement in java where i want the thread to die and kill itself after specific period of time like after 1 min it has started to process. Does java provide a way for this?
One thing to add here is i am using ThreadPoolExecutor and submitting RUnnable objects to ThreadPoolExecutor to be executed in a queue. This is part of our framework and i cannot remove ThreadPoolExecutor. Given this how can i use ExecutorService?
It’s the same problem like this. Please use
ExecutorServiceto execute theRunnable