6

In Dropwizard I use Couchbase' Bucket.counter(...) method to generate unique IDs for my documents:

JsonLongDocument counter = bucket.counter("taskID", 1);
int id = (int) counter.content().intValue();       

These lines work often but sometimes I get an Exception:

ERROR [2015-04-27 07:36:00,340] io.dropwizard.jersey.errors.LoggingExceptionMapper: Error handling a request: 8916c444f0cd508a
! rx.exceptions.OnErrorThrowable$OnNextValue: OnError while emitting onNext value: com.couchbase.client.core.message.kv.CounterResponse.class
! at rx.exceptions.OnErrorThrowable.addValueAsLastCause(OnErrorThrowable.java:98) ~[rxjava-1.0.4.jar:1.0.4]
! at rx.internal.operators.OperatorMap$1.onNext(OperatorMap.java:58) ~[rxjava-1.0.4.jar:1.0.4]
! ... 11 common frames omitted
! Causing: com.couchbase.client.core.CouchbaseException: INVALID_ARGUMENTS
! at com.couchbase.client.java.CouchbaseAsyncBucket$26.call(CouchbaseAsyncBucket.java:949) ~[java-client-2.1.2-dp.jar:2.1.1-7-g63629c6-dirty]
! at com.couchbase.client.java.CouchbaseAsyncBucket$26.call(CouchbaseAsyncBucket.java:931) ~[java-client-2.1.2-dp.jar:2.1.1-7-g63629c6-dirty]
! at rx.internal.operators.OperatorMap$1.onNext(OperatorMap.java:55) ~[rxjava-1.0.4.jar:1.0.4]
! at rx.subjects.SubjectSubscriptionManager$SubjectObserver.onNext(SubjectSubscriptionManager.java:224) ~[rxjava-1.0.4.jar:1.0.4]
! at rx.subjects.AsyncSubject.onCompleted(AsyncSubject.java:101) ~[rxjava-1.0.4.jar:1.0.4]
! at com.couchbase.client.core.endpoint.AbstractGenericHandler$1.call(AbstractGenericHandler.java:199) ~[core-io-1.1.2-dp.jar:1.1.1-17-gf6d5dd3-dirty]
! at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:47) ~[rxjava-1.0.4.jar:1.0.4]
! at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_31]
! at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_31]
! at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_31]
! at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[na:1.8.0_31]
! at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_31]
! at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_31]
! at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31] 

Am I supposed to implement some kind of exception mapper or what is the reason for this? The seemingly randomness of the error is quite puzzling.

Bastian
  • 4,638
  • 6
  • 36
  • 55

0 Answers0