@DELETE public void deleteIt() { // delete an entity from the datastore // just print a message upon exception (don't throw) DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService(); if (syncCache.get(keyname) != null) { syncCache.delete(keyname); } Key entKey = KeyFactory.createKey("TaskData", keyname); try { Entity ent = datastore.get(entKey); datastore.delete(entKey); System.err.println("TaskData deleted in Datastore"); } catch (EntityNotFoundException e) { System.err.println("TaskData not found in Datastore"); } }
@Override public void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws IOException { final MemcacheService cacheShared = MemcacheServiceFactory.getMemcacheService(); if (cacheShared.contains(MemCacheKey.activePoints)) { try { final Map<String, Point> points = (Map<String, Point>) cacheShared.get(MemCacheKey.activePoints); cacheShared.delete( MemCacheKey.activePoints); // TODO possible race condition with record value service for (final Point point : points.values()) { TaskFactory.getInstance().startMoveCachedValuesToStoreTask(point); } } catch (InvalidValueException e) { cacheShared.clearAll(); } } }