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

added missing insert fails counter #383

Merged
merged 4 commits into from
Mar 17, 2015
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class AsyncListSum[Key, Value](bufferSize: BufferSize,

@annotation.tailrec
private[this] final def doInsert(key: Key, value: Value) {
tuplesIn.incr
val (success, countChange) = if (queueMap.containsKey(key)) {
val oldValue = queueMap.get(key)
if (oldValue != null) {
Expand All @@ -120,6 +121,7 @@ class AsyncListSum[Key, Value](bufferSize: BufferSize,
// Successful insert
elementsInCache.addAndGet(countChange)
} else {
insertFails.incr
return doInsert(key, value)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ case class SyncSummingQueue[Key, Value](bufferSize: BufferSize,
override val memoryIncr: Incrementor,
override val timeoutIncr: Incrementor,
sizeIncr: Incrementor,
putCalls: Incrementor,
insertOps: Incrementor,
tuplesIn: Incrementor,
tuplesOut: Incrementor)(implicit semigroup: Semigroup[Value]) extends AsyncSummer[(Key, Value), Map[Key, Value]] with WithFlushConditions[(Key, Value), Map[Key, Value]] {

require(bufferSize.v > 0, "Use the Null summer for an empty async summer")
protected override val emptyResult = Map.empty[Key, Value]

private[this] final val squeue: CustomSummingQueue[Map[Key, Value]] = new CustomSummingQueue(bufferSize.v, sizeIncr, putCalls)
private[this] final val squeue: CustomSummingQueue[Map[Key, Value]] = new CustomSummingQueue(bufferSize.v, sizeIncr, insertOps)
override def isFlushed: Boolean = squeue.isFlushed

def flush: Future[Map[Key, Value]] = {
Expand Down