本文整理汇总了Java中org.hibernate.internal.util.config.ConfigurationHelper.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationHelper.getInt方法的具体用法?Java ConfigurationHelper.getInt怎么用?Java ConfigurationHelper.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.internal.util.config.ConfigurationHelper
的用法示例。
在下文中一共展示了ConfigurationHelper.getInt方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initiateService
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@Override
public BatchBuilder initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
final Object builder = configurationValues.get( BUILDER );
if ( builder == null ) {
return new BatchBuilderImpl(
ConfigurationHelper.getInt( Environment.STATEMENT_BATCH_SIZE, configurationValues, 1 )
);
}
if ( BatchBuilder.class.isInstance( builder ) ) {
return (BatchBuilder) builder;
}
final String builderClassName = builder.toString();
try {
return (BatchBuilder) registry.getService( ClassLoaderService.class ).classForName( builderClassName ).newInstance();
}
catch (Exception e) {
throw new ServiceException( "Could not build explicit BatchBuilder [" + builderClassName + "]", e );
}
}
示例2: QueryPlanCache
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
/**
* Constructs the QueryPlanCache to be used by the given SessionFactory
*
* @param factory The SessionFactory
*/
@SuppressWarnings("deprecation")
public QueryPlanCache(final SessionFactoryImplementor factory) {
this.factory = factory;
Integer maxParameterMetadataCount = ConfigurationHelper.getInteger(
Environment.QUERY_PLAN_CACHE_PARAMETER_METADATA_MAX_SIZE,
factory.getProperties()
);
if ( maxParameterMetadataCount == null ) {
maxParameterMetadataCount = ConfigurationHelper.getInt(
Environment.QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES,
factory.getProperties(),
DEFAULT_PARAMETER_METADATA_MAX_COUNT
);
}
Integer maxQueryPlanCount = ConfigurationHelper.getInteger(
Environment.QUERY_PLAN_CACHE_MAX_SIZE,
factory.getProperties()
);
if ( maxQueryPlanCount == null ) {
maxQueryPlanCount = ConfigurationHelper.getInt(
Environment.QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES,
factory.getProperties(),
DEFAULT_QUERY_PLAN_MAX_COUNT
);
}
queryPlanCache = new BoundedConcurrentHashMap( maxQueryPlanCount, 20, BoundedConcurrentHashMap.Eviction.LIRS );
parameterMetadataCache = new BoundedConcurrentHashMap<String, ParameterMetadata>(
maxParameterMetadataCount,
20,
BoundedConcurrentHashMap.Eviction.LIRS
);
nativeQueryInterpreterService = factory.getServiceRegistry().getService( NativeQueryInterpreter.class );
}
示例3: configure
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
public void configure(Type type, Properties params, Dialect d) throws MappingException {
super.configure(type, params, d);
maxLo = ConfigurationHelper.getInt( MAX_LO, params, 9 );
if ( maxLo >= 1 ) {
hiloOptimizer = new LegacyHiLoAlgorithmOptimizer(
getIdentifierType().getReturnedClass(),
maxLo
);
}
}
示例4: configure
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@Override
public void configure(Type type, Properties params, Dialect d) {
super.configure( type, params, d );
maxLo = ConfigurationHelper.getInt( MAX_LO, params, Short.MAX_VALUE );
if ( maxLo >= 1 ) {
hiloOptimizer = new LegacyHiLoAlgorithmOptimizer( type.getReturnedClass(), maxLo );
}
}
示例5: getLockTimeoutInMillis
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
public static int getLockTimeoutInMillis(final Properties props) {
int timeout = -1;
try {
timeout = ConfigurationHelper.getInt(LOCK_TIMEOUT, props, -1);
} catch (Exception e) {
Logger.getLogger(CacheEnvironment.class).finest(e);
}
if (timeout < 0) {
timeout = MAXIMUM_LOCK_TIMEOUT;
}
return timeout;
}
示例6: getLockTimeoutInMillis
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
public static int getLockTimeoutInMillis(Properties props) {
int timeout = -1;
try {
timeout = ConfigurationHelper.getInt(LOCK_TIMEOUT, props, -1);
} catch (Exception e) {
Logger.getLogger(CacheEnvironment.class).finest(e);
}
if (timeout < 0) {
timeout = MAXIMUM_LOCK_TIMEOUT;
}
return timeout;
}
示例7: configure
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@Override
public void configure(Map configurationValues) {
log.usingHibernateBuiltInConnectionPool();
connectionCreator = buildCreator( configurationValues );
final int minSize = ConfigurationHelper.getInt( MIN_SIZE, configurationValues, 1 );
final int maxSize = ConfigurationHelper.getInt( AvailableSettings.POOL_SIZE, configurationValues, 20 );
final int initialSize = ConfigurationHelper.getInt( INITIAL_SIZE, configurationValues, minSize );
final long validationInterval = ConfigurationHelper.getLong( VALIDATION_INTERVAL, configurationValues, 30 );
log.hibernateConnectionPoolSize( maxSize, minSize );
log.debugf( "Initializing Connection pool with %s Connections", initialSize );
for ( int i = 0; i < initialSize; i++ ) {
connections.add( connectionCreator.createConnection() );
}
executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleWithFixedDelay(
new Runnable() {
private boolean primed;
@Override
public void run() {
int size = connections.size();
if ( !primed && size >= minSize ) {
// IMPL NOTE : the purpose of primed is to allow the pool to lazily reach its
// defined min-size.
log.debug( "Connection pool now considered primed; min-size will be maintained" );
primed = true;
}
if ( size < minSize && primed ) {
int numberToBeAdded = minSize - size;
log.debugf( "Adding %s Connections to the pool", numberToBeAdded );
for (int i = 0; i < numberToBeAdded; i++) {
connections.add( connectionCreator.createConnection() );
}
}
else if ( size > maxSize ) {
int numberToBeRemoved = size - maxSize;
log.debugf( "Removing %s Connections from the pool", numberToBeRemoved );
for ( int i = 0; i < numberToBeRemoved; i++ ) {
Connection connection = connections.poll();
try {
connection.close();
}
catch (SQLException e) {
log.unableToCloseConnection( e );
}
}
}
}
},
validationInterval,
validationInterval,
TimeUnit.SECONDS
);
}
示例8: configure
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
@Override
public void configure(Map configurationValues) {
size = ConfigurationHelper.getInt( Environment.STATEMENT_BATCH_SIZE, configurationValues, size );
}
示例9: determineInitialValue
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
protected int determineInitialValue(Properties params) {
return ConfigurationHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE );
}
示例10: determineIncrementSize
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
protected int determineIncrementSize(Properties params) {
return ConfigurationHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE );
}
示例11: configure
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
tableName = normalizer.normalizeIdentifierQuoting( ConfigurationHelper.getString( ID_TABLE, params, DEFAULT_TABLE ) );
if ( tableName.indexOf( '.' ) < 0 ) {
tableName = dialect.quote( tableName );
final String schemaName = dialect.quote(
normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) )
);
final String catalogName = dialect.quote(
normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) )
);
tableName = Table.qualify( catalogName, schemaName, tableName );
}
else {
// if already qualified there is not much we can do in a portable manner so we pass it
// through and assume the user has set up the name correctly.
}
pkColumnName = dialect.quote(
normalizer.normalizeIdentifierQuoting(
ConfigurationHelper.getString( PK_COLUMN_NAME, params, DEFAULT_PK_COLUMN )
)
);
valueColumnName = dialect.quote(
normalizer.normalizeIdentifierQuoting(
ConfigurationHelper.getString( VALUE_COLUMN_NAME, params, DEFAULT_VALUE_COLUMN )
)
);
keySize = ConfigurationHelper.getInt(PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH);
String keyValue = ConfigurationHelper.getString(PK_VALUE_NAME, params, params.getProperty(TABLE) );
query = "select " +
valueColumnName +
" from " +
dialect.appendLockHint( LockMode.PESSIMISTIC_WRITE, tableName ) +
" where " + pkColumnName + " = '" + keyValue + "'" +
dialect.getForUpdateString();
update = "update " +
tableName +
" set " +
valueColumnName +
" = ? where " +
valueColumnName +
" = ? and " +
pkColumnName +
" = '" +
keyValue
+ "'";
insert = "insert into " + tableName +
"(" + pkColumnName + ", " + valueColumnName + ") " +
"values('"+ keyValue +"', ?)";
//hilo config
maxLo = ConfigurationHelper.getInt(MAX_LO, params, Short.MAX_VALUE);
returnClass = type.getReturnedClass();
if ( maxLo >= 1 ) {
hiloOptimizer = new LegacyHiLoAlgorithmOptimizer( returnClass, maxLo );
}
}
示例12: determineInitialValue
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
/**
* Determine the initial sequence value to use. This value is used when
* initializing the {@link #getDatabaseStructure() database structure}
* (i.e. sequence/table).
* <p/>
* Called during {@link #configure configuration}.
*
* @param params The params supplied in the generator config (plus some standard useful extras).
* @return The initial value
*/
protected int determineInitialValue(Properties params) {
return ConfigurationHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE );
}
示例13: determineIncrementSize
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
/**
* Determine the increment size to be applied. The exact implications of
* this value depends on the {@link #getOptimizer() optimizer} being used.
* <p/>
* Called during {@link #configure configuration}.
*
* @param params The params supplied in the generator config (plus some standard useful extras).
* @return The increment size
*/
protected int determineIncrementSize(Properties params) {
return ConfigurationHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE );
}
示例14: determineSegmentColumnSize
import org.hibernate.internal.util.config.ConfigurationHelper; //导入方法依赖的package包/类
/**
* Determine the size of the {@link #getSegmentColumnName segment column}
* <p/>
* Called during {@link #configure configuration}.
*
* @see #getSegmentValueLength()
* @param params The params supplied in the generator config (plus some standard useful extras).
* @return The size of the segment column
*/
protected int determineSegmentColumnSize(Properties params) {
return ConfigurationHelper.getInt( SEGMENT_LENGTH_PARAM, params, DEF_SEGMENT_LENGTH );
}