public Usage(T parent, String name, float portion) { this.parent = parent; this.usagePortion = portion; if (parent != null) { this.limiter.setLimit((long) (parent.getLimit() * (double)portion)); name = parent.name + ":" + name; } this.name = name; }
/** * Sets the memory limit in bytes. Setting the limit in bytes will set the usagePortion to 0 since the UsageManager * is not going to be portion based off the parent. When set using Xbean, values of the form "20 Mb", "1024kb", and * "1g" can be used * * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setLimit(long limit) { if (percentUsageMinDelta < 0) { throw new IllegalArgumentException("percentUsageMinDelta must be greater or equal to 0"); } usageLock.writeLock().lock(); try { this.limiter.setLimit(limit); this.usagePortion = 0; } finally { usageLock.writeLock().unlock(); } onLimitChange(); }
protected void onLimitChange() { // We may need to calculate the limit if (usagePortion > 0 && parent != null) { usageLock.writeLock().lock(); try { this.limiter.setLimit((long) (parent.getLimit() * (double) usagePortion)); } finally { usageLock.writeLock().unlock(); } } // Reset the percent currently being used. usageLock.writeLock().lock(); try { setPercentUsage(caclPercentUsage()); } finally { usageLock.writeLock().unlock(); } // Let the children know that the limit has changed. They may need to // set their limits based on ours. for (T child : children) { child.onLimitChange(); } }
public StoreUsage copy() { StoreUsage storeUsage = new StoreUsage(); storeUsage.name = name; storeUsage.parent = parent; storeUsage.total = total; storeUsage.percentLimit = percentLimit; storeUsage.getLimiter().setLimit(getLimiter().getLimit()); return storeUsage; } }
public Usage(T parent, String name, float portion) { this.parent = parent; this.usagePortion = portion; if (parent != null) { this.limiter.setLimit((long) (parent.getLimit() * (double)portion)); name = parent.name + ":" + name; } this.name = name; }
public Usage(T parent, String name, float portion) { this.parent = parent; this.usagePortion = portion; if (parent != null) { this.limiter.setLimit((long) (parent.getLimit() * (double)portion)); name = parent.name + ":" + name; } this.name = name; }
public Usage(T parent, String name, float portion) { this.parent = parent; this.usagePortion = portion; if (parent != null) { this.limiter.setLimit((long) (parent.getLimit() * (double)portion)); name = parent.name + ":" + name; } this.name = name; }
public Usage(T parent, String name, float portion) { this.parent = parent; this.usagePortion = portion; if (parent != null) { this.limiter.setLimit((long)(parent.getLimit() * portion)); name = parent.name + ":" + name; } this.name = name; }
/** * Sets the memory limit in bytes. Setting the limit in bytes will set the * usagePortion to 0 since the UsageManager is not going to be portion based * off the parent. * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used * * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setLimit(long limit) { if (percentUsageMinDelta < 0) { throw new IllegalArgumentException("percentUsageMinDelta must be greater or equal to 0"); } synchronized (usageMutex) { this.limiter.setLimit(limit); this.usagePortion = 0; } onLimitChange(); }
/** * Sets the memory limit in bytes. Setting the limit in bytes will set the usagePortion to 0 since the UsageManager * is not going to be portion based off the parent. When set using Xbean, values of the form "20 Mb", "1024kb", and * "1g" can be used * * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setLimit(long limit) { if (percentUsageMinDelta < 0) { throw new IllegalArgumentException("percentUsageMinDelta must be greater or equal to 0"); } usageLock.writeLock().lock(); try { this.limiter.setLimit(limit); this.usagePortion = 0; } finally { usageLock.writeLock().unlock(); } onLimitChange(); }
/** * Sets the memory limit in bytes. Setting the limit in bytes will set the usagePortion to 0 since the UsageManager * is not going to be portion based off the parent. When set using Xbean, values of the form "20 Mb", "1024kb", and * "1g" can be used * * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setLimit(long limit) { if (percentUsageMinDelta < 0) { throw new IllegalArgumentException("percentUsageMinDelta must be greater or equal to 0"); } usageLock.writeLock().lock(); try { this.limiter.setLimit(limit); this.usagePortion = 0; } finally { usageLock.writeLock().unlock(); } onLimitChange(); }
/** * Sets the memory limit in bytes. Setting the limit in bytes will set the usagePortion to 0 since the UsageManager * is not going to be portion based off the parent. When set using Xbean, values of the form "20 Mb", "1024kb", and * "1g" can be used * * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setLimit(long limit) { if (percentUsageMinDelta < 0) { throw new IllegalArgumentException("percentUsageMinDelta must be greater or equal to 0"); } usageLock.writeLock().lock(); try { this.limiter.setLimit(limit); this.usagePortion = 0; } finally { usageLock.writeLock().unlock(); } onLimitChange(); }
protected void onLimitChange() { // We may need to calculate the limit if (usagePortion > 0 && parent != null) { usageLock.writeLock().lock(); try { this.limiter.setLimit((long) (parent.getLimit() * (double) usagePortion)); } finally { usageLock.writeLock().unlock(); } } // Reset the percent currently being used. usageLock.writeLock().lock(); try { setPercentUsage(caclPercentUsage()); } finally { usageLock.writeLock().unlock(); } // Let the children know that the limit has changed. They may need to // set their limits based on ours. for (T child : children) { child.onLimitChange(); } }
protected void onLimitChange() { // We may need to calculate the limit if (usagePortion > 0 && parent != null) { usageLock.writeLock().lock(); try { this.limiter.setLimit((long) (parent.getLimit() * (double) usagePortion)); } finally { usageLock.writeLock().unlock(); } } // Reset the percent currently being used. usageLock.writeLock().lock(); try { setPercentUsage(caclPercentUsage()); } finally { usageLock.writeLock().unlock(); } // Let the children know that the limit has changed. They may need to // set their limits based on ours. for (T child : children) { child.onLimitChange(); } }
protected void onLimitChange() { // We may need to calculate the limit if (usagePortion > 0 && parent != null) { usageLock.writeLock().lock(); try { this.limiter.setLimit((long) (parent.getLimit() * (double) usagePortion)); } finally { usageLock.writeLock().unlock(); } } // Reset the percent currently being used. usageLock.writeLock().lock(); try { setPercentUsage(caclPercentUsage()); } finally { usageLock.writeLock().unlock(); } // Let the children know that the limit has changed. They may need to // set their limits based on ours. for (T child : children) { child.onLimitChange(); } }
public StoreUsage copy() { StoreUsage storeUsage = new StoreUsage(); storeUsage.name = name; storeUsage.parent = parent; storeUsage.total = total; storeUsage.percentLimit = percentLimit; storeUsage.getLimiter().setLimit(getLimiter().getLimit()); return storeUsage; } }
public StoreUsage copy() { StoreUsage storeUsage = new StoreUsage(); storeUsage.name = name; storeUsage.parent = parent; storeUsage.total = total; storeUsage.percentLimit = percentLimit; storeUsage.getLimiter().setLimit(getLimiter().getLimit()); return storeUsage; } }
public StoreUsage copy() { StoreUsage storeUsage = new StoreUsage(); storeUsage.name = name; storeUsage.parent = parent; storeUsage.total = total; storeUsage.percentLimit = percentLimit; storeUsage.getLimiter().setLimit(getLimiter().getLimit()); return storeUsage; } }
protected void onLimitChange() { // We may need to calculate the limit if (usagePortion > 0 && parent != null) { synchronized (usageMutex) { this.limiter.setLimit((long)(parent.getLimit() * usagePortion)); } } // Reset the percent currently being used. int percentUsage; synchronized (usageMutex) { percentUsage = caclPercentUsage(); } setPercentUsage(percentUsage); // Let the children know that the limit has changed. They may need to // set // their limits based on ours. for (T child : children) { child.onLimitChange(); } }