/** * Sets the minimum number of percentage points the usage has to change before a UsageListener event is fired by the * manager. * * @param percentUsageMinDelta * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setPercentUsageMinDelta(int percentUsageMinDelta) { if (percentUsageMinDelta < 1) { throw new IllegalArgumentException("percentUsageMinDelta must be greater than 0"); } usageLock.writeLock().lock(); try { this.percentUsageMinDelta = percentUsageMinDelta; setPercentUsage(caclPercentUsage()); } finally { usageLock.writeLock().unlock(); } }
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(); } }
/** * Sets the minimum number of percentage points the usage has to change before a UsageListener event is fired by the * manager. * * @param percentUsageMinDelta * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setPercentUsageMinDelta(int percentUsageMinDelta) { if (percentUsageMinDelta < 1) { throw new IllegalArgumentException("percentUsageMinDelta must be greater than 0"); } usageLock.writeLock().lock(); try { this.percentUsageMinDelta = percentUsageMinDelta; setPercentUsage(caclPercentUsage()); } finally { usageLock.writeLock().unlock(); } }
/** * Sets the minimum number of percentage points the usage has to change * before a UsageListener event is fired by the manager. * * @param percentUsageMinDelta * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setPercentUsageMinDelta(int percentUsageMinDelta) { if (percentUsageMinDelta < 1) { throw new IllegalArgumentException("percentUsageMinDelta must be greater than 0"); } int percentUsage; synchronized (usageMutex) { this.percentUsageMinDelta = percentUsageMinDelta; percentUsage = caclPercentUsage(); } setPercentUsage(percentUsage); }
/** * Sets the minimum number of percentage points the usage has to change before a UsageListener event is fired by the * manager. * * @param percentUsageMinDelta * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setPercentUsageMinDelta(int percentUsageMinDelta) { if (percentUsageMinDelta < 1) { throw new IllegalArgumentException("percentUsageMinDelta must be greater than 0"); } usageLock.writeLock().lock(); try { this.percentUsageMinDelta = percentUsageMinDelta; setPercentUsage(caclPercentUsage()); } finally { usageLock.writeLock().unlock(); } }
/** * Sets the minimum number of percentage points the usage has to change before a UsageListener event is fired by the * manager. * * @param percentUsageMinDelta * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setPercentUsageMinDelta(int percentUsageMinDelta) { if (percentUsageMinDelta < 1) { throw new IllegalArgumentException("percentUsageMinDelta must be greater than 0"); } usageLock.writeLock().lock(); try { this.percentUsageMinDelta = percentUsageMinDelta; setPercentUsage(caclPercentUsage()); } finally { usageLock.writeLock().unlock(); } }
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(); } }
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(); } }