com.scalar.db.api.TransactionState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalardb Show documentation
Show all versions of scalardb Show documentation
A universal transaction manager that achieves database-agnostic transactions and distributed transactions that span multiple databases
package com.scalar.db.api;
public enum TransactionState {
PREPARED(1),
DELETED(2),
COMMITTED(3),
ABORTED(4),
UNKNOWN(5);
private final int id;
TransactionState(final int id) {
this.id = id;
}
public int get() {
return id;
}
public static TransactionState getInstance(int id) {
for (TransactionState state : TransactionState.values()) {
if (state.get() == id) {
return state;
}
}
throw new IllegalArgumentException("invalid id specified.");
}
}