If it is about Thread/sleep, you can perhaps use something like this:
(defn sleep
[n]
(try (Thread/sleep n)
(catch InterruptedException e
(.interrupt (Thread/currentThread)))))
There might be other situations where the underlying API throws
InterruptedException - deal with them accordingly.
http://www.ibm.com/developerworks/java/library/j-jtp05236.html
HTH
Regards,
Shantanu
On Feb 25, 4:12 am, clj123 <[email protected]> wrote:
> I've also noticed that I can cause this InterruptedException to be
> thrown if I add
>
> (. Thread (sleep 1000)) instead of saving to database.
>
> It looks like when a thread is waiting for a long time this exception
> is being thrown. By the way I'm running only one thread in my code.
>
> Here's the rest of my stack trace:
>
> java.lang.InterruptedException: sleep interrupted
> at java.lang.Thread.sleep(Native Method)
> at my-code$my-method$fn__2822.invoke(my-code.clj:203)
> at my-code$my-method.invoke(my-code.clj:201)
> at clojure.lang.Compiler.eval(Compiler.java:5424)
> at clojure.lang.Compiler.eval(Compiler.java:5391)
> at clojure.core$eval.invoke(core.clj:2382)
> at clojure.main$repl$read_eval_print__5624.invoke(main.clj:183)
> at clojure.main$repl$fn__5629.invoke(main.clj:204)
> at clojure.main$repl.doInvoke(main.clj:204)
> at clojure.lang.RestFn.invoke(RestFn.java:702)
> at clojure.tools.nrepl$handle_request.invoke(nrepl.clj:272)
> at clojure.lang.Var.invoke(Var.java:373)
> at clojure.tools.nrepl$message_dispatch
> $fn__199$fn__202.invoke(nrepl.clj:336)
> at clojure.lang.AFn.call(AFn.java:18)
> at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
> at java.util.concurrent.FutureTask.run(Unknown Source)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en