/** * Inserts an entity, or updates it if the primary key already exists (does * not return the existing entity). This method may be used instead of * {@link #put(Object)} to save the overhead of returning the existing * entity. * * <p>If a {@link PrimaryKey#sequence} is used and the primary key field of * the given entity is null or zero, this method will assign the next value * from the sequence to the primary key field of the given entity.</p> * * <p>Auto-commit is used implicitly if the store is transactional.</p> * * @param entity the entity to be inserted or updated. * * <!-- begin JE only --> * @throws OperationFailureException if one of the <a * href="../je/OperationFailureException.html#writeFailures">Write * Operation Failures</a> occurs. * * @throws EnvironmentFailureException if an unexpected, internal or * environment-wide failure occurs. * <!-- end JE only --> * * @throws DatabaseException the base class for all BDB exceptions. */ public void putNoReturn(E entity) throws DatabaseException { putNoReturn(null, entity); }
private TileSet getOrCreateTileSet(final Transaction transaction, final TileSet tset) { String id = tset.getId(); TileSet stored; if (null == (stored = tileSetById.get(transaction, id, LockMode.DEFAULT))) { log.debug("Creating TileSet for quota tracking: " + tset); tileSetById.putNoReturn(transaction, tset); stored = tset; Quota tileSetUsedQuota = new Quota(); tileSetUsedQuota.setTileSetId(tset.getId()); usedQuotaById.putNoReturn(transaction, tileSetUsedQuota); } return stored; }
private void addToUsedQuota( final Transaction tx, final TileSet tileSet, final Quota quotaDiff) { Quota usedQuota = usedQuotaByTileSetId.get(tx, tileSet.getId(), LockMode.DEFAULT); Quota globalQuota = usedQuotaByTileSetId.get(tx, GLOBAL_QUOTA_NAME, LockMode.DEFAULT); usedQuota.add(quotaDiff); globalQuota.add(quotaDiff); usedQuotaById.putNoReturn(tx, usedQuota); usedQuotaById.putNoReturn(tx, globalQuota); } }
pageById.putNoReturn(page);
pageById.putNoReturn(page);
public void out (K key, V value, long timeout) { Transaction txn = null; try { txn = dbe.beginTransaction (null, null); Ref ref = new Ref(key.toString(), value, timeout); pIndex.put (ref); if (timeout > 0L) gcpIndex.putNoReturn ( new GCRef (ref.getId(), ref.getExpiration()) ); txn.commit(); txn = null; synchronized (this) { notifyAll (); } if (sl != null) notifyListeners(key, value); } catch (Exception e) { throw new SpaceError (e); } finally { if (txn != null) abort (txn); } } public void push (K key, V value, long timeout) {
public PageStats call() throws Exception { Transaction tx = entityStore.getEnvironment().beginTransaction(null, null); try { PageStats pageStats = pageStatsByPageId.get(tx, tilePage.getId(), null); if (pageStats != null) { pageStats.setFillFactor(0f); pageStatsById.putNoReturn(tx, pageStats); } tx.commit(); return pageStats; } catch (Exception e) { tx.abort(); throw e; } } }
pageStats.addHitsAndAccessTime( addedHits, lastAccessTimeMinutes, creationTimeMinutes); pageStatsById.putNoReturn(tx, pageStats); allStats.add(pageStats);
pageStatsById.putNoReturn(tx, pageStats);
usedQuotaByTileSetId.get(transaction, newTileSetId, LockMode.DEFAULT); newQuota.setBytes(oldQuota.getBytes()); usedQuotaById.putNoReturn(transaction, newQuota); if (pageStats != null) { pageStats.setPageId(newPage.getId()); pageStatsById.putNoReturn(transaction, pageStats);