当前位置: 首页>>代码示例>>Java>>正文


Java LockOptions.NO_WAIT属性代码示例

本文整理汇总了Java中org.hibernate.LockOptions.NO_WAIT属性的典型用法代码示例。如果您正苦于以下问题:Java LockOptions.NO_WAIT属性的具体用法?Java LockOptions.NO_WAIT怎么用?Java LockOptions.NO_WAIT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.hibernate.LockOptions的用法示例。


在下文中一共展示了LockOptions.NO_WAIT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendLockHint

@Override
public String appendLockHint(LockOptions lockOptions, String tableName) {
	// NOTE : since SQLServer2005 the nowait hint is supported
	if ( lockOptions.getLockMode() == LockMode.UPGRADE_NOWAIT ) {
		return tableName + " with (updlock, rowlock, nowait)";
	}

	final LockMode mode = lockOptions.getLockMode();
	final boolean isNoWait = lockOptions.getTimeOut() == LockOptions.NO_WAIT;
	final String noWaitStr = isNoWait ? ", nowait" : "";
	switch ( mode ) {
		case UPGRADE_NOWAIT:
			return tableName + " with (updlock, rowlock, nowait)";
		case UPGRADE:
		case PESSIMISTIC_WRITE:
		case WRITE:
			return tableName + " with (updlock, rowlock" + noWaitStr + " )";
		case PESSIMISTIC_READ:
			return tableName + " with (holdlock, rowlock" + noWaitStr + " )";
		default:
			return tableName;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:SQLServer2005Dialect.java

示例2: determineSql

protected String determineSql(int timeout) {
	if ( timeout == LockOptions.WAIT_FOREVER) {
		return waitForeverSql;
	}
	else if ( timeout == LockOptions.NO_WAIT) {
		return getNoWaitSql();
	}
	else if ( timeout == LockOptions.SKIP_LOCKED) {
		return getSkipLockedSql();
	}
	else {
		return generateLockString( timeout );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:AbstractSelectLockingStrategy.java

示例3: getWriteLockString

@Override
public String getWriteLockString(int timeout) {
	if ( timeout == LockOptions.NO_WAIT ) {
		return " for update nowait";
	}
	else {
		return " for update";
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:PostgreSQL81Dialect.java

示例4: getReadLockString

@Override
public String getReadLockString(int timeout) {
	if ( timeout == LockOptions.NO_WAIT ) {
		return " for share nowait";
	}
	else {
		return " for share";
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:PostgreSQL81Dialect.java

示例5: getWriteLockString

@Override
public String getWriteLockString(int timeout) {
	if ( timeout == LockOptions.NO_WAIT ) {
		return " for update nowait";
	}
	else if ( timeout > 0 ) {
		// convert from milliseconds to seconds
		final float seconds = timeout / 1000.0f;
		timeout = Math.round( seconds );
		return " for update wait " + timeout;
	}
	else {
		return " for update";
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:Oracle9iDialect.java


注:本文中的org.hibernate.LockOptions.NO_WAIT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。