public synchronized Runnable addAllocationThreshold(ThresholdDirection direction,long threshold,Runnable action){
switch (direction) {
case RISING:
    return risingThresholds.put(threshold,action);
case FALLING:
  return fallingThresholds.put(threshold,action);
}
throw new AssertionError();
}

public synchronized Runnable addAllocationThreshold ( ThresholdDirection direction , long threshold , Runnable action ) { switch ( direction ) { case RISING : return risingThresholds . put ( threshold , action ) ; case FALLING : return fallingThresholds . put ( threshold , action ) ; } throw new AssertionError ( ) ; }
adds an allocation threshold action . < p > there can be only a single action associated with each unique direction and threshold combination . if an action is already associated with the supplied combination then the action is replaced by the new action and the old action is returned . < p > actions are fired on passing through the supplied threshold and are called synchronously with the triggering allocation . this means care must be taken to avoid mutating any map that uses this page source from within the action otherwise deadlocks may result . exceptions thrown by the action will be caught and logged by the page source and will not be propagated on the allocating thread .
