/** * {@inheritDoc} */ public PoolAccessor createPoolAccessor(PoolParticipant participant, SizeOfEngine sizeOfEngine) { LockedPoolAccessor accessor = new LockedPoolAccessor(this, participant, sizeOfEngine, 0); registerPoolAccessor(accessor); return accessor; } }
/** * {@inheritDoc} */ public long delete(long sizeOf) throws IllegalArgumentException { checkLinked(); // if (sizeOf < 0L) { // throw new IllegalArgumentException("cannot delete negative size"); // } // synchronized makes the size update MT-safe but slow lock.lock(); try { size -= sizeOf; } finally { lock.unlock(); } return sizeOf; }
try { while (true) { long newSize = getPool().getSize() + sizeOf; if (newSize <= getPool().getMaxSize()) { } else { if (!force && sizeOf > getPool().getMaxSize()) { long missingSize = newSize - getPool().getMaxSize(); boolean successful = getPool().getEvictor().freeSpace(getPool().getPoolAccessors(), missingSize); if (!force && !successful) { if (!force && getPool().getSize() + sizeOf > getPool().getMaxSize()) { continue;
/** * {@inheritDoc} */ public PoolAccessor createPoolAccessor(PoolParticipant participant, SizeOfEngine sizeOfEngine) { LockedPoolAccessor accessor = new LockedPoolAccessor(this, participant, sizeOfEngine, 0); registerPoolAccessor(accessor); return accessor; } }
/** * {@inheritDoc} */ public long delete(long sizeOf) { checkLinked(); // synchronized makes the size update MT-safe but slow lock.lock(); try { size -= sizeOf; } finally { lock.unlock(); } return sizeOf; }
/** * {@inheritDoc} */ public PoolAccessor createPoolAccessor(PoolParticipant participant, SizeOfEngine sizeOfEngine) { LockedPoolAccessor accessor = new LockedPoolAccessor(this, participant, sizeOfEngine, 0); registerPoolAccessor(accessor); return accessor; } }
/** * {@inheritDoc} */ public long delete(long sizeOf) throws IllegalArgumentException { checkLinked(); // if (sizeOf < 0L) { // throw new IllegalArgumentException("cannot delete negative size"); // } // synchronized makes the size update MT-safe but slow lock.lock(); try { size -= sizeOf; } finally { lock.unlock(); } return sizeOf; }
/** * {@inheritDoc} */ public PoolAccessor createPoolAccessor(PoolableStore store, SizeOfEngine sizeOfEngine) { LockedPoolAccessor accessor = new LockedPoolAccessor(this, store, sizeOfEngine, 0); registerPoolAccessor(accessor); return accessor; } }
/** * {@inheritDoc} */ public long delete(long sizeOf) throws IllegalArgumentException { checkLinked(); // if (sizeOf < 0L) { // throw new IllegalArgumentException("cannot delete negative size"); // } // synchronized makes the size update MT-safe but slow lock.lock(); try { size -= sizeOf; } finally { lock.unlock(); } return sizeOf; }
try { while (true) { long newSize = getPool().getSize() + sizeOf; if (newSize <= getPool().getMaxSize()) { } else { if (!force && sizeOf > getPool().getMaxSize()) { long missingSize = newSize - getPool().getMaxSize(); boolean successful = getPool().getEvictor().freeSpace(getPool().getPoolAccessors(), missingSize); if (!force && !successful) { if (!force && getPool().getSize() + sizeOf > getPool().getMaxSize()) { continue;
try { while (true) { long newSize = getPool().getSize() + sizeOf; if (newSize <= getPool().getMaxSize()) { } else { if (!force && sizeOf > getPool().getMaxSize()) { long missingSize = newSize - getPool().getMaxSize(); boolean successful = getPool().getEvictor().freeSpace(getPool().getPoolableStores(), missingSize); if (!force && !successful) { if (!force && getPool().getSize() + sizeOf > getPool().getMaxSize()) { continue;
try { while (true) { long newSize = getPool().getSize() + sizeOf; if (newSize <= getPool().getMaxSize()) { } else { if (!force && sizeOf > getPool().getMaxSize()) { long missingSize = newSize - getPool().getMaxSize(); boolean successful = getPool().getEvictor().freeSpace(getPool().getPoolAccessors(), missingSize); if (!force && !successful) { if (!force && getPool().getSize() + sizeOf > getPool().getMaxSize()) { continue;