Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

gets never completes operation JAVA API

2 replies [Last post]
  • Login or register to post comments
Tue, 08/14/2012 - 01:32
uvmarko
Offline
Joined: 07/19/2012
Groups: None

Hi,
I have a problem with gets() never completing or sending an error when trying to get a key that does not exist.
The following code has been tested with API 1.0 and 1.1

public Job getJob(JobType jobType)  {
		String key = Job.getKey(jobType);
		System.out.println("get job "+key);
		String json = null;		
		CASValue<Object> cas = client.gets(key);
 
		System.out.println("here");
		System.out.println("get cas "+cas.getCas());
 
		json = (String) cas.getValue();
		System.out.println("Object Json:\n" + json);
 
		... // some more stuff here 
 
		return job;
 
	}

The console log prints :

get job JOB-SendTimeoutWarnings
here

and never throws an error or finishes the operation. I know the key is missing I would expect it to throw some KeyMissing exception or return null.
is this expected behavior?

Thanks

Top
  • Login or register to post comments
Wed, 08/15/2012 - 11:59
daschl
Offline
Joined: 05/19/2012
Groups: None

Doing "nothing" and just hanging the application is normally not considered as expected behavior ;)!

It would be great if you could two things:

- Please tell us against which version of couchbase you are developing

- Can you try the same with asyncGets and see if the future object times out or produces the same behavior? You can see the docs for it here at the bottom: http://www.couchbase.com/docs/couchbase-sdk-java-1.0/couchbase-sdk-java-...

Thanks, Michael

Top
  • Login or register to post comments
Sun, 08/19/2012 - 10:16
uvmarko
Offline
Joined: 07/19/2012
Groups: None

Hi Mchael,
Thanks, I am developing against version 2 for OS X.
I tried with asyncGets, with similar results,
I did

asyncGet(key)
cas = future.get(5,TimeUnit.SECONDS);
print something...
cas.getValue()
print something..

it gets stuck in the cas.getValue() operation or alternatively in cas.getCas()

I did manage to solve the problem by doing

		CASValue<Object> cas = client.gets(key);
		System.out.println("here");
		if(cas==null) return null;
		System.out.println("There");
 
		System.out.println("get cas "+cas.getValue());

but its undocumented usage and might brake in future releases of the API I suppose, I saw it being used like that in the set example somewhere
Thanks,
Yuval

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker