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 runtime errors when bounded is compiled with a version higher… #46

Merged
merged 1 commit into from
Sep 7, 2018
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package io.cafienne.bounded.eventmaterializers.offsetstores

import java.io.File
import java.nio.ByteBuffer
import java.nio.{Buffer, ByteBuffer}
import java.nio.ByteBuffer.allocateDirect
import java.nio.charset.StandardCharsets.UTF_8
import java.util.UUID
Expand Down Expand Up @@ -33,10 +33,10 @@ private class LmdbOffsetStore(lmdbConfig: LmdbConfig) extends OffsetStore {
val txn = env.txnWrite()
try {
val keyByteBuffer = allocateDirect(100)
keyByteBuffer.put(viewIdentifier.getBytes(UTF_8)).flip
keyByteBuffer.put(viewIdentifier.getBytes(UTF_8)).asInstanceOf[Buffer].flip

val valueByteBuffer = allocateDirect(300)
valueByteBuffer.put(offset2String(offset).getBytes(UTF_8)).flip()
valueByteBuffer.put(offset2String(offset).getBytes(UTF_8)).asInstanceOf[Buffer].flip()
dbi.put(txn, keyByteBuffer, valueByteBuffer)
txn.commit()
} finally {
Expand All @@ -49,7 +49,7 @@ private class LmdbOffsetStore(lmdbConfig: LmdbConfig) extends OffsetStore {
val txn = env.txnRead()
try {
val keyByteBuffer = allocateDirect(100)
keyByteBuffer.put(viewIdentifier.getBytes(UTF_8)).flip
keyByteBuffer.put(viewIdentifier.getBytes(UTF_8)).asInstanceOf[Buffer].flip
val found = dbi.get(txn, keyByteBuffer)
if (found != null) {
val fetchedVal = txn.`val`()
Expand Down