Ohad
Ohad

Reputation: 242

Managed VM JDO Datastore

I am trying to migrate an AppEngine project to MVM, custom runtime environment.

I faced an issue with Memcache, which was solved by replacing:

CacheManager.getInstance().getCacheFactory().createCache ...
...

with:

new XMemcachedClient(
   System.getenv.get("MEMCACHE_PORT_11211_TCP_ADDR"), 
   Integer.parseInt(System.getenv.get("MEMCACHE_PORT_11211_TCP_PORT")))
...

(BTW, if anyone is having same issues, then maven for XMemcached is:)

<dependency>
   <groupId>com.googlecode.xmemcached</groupId>
   <artifactId>xmemcached</artifactId>
   <version>2.0.0</version>
</dependency>

I am now facing an issue with DataStore JDO and PersistenceManager (using DataNucleus in the project).

Basically, I am looking to replace this:

JDOHelper.getPersistenceManagerFactory("xxx").getPersistenceManager() ...
...

with ?...

Are there any "magic" environment variables I can use for composing the address (like the MEMCACHE_PORT_11211_TCP_ADDR and MEMCACHE_PORT_11211_TCP_PORT is the case of Memcache)? Any other means I can communicate the datasource with (from a MVM project)?

Thanks in advance,

Ohad

Upvotes: 0

Views: 47

Answers (1)

Justin Beckwith
Justin Beckwith

Reputation: 7866

You may want to consider using the gcloud-java project for accessing datastore. The big advantage here is that you can use the same code/client from App Engine, Container Engine, and Compute Engine:

https://github.com/GoogleCloudPlatform/gcloud-java

Hope this helps!

Upvotes: 1

Related Questions