SHARE
TWEET

Untitled

a guest Sep 17th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (require '[clara.rules.durability.fressian :as cf]
  2.          '[clara.rules.platform :as pform]
  3.          '[clara.rules.durability :as d]
  4.          '[clojure.data.fressian :as fres]
  5.          '[clojure.core.async :as async]
  6.          '[clojure.java.io :as io])
  7.  
  8.  
  9.  
  10.  
  11. (def ch (async/chan))
  12.  
  13. (async/go
  14.   (with-open [out (io/output-stream "test.fress")]
  15.     (with-open [wrt (fres/create-writer out :handlers cf/write-handler-lookup)]
  16.       (pform/thread-local-binding
  17.        [d/clj-struct-holder (java.util.IdentityHashMap.)]
  18.        (loop []
  19.          (when-let [v (async/<! ch)]
  20.            (fres/write-object wrt v)
  21.            (recur)))))))
  22.  
  23.  
  24. (async/>!! ch [1 2 3])
  25.  
  26.  
  27.  
  28. #_"Exception in thread \"async-dispatch-2\" java.lang.NullPointerException
  29.     at clara.rules.durability$clj_struct__GT_idx.invokeStatic(durability.clj:88)
  30.     at clara.rules.durability$clj_struct__GT_idx.invoke(durability.clj:83)
  31.     at clara.rules.durability.fressian$create_identity_based_handler$reify__13402.write(fressian.clj:206)
  32.     at org.fressian.FressianWriter.doWrite(FressianWriter.java:449)"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top