Created
September 6, 2019 20:05
-
-
Save dimovich/021e5e7946c3e3cfecaa580ce1bda987 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clara.rules.durability.fressian :as cf] | |
'[clara.rules.platform :as pform] | |
'[clara.rules.durability :as d] | |
'[clojure.data.fressian :as fres] | |
'[clojure.core.async :as async] | |
'[clojure.java.io :as io]) | |
(def ch (async/chan)) | |
(async/go | |
(with-open [out (io/output-stream "test.fress")] | |
(with-open [wrt (fres/create-writer out :handlers cf/write-handler-lookup)] | |
(pform/thread-local-binding | |
[d/clj-struct-holder (java.util.IdentityHashMap.)] | |
(loop [] | |
(when-let [v (async/<! ch)] | |
(fres/write-object wrt v) | |
(recur))))))) | |
(async/>!! ch [1 2 3]) | |
#_"Exception in thread \"async-dispatch-2\" java.lang.NullPointerException | |
at clara.rules.durability$clj_struct__GT_idx.invokeStatic(durability.clj:88) | |
at clara.rules.durability$clj_struct__GT_idx.invoke(durability.clj:83) | |
at clara.rules.durability.fressian$create_identity_based_handler$reify__13402.write(fressian.clj:206) | |
at org.fressian.FressianWriter.doWrite(FressianWriter.java:449)" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment