So I have a method which takes upto 4 hours to execute. I need to stop this method within the first 30 mins of execution and have the available results upto that 30 mins of time only. Can someone help me with this? I have tried many things to terminate my method but found no luck. I want the solution in Java.
Programmer18 0 Newbie Poster
Recommended Answers
Jump to PostBuild the process with ProcessBuilder. Start the process. Star at 30 minute Timer. Get the available results as they are written to the process' output stream (may need to code the script to display results as they are created). When the Timer fires terminateForcibly() the process.
All 2 Replies
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
Programmer18 commented: I have a execute() method. In this method we are trying to execute a script(.sh file) which is taking almost 4 hours +0
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Programmer18 commented: Thank you. Can I have one example for this approach to understand correctly in order to decide whether I can use this approach. +0
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.