/** * Sets the maxOnDisk size * <p> * This property can be modified dynamically while the cache is operating. * * @param amount the amount of unit * @param memoryUnit the actual unit * @return this */ public CacheConfiguration maxBytesLocalDisk(final long amount, final MemoryUnit memoryUnit) { setMaxBytesLocalDisk(memoryUnit.toBytes(amount)); return this; }
/** * Setter for maxBytesOnDisk as a String. Value can have a one char unit suffix or be a percentage (ending in %) * <p> * This property can be modified dynamically while the cache is operating. * * @param maxBytesDisk String representation of the size, can be relative (in %) */ public void setMaxBytesLocalDisk(final String maxBytesDisk) { assertArgumentNotNull("Cache maxBytesLocalDisk", maxBytesDisk); if (isPercentage(maxBytesDisk)) { maxBytesLocalDiskPercentage = parsePercentage(maxBytesDisk); } else { setMaxBytesLocalDisk(MemoryUnit.parseSizeInBytes(maxBytesDisk)); } maxBytesLocalDiskExplicitlySet = true; maxBytesLocalDiskInput = maxBytesDisk; }
/** * {@inheritDoc} */ @Override public void setMaxBytesLocalDisk(long maxBytes) { try { if (cache.getCacheManager().getConfiguration().isMaxBytesLocalDiskSet()) { long diskPoolSize = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk(); if (maxBytes > diskPoolSize) { throw new IllegalArgumentException("Requested maxBytesLocalDisk (" + maxBytes + ") greater than available CacheManager disk pool size (" + diskPoolSize + ")"); } } cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ @Override public void setMaxBytesLocalDiskAsString(String maxBytes) { try { cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); } catch (RuntimeException e) { throw Utils.newPlainException(e); } if (cache.getCacheConfiguration().isMaxBytesLocalDiskPercentageSet()) { long cacheAssignedMem = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk() * cache.getCacheConfiguration().getMaxBytesLocalDiskPercentage() / PERCENTAGE_DIVISOR; setMaxBytesLocalDisk(cacheAssignedMem); } }
/** * Configures the cache pools * @param configuration the Configuration of the CacheManager managing this cache */ void configCachePools(Configuration configuration) { long cacheAssignedMem; if (getMaxBytesLocalHeapPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalHeap() * getMaxBytesLocalHeapPercentage() / HUNDRED_PERCENT; setMaxBytesLocalHeap(cacheAssignedMem); } if (offHeapPoolUsage == null && getMaxBytesLocalOffHeapPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalOffHeap() * getMaxBytesLocalOffHeapPercentage() / HUNDRED_PERCENT; setMaxBytesLocalOffHeap(cacheAssignedMem); } if (getMaxBytesLocalDiskPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalDisk() * getMaxBytesLocalDiskPercentage() / HUNDRED_PERCENT; setMaxBytesLocalDisk(cacheAssignedMem); } }
/** * Sets the maxOnDisk size * @param amount the amount of unit * @param memoryUnit the actual unit * @return this */ public CacheConfiguration maxBytesLocalDisk(final long amount, final MemoryUnit memoryUnit) { setMaxBytesLocalDisk(memoryUnit.toBytes(amount)); return this; }
/** * Sets the maxOnDisk size * <p> * This property can be modified dynamically while the cache is operating. * * @param amount the amount of unit * @param memoryUnit the actual unit * @return this */ public CacheConfiguration maxBytesLocalDisk(final long amount, final MemoryUnit memoryUnit) { setMaxBytesLocalDisk(memoryUnit.toBytes(amount)); return this; }
/** * Sets the maxOnDisk size * <p/> * This property can be modified dynamically while the cache is operating. * * @param amount the amount of unit * @param memoryUnit the actual unit * @return this */ public CacheConfiguration maxBytesLocalDisk(final long amount, final MemoryUnit memoryUnit) { setMaxBytesLocalDisk(memoryUnit.toBytes(amount)); return this; }
/** * Setter for maxBytesOnDisk as a String. Value can have a one char unit suffix or be a percentage (ending in %) * @param maxBytesDisk String representation of the size, can be relative (in %) */ public void setMaxBytesLocalDisk(final String maxBytesDisk) { assertArgumentNotNull("Cache maxBytesLocalDisk", maxBytesDisk); if (isPercentage(maxBytesDisk)) { maxBytesLocalDiskPercentage = parsePercentage(maxBytesDisk); } else { setMaxBytesLocalDisk(MemoryUnit.parseSizeInBytes(maxBytesDisk)); } maxBytesLocalDiskExplicitlySet = true; maxBytesLocalDiskInput = maxBytesDisk; }
/** * Setter for maxBytesOnDisk as a String. Value can have a one char unit suffix or be a percentage (ending in %) * <p> * This property can be modified dynamically while the cache is operating. * * @param maxBytesDisk String representation of the size, can be relative (in %) */ public void setMaxBytesLocalDisk(final String maxBytesDisk) { assertArgumentNotNull("Cache maxBytesLocalDisk", maxBytesDisk); if (isPercentage(maxBytesDisk)) { maxBytesLocalDiskPercentage = parsePercentage(maxBytesDisk); } else { setMaxBytesLocalDisk(MemoryUnit.parseSizeInBytes(maxBytesDisk)); } maxBytesLocalDiskExplicitlySet = true; maxBytesLocalDiskInput = maxBytesDisk; }
/** * Setter for maxBytesOnDisk as a String. Value can have a one char unit suffix or be a percentage (ending in %) * <p/> * This property can be modified dynamically while the cache is operating. * * @param maxBytesDisk String representation of the size, can be relative (in %) */ public void setMaxBytesLocalDisk(final String maxBytesDisk) { assertArgumentNotNull("Cache maxBytesLocalDisk", maxBytesDisk); if (isPercentage(maxBytesDisk)) { maxBytesLocalDiskPercentage = parsePercentage(maxBytesDisk); } else { setMaxBytesLocalDisk(MemoryUnit.parseSizeInBytes(maxBytesDisk)); } maxBytesLocalDiskExplicitlySet = true; maxBytesLocalDiskInput = maxBytesDisk; }
/** * {@inheritDoc} */ @Override public void setMaxBytesLocalDisk(long maxBytes) { try { if (cache.getCacheManager().getConfiguration().isMaxBytesLocalDiskSet()) { long diskPoolSize = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk(); if (maxBytes > diskPoolSize) { throw new IllegalArgumentException("Requested maxBytesLocalDisk (" + maxBytes + ") greater than available CacheManager disk pool size (" + diskPoolSize + ")"); } } cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ @Override public void setMaxBytesLocalDisk(long maxBytes) { try { if (cache.getCacheManager().getConfiguration().isMaxBytesLocalDiskSet()) { long diskPoolSize = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk(); if (maxBytes > diskPoolSize) { throw new IllegalArgumentException("Requested maxBytesLocalDisk (" + maxBytes + ") greater than available CacheManager disk pool size (" + diskPoolSize + ")"); } } cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ public void setMaxBytesLocalDisk(long maxBytes) { try { if (cache.getCacheManager().getConfiguration().isMaxBytesLocalDiskSet()) { long diskPoolSize = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk(); if (maxBytes > diskPoolSize) { throw new IllegalArgumentException("Requested maxBytesLocalDisk (" + maxBytes + ") greater than available CacheManager disk pool size (" + diskPoolSize + ")"); } } cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); } catch (RuntimeException e) { throw Utils.newPlainException(e); } }
/** * {@inheritDoc} */ public void setMaxBytesLocalDiskAsString(String maxBytes) { try { cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); } catch (RuntimeException e) { throw Utils.newPlainException(e); } if (cache.getCacheConfiguration().isMaxBytesLocalDiskPercentageSet()) { long cacheAssignedMem = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk() * cache.getCacheConfiguration().getMaxBytesLocalDiskPercentage() / PERCENTAGE_DIVISOR; setMaxBytesLocalDisk(cacheAssignedMem); } }
/** * {@inheritDoc} */ @Override public void setMaxBytesLocalDiskAsString(String maxBytes) { try { cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); } catch (RuntimeException e) { throw Utils.newPlainException(e); } if (cache.getCacheConfiguration().isMaxBytesLocalDiskPercentageSet()) { long cacheAssignedMem = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk() * cache.getCacheConfiguration().getMaxBytesLocalDiskPercentage() / PERCENTAGE_DIVISOR; setMaxBytesLocalDisk(cacheAssignedMem); } }
/** * {@inheritDoc} */ @Override public void setMaxBytesLocalDiskAsString(String maxBytes) { try { cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); } catch (RuntimeException e) { throw Utils.newPlainException(e); } if (cache.getCacheConfiguration().isMaxBytesLocalDiskPercentageSet()) { long cacheAssignedMem = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk() * cache.getCacheConfiguration().getMaxBytesLocalDiskPercentage() / PERCENTAGE_DIVISOR; setMaxBytesLocalDisk(cacheAssignedMem); } }
/** * Configures the cache pools * @param configuration the Configuration of the CacheManager managing this cache */ void configCachePools(Configuration configuration) { long cacheAssignedMem; if (getMaxBytesLocalHeapPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalHeap() * getMaxBytesLocalHeapPercentage() / HUNDRED_PERCENT; setMaxBytesLocalHeap(cacheAssignedMem); } if (offHeapPoolUsage == null && getMaxBytesLocalOffHeapPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalOffHeap() * getMaxBytesLocalOffHeapPercentage() / HUNDRED_PERCENT; setMaxBytesLocalOffHeap(cacheAssignedMem); } if (getMaxBytesLocalDiskPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalDisk() * getMaxBytesLocalDiskPercentage() / HUNDRED_PERCENT; setMaxBytesLocalDisk(cacheAssignedMem); } }
/** * Configures the cache pools * @param configuration the Configuration of the CacheManager managing this cache */ void configCachePools(Configuration configuration) { long cacheAssignedMem; if (getMaxBytesLocalHeapPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalHeap() * getMaxBytesLocalHeapPercentage() / HUNDRED_PERCENT; setMaxBytesLocalHeap(cacheAssignedMem); } if (offHeapPoolUsage == null && getMaxBytesLocalOffHeapPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalOffHeap() * getMaxBytesLocalOffHeapPercentage() / HUNDRED_PERCENT; setMaxBytesLocalOffHeap(cacheAssignedMem); } if (getMaxBytesLocalDiskPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalDisk() * getMaxBytesLocalDiskPercentage() / HUNDRED_PERCENT; setMaxBytesLocalDisk(cacheAssignedMem); } }
/** * Configures the cache pools * @param configuration the Configuration of the CacheManager managing this cache */ void configCachePools(Configuration configuration) { long cacheAssignedMem; if (getMaxBytesLocalHeapPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalHeap() * getMaxBytesLocalHeapPercentage() / HUNDRED_PERCENT; setMaxBytesLocalHeap(cacheAssignedMem); } if (offHeapPoolUsage == null && getMaxBytesLocalOffHeapPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalOffHeap() * getMaxBytesLocalOffHeapPercentage() / HUNDRED_PERCENT; setMaxBytesLocalOffHeap(cacheAssignedMem); } if (getMaxBytesLocalDiskPercentage() != null) { cacheAssignedMem = configuration.getMaxBytesLocalDisk() * getMaxBytesLocalDiskPercentage() / HUNDRED_PERCENT; setMaxBytesLocalDisk(cacheAssignedMem); } }