6月
25
2013
[appengine][slim3] DatastoreUtil#allocateIdがNamespaceに対応するように修正
投稿者: miztaka, カテゴリ: appengine, java, slim3, tags: appengine, google, java, slim3これでいいのかしら。。
public static Key allocateId(AsyncDatastoreService ds, String kind)
throws NullPointerException {
if (ds == null) {
throw new NullPointerException("The ds parameter must not be null.");
}
if (kind == null) {
throw new NullPointerException(
"The kind parameter must not be null.");
}
String ns = NamespaceManager.get();
if (ns == null) {
ns = "";
}
String cacheKey = "!"+ns+":"+kind;
Iterator<Key> keys = keysCache.get(cacheKey);
if (keys != null && keys.hasNext()) {
return keys.next();
}
keys =
FutureUtil
.getQuietly(allocateIdsAsync(ds, kind, KEY_CACHE_SIZE))
.iterator();
keysCache.put(cacheKey, keys);
return keys.next();
}

エントリ (RSS)