@Override public synchronized Serializable generate(AccessCallback callback) { final GenerationState generationState = locateGenerationState( callback.getTenantIdentifier() ); if ( generationState.lo > generationState.maxLo ) { generationState.lastSourceValue = callback.getNextValue(); generationState.lo = generationState.lastSourceValue.eq( 0 ) ? 1 : 0; generationState.hi = generationState.lastSourceValue.copy().multiplyBy( generationState.maxLo + 1 ); } generationState.value = generationState.hi.copy().add( generationState.lo++ ); return generationState.value.makeValue(); }
@Override public synchronized Serializable generate(AccessCallback callback) { final GenerationState generationState = locateGenerationState( callback.getTenantIdentifier() ); if ( generationState.hiValue == null ) { generationState.value = callback.getNextValue(); // unfortunately not really safe to normalize this // to 1 as an initial value like we do the others // because we would not be able to control this if // we are using a sequence... if ( generationState.value.lt( 1 ) ) { log.pooledOptimizerReportedInitialValue( generationState.value ); } // the call to obtain next-value just gave us the initialValue if ( ( initialValue == -1 && generationState.value.lt( incrementSize ) ) || generationState.value.eq( initialValue ) ) { generationState.hiValue = callback.getNextValue(); } else { generationState.hiValue = generationState.value; generationState.value = generationState.hiValue.copy().subtract( incrementSize - 1 ); } } else if ( generationState.value.gt( generationState.hiValue ) ) { generationState.hiValue = callback.getNextValue(); generationState.value = generationState.hiValue.copy().subtract( incrementSize - 1 ); } return generationState.value.makeValueThenIncrement(); }
@Override public synchronized Serializable generate(AccessCallback callback) { if ( lo > maxLo ) { lastSourceValue = callback.getNextValue(); lo = lastSourceValue.eq( 0 ) ? 1 : 0; hi = lastSourceValue.copy().multiplyBy( maxLo+1 ); } value = hi.copy().add( lo++ ); return value.makeValue(); }
@Override public synchronized Serializable generate(AccessCallback callback) { if ( lo > maxLo ) { lastSourceValue = callback.getNextValue(); lo = lastSourceValue.eq( 0 ) ? 1 : 0; hi = lastSourceValue.copy().multiplyBy( maxLo+1 ); } value = hi.copy().add( lo++ ); return value.makeValue(); }
@Override public synchronized Serializable generate(AccessCallback callback) { final GenerationState generationState = locateGenerationState( callback.getTenantIdentifier() ); if ( generationState.lo > generationState.maxLo ) { generationState.lastSourceValue = callback.getNextValue(); generationState.lo = generationState.lastSourceValue.eq( 0 ) ? 1 : 0; generationState.hi = generationState.lastSourceValue.copy().multiplyBy( generationState.maxLo + 1 ); } generationState.value = generationState.hi.copy().add( generationState.lo++ ); return generationState.value.makeValue(); }
@Override public synchronized Serializable generate(AccessCallback callback) { if ( hiValue == null ) { value = callback.getNextValue(); // unfortunately not really safe to normalize this // to 1 as an initial value like we do the others // because we would not be able to control this if // we are using a sequence... if (value.lt(1)) LOG.pooledOptimizerReportedInitialValue(value); // the call to obtain next-value just gave us the initialValue if ( ( initialValue == -1 && value.lt( incrementSize ) ) || value.eq( initialValue ) ) { hiValue = callback.getNextValue(); } else { hiValue = value; value = hiValue.copy().subtract( incrementSize ); } } else if ( ! hiValue.gt( value ) ) { hiValue = callback.getNextValue(); value = hiValue.copy().subtract( incrementSize ); } return value.makeValueThenIncrement(); }
@Override public synchronized Serializable generate(AccessCallback callback) { if ( hiValue == null ) { value = callback.getNextValue(); // unfortunately not really safe to normalize this // to 1 as an initial value like we do the others // because we would not be able to control this if // we are using a sequence... if (value.lt(1)) LOG.pooledOptimizerReportedInitialValue(value); // the call to obtain next-value just gave us the initialValue if ( ( initialValue == -1 && value.lt( incrementSize ) ) || value.eq( initialValue ) ) { hiValue = callback.getNextValue(); } else { hiValue = value; value = hiValue.copy().subtract( incrementSize ); } } else if ( ! hiValue.gt( value ) ) { hiValue = callback.getNextValue(); value = hiValue.copy().subtract( incrementSize ); } return value.makeValueThenIncrement(); }
@Override public synchronized Serializable generate(AccessCallback callback) { final GenerationState generationState = locateGenerationState( callback.getTenantIdentifier() ); if ( generationState.hiValue == null ) { generationState.value = callback.getNextValue(); // unfortunately not really safe to normalize this // to 1 as an initial value like we do the others // because we would not be able to control this if // we are using a sequence... if ( generationState.value.lt( 1 ) ) { log.pooledOptimizerReportedInitialValue( generationState.value ); } // the call to obtain next-value just gave us the initialValue if ( ( initialValue == -1 && generationState.value.lt( incrementSize ) ) || generationState.value.eq( initialValue ) ) { generationState.hiValue = callback.getNextValue(); } else { generationState.hiValue = generationState.value; generationState.value = generationState.hiValue.copy().subtract( incrementSize - 1 ); } } else if ( generationState.value.gt( generationState.hiValue ) ) { generationState.hiValue = callback.getNextValue(); generationState.value = generationState.hiValue.copy().subtract( incrementSize - 1 ); } return generationState.value.makeValueThenIncrement(); }