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

Reduce timeoutMillis from long to int

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