提交 88e6a94a authored 作者: Andrei Tokar's avatar Andrei Tokar

Reduce timeoutMillis from long to int

上级 245ea350
......@@ -335,7 +335,7 @@ public class Database implements DataHandler {
}
}
public long getLockTimeout() {
public int getLockTimeout() {
Setting setting = findSetting(
SetTypes.getTypeName(SetTypes.DEFAULT_LOCK_TIMEOUT));
return setting == null ? Constants.INITIAL_LOCK_TIMEOUT : setting.getIntValue();
......
......@@ -169,7 +169,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
this.undoLog = new UndoLog(this);
this.user = user;
this.id = id;
this.lockTimeout = (int)database.getLockTimeout();
this.lockTimeout = database.getLockTimeout();
this.currentSchemaName = Constants.SCHEMA_MAIN;
this.columnNamerConfiguration = ColumnNamerConfiguration.getDefault();
}
......
......@@ -126,7 +126,7 @@ public class Transaction {
/**
* How long to wait for blocking transaction to commit or rollback.
*/
final long timeoutMillis;
final int timeoutMillis;
/**
* Identification of the owner of this transaction,
......@@ -151,7 +151,7 @@ public class Transaction {
Transaction(TransactionStore store, int transactionId, long sequenceNum, int status,
String name, long logId, long timeoutMillis, int ownerId,
String name, long logId, int timeoutMillis, int ownerId,
TransactionStore.RollbackListener listener) {
this.store = store;
this.transactionId = transactionId;
......@@ -513,7 +513,7 @@ public class Transaction {
return false;
}
private synchronized boolean waitForThisToEnd(long millis) {
private synchronized boolean waitForThisToEnd(int millis) {
long until = System.currentTimeMillis() + millis;
int status;
while((status = getStatus()) != STATUS_CLOSED && status != STATUS_ROLLING_BACK) {
......
......@@ -33,7 +33,7 @@ public class TransactionStore {
/**
* Default blocked transaction timeout
*/
private final long timeoutMillis;
private final int timeoutMillis;
/**
* The persisted map of prepared transactions.
......@@ -123,7 +123,7 @@ public class TransactionStore {
* @param dataType the data type for map keys and values
* @param timeoutMillis lock aquisition timeout in milliseconds, 0 means no wait
*/
public TransactionStore(MVStore store, DataType dataType, long timeoutMillis) {
public TransactionStore(MVStore store, DataType dataType, int timeoutMillis) {
this.store = store;
this.dataType = dataType;
this.timeoutMillis = timeoutMillis;
......@@ -302,7 +302,7 @@ public class TransactionStore {
* @param ownerId of the owner (Session?) to be reported by getBlockerId
* @return the transaction
*/
public Transaction begin(RollbackListener listener, long timeoutMillis, int ownerId) {
public Transaction begin(RollbackListener listener, int timeoutMillis, int ownerId) {
if(timeoutMillis <= 0) {
timeoutMillis = this.timeoutMillis;
......@@ -313,7 +313,7 @@ public class TransactionStore {
}
private Transaction registerTransaction(int txId, int status, String name, long logId,
long timeoutMillis, int ownerId, RollbackListener listener) {
int timeoutMillis, int ownerId, RollbackListener listener) {
int transactionId;
long sequenceNo;
boolean success;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论