try {
  Thread.sleep(...);
} catch (InterruptedException ex) {
  Thread.currentThread().interrupt();
}

That's the normal Java idiom at least. The InterruptedException is checked
purely so you are forced to deal with it like this because it's the safer
way of killing a thread.

On Fri, May 25, 2018 at 9:21 AM, Daniel Anechitoaie <[email protected]>
wrote:

> Hi,
>
> I have a plugin that calls a MasterToSlaveCallable with the following
> signature "private static class DataImportCallable extends
> MasterToSlaveCallable<Void, IOException>".
> Inside this MasterToSlaveCallable I zip some files and then upload them to
> a server using Apache HTTPClient and then make some REST API calls where I
> need to periodically (every 1 minute)
> check if work is done with the ZIP I have uploaded.
>
> My problem is that MasterToSlaveCallable seems to only be allowing one
> exception to be thrown and calling Thread.sleep(...) can throw
> InterruptedException which does not match the signature of my
> MasterToSlaveCallable.
>
> How can I "sleep" the thread inside the MasterToSlaveCallable until work
> is done?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-dev/75e070c4-2011-465b-8fc9-e7c3b2face10%
> 40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/75e070c4-2011-465b-8fc9-e7c3b2face10%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Sicker
Software Engineer, CloudBees

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAEot4oyATHEqUcuHNx29FJWmG7vQTM4iEETk8SF0Xmcfir2zWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to