com.sleepycat.je.Transaction.setTxnTimeout()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(71)

本文整理了Java中com.sleepycat.je.Transaction.setTxnTimeout()方法的一些代码示例,展示了Transaction.setTxnTimeout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.setTxnTimeout()方法的具体详情如下:
包路径:com.sleepycat.je.Transaction
类名称:Transaction
方法名:setTxnTimeout

Transaction.setTxnTimeout介绍

[英]Configures the timeout value for the transaction lifetime, with the timeout value specified in microseconds. This method is equivalent to:

setTxnTimeout(long, TimeUnit.MICROSECONDS);

[中]配置事务生存期的超时值,以微秒为单位指定超时值。此方法相当于:

setTxnTimeout(long, TimeUnit.MICROSECONDS);

代码示例

代码示例来源:origin: com.sleepycat/je

/**
 * Configures the timeout value for the transaction lifetime, with the
 * timeout value specified in microseconds.  This method is equivalent to:
 *
 * <pre>setTxnTimeout(long, TimeUnit.MICROSECONDS);</pre>
 *
 * @deprecated as of 4.0, replaced by {@link #setTxnTimeout(long,
 * TimeUnit)}.
 */
public void setTxnTimeout(long timeOut)
  throws IllegalArgumentException, DatabaseException {
  setTxnTimeout(timeOut, TimeUnit.MICROSECONDS);
}

代码示例来源:origin: com.amazon.carbonado/carbonado-sleepycat-je

void setTxnTimeout(long timeout) throws DatabaseException {
  mTxn.setTxnTimeout(timeout);
}

代码示例来源:origin: com.projectdarkstar.server/sgs-server

/**
 * Creates an instance of this class.
 *
 * @param    env the Berkeley DB environment
 * @param    timeout the number of milliseconds the transaction should be
 *        allowed to run
 * @param    txnConfig the Berkeley DB transaction configuration, or {@code
 *        null} for the default
 * @throws    IllegalArgumentException if timeout is less than {@code 1}
 * @throws    DbDatabaseException if an unexpected database problem occurs
 */
JeTransaction(
XAEnvironment env, long timeout, TransactionConfig txnConfig)
{
this.env = env;
if (timeout <= 0) {
  throw new IllegalArgumentException(
  "Timeout must be greater than 0");
}
try {
  txn = env.beginTransaction(null, txnConfig);
  /* Avoid overflow -- BDB treats 0 as unlimited */
  long timeoutMicros =
  (timeout < (Long.MAX_VALUE / 1000)) ? timeout * 1000 : 0;
  txn.setTxnTimeout(timeoutMicros);
} catch (DatabaseException e) {
  throw JeEnvironment.convertException(e, false);
}
}

代码示例来源:origin: org.reddwarfserver.server/sgs-server

/**
 * Creates an instance of this class.
 *
 * @param    env the Berkeley DB environment
 * @param    timeout the number of milliseconds the transaction should be
 *        allowed to run
 * @param    txnConfig the Berkeley DB transaction configuration, or {@code
 *        null} for the default
 * @throws    IllegalArgumentException if timeout is less than {@code 1}
 * @throws    DbDatabaseException if an unexpected database problem occurs
 */
JeTransaction(
XAEnvironment env, long timeout, TransactionConfig txnConfig)
{
this.env = env;
if (timeout <= 0) {
  throw new IllegalArgumentException(
  "Timeout must be greater than 0");
}
try {
  txn = env.beginTransaction(null, txnConfig);
  /* Avoid overflow -- BDB treats 0 as unlimited */
  long timeoutMicros =
  (timeout < (Long.MAX_VALUE / 1000)) ? timeout * 1000 : 0;
  txn.setTxnTimeout(timeoutMicros);
} catch (DatabaseException e) {
  throw JeEnvironment.convertException(e, false);
}
}

代码示例来源:origin: dworkin/reddwarf

/**
 * Creates an instance of this class.
 *
 * @param    env the Berkeley DB environment
 * @param    timeout the number of milliseconds the transaction should be
 *        allowed to run
 * @param    txnConfig the Berkeley DB transaction configuration, or {@code
 *        null} for the default
 * @throws    IllegalArgumentException if timeout is less than {@code 1}
 * @throws    DbDatabaseException if an unexpected database problem occurs
 */
JeTransaction(
XAEnvironment env, long timeout, TransactionConfig txnConfig)
{
this.env = env;
if (timeout <= 0) {
  throw new IllegalArgumentException(
  "Timeout must be greater than 0");
}
try {
  txn = env.beginTransaction(null, txnConfig);
  /* Avoid overflow -- BDB treats 0 as unlimited */
  long timeoutMicros =
  (timeout < (Long.MAX_VALUE / 1000)) ? timeout * 1000 : 0;
  txn.setTxnTimeout(timeoutMicros);
} catch (DatabaseException e) {
  throw JeEnvironment.convertException(e, false);
}
}

相关文章