Skip to content

Commit

Permalink
Fix for runtime errors when bounded is compiled with a version higher…
Browse files Browse the repository at this point in the history
… that Java 8 and used in a Java 8 project. (#46)
  • Loading branch information
hervandevliert authored and olger committed Sep 7, 2018
1 parent b5a7086 commit aaf9dc3
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit aaf9dc3

Please sign in to comment.