Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  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)"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement