Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Java 13 compatibility #23 #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ pom.xml.asc
/.nrepl-port
.DS_Store
/doc
push
push
*.iml
.idea/
19 changes: 10 additions & 9 deletions src/durable_queue.clj
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,11 @@
(with-buffer [buf slab]
(reset! status s)
(.put buf (p/+ offset 1)
(case s
:incomplete 0
:in-progress 1
:complete 2))
(byte
(case s
:incomplete 0
:in-progress 1
:complete 2)))
(invalidate slab (p/+ offset 1) 1)
nil)))

Expand All @@ -190,9 +191,9 @@
(fn []
(with-buffer [buf slab]
(let [^ByteBuffer buf (-> buf
(.position offset)
(.position ^Long offset)
^ByteBuffer
(.limit (+ offset len))
(.limit ^Long (+ offset len))
.slice)
checksum' (.getLong buf 2)
ary (bs/to-byte-array (.position buf header-size))]
Expand Down Expand Up @@ -303,17 +304,17 @@
(let [ary (nippy/freeze descriptor)
cnt (count ary)
pos @position
^ByteBuffer buf (.position buf pos)]
^ByteBuffer buf (.position buf ^Long pos)]

(when (> (.remaining buf) (+ (count ary) header-size))
;; write to the buffer
(doto buf
(.position pos)
(.position ^Long pos)
(.put (byte 1)) ;; exists
(.put (byte 0)) ;; incomplete
(.putLong (checksum cnt ary))
(.putInt cnt)
(.put ary)
(.put ^bytes ary)
(.put (byte 0))) ;; next doesn't exist

(swap! position + header-size cnt)
Expand Down