Skip to content

Commit 8d5352c

Browse files
committed
Add a demo for multiple threads writing exceptions at same time
1 parent ba225ac commit 8d5352c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

project.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
:1.11 {:dependencies [[org.clojure/clojure "1.11.1"]]}
1212
:dev {:dependencies [[criterium "0.4.6"]
1313
[com.stuartsierra/component "1.0.0"]
14-
[com.walmartlabs/test-reporting "1.1"]]}
14+
[com.walmartlabs/test-reporting "1.1"]
15+
[org.clojure/core.async "1.5.648"]]}
1516
:lein {:dependencies [[leiningen "2.9.8"]]}}
1617
:aliases {"release" ["do"
1718
"clean,"

test/demo.clj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[io.aviso.exception :as e]
55
io.aviso.component
66
[clojure.java.io :as io]
7+
[clojure.core.async :refer [chan <!! close! thread]]
78
[criterium.core :as c]
89
[clojure.test :refer [report]])
910
(:import (java.sql SQLException)))
@@ -64,6 +65,15 @@
6465

6566
(comment
6667

68+
(let [e (make-ex-info)
69+
ch (chan)]
70+
(dotimes [i 5]
71+
(thread
72+
(<!! ch)
73+
(println (str "Thread #" i))
74+
(e/write-exception e)))
75+
(close! ch))
76+
6777
(repl/install-pretty-exceptions)
6878

6979
(countdown 10)

0 commit comments

Comments
 (0)