use of com.cubrid.cubridmanager.core.cubrid.database.model.transaction.DbTransactionList in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method loadTransactionInfo.
/**
* load lock and transaction information
*/
public void loadTransactionInfo() {
//if database is stop, do not get data
if (database.getRunningType() != DbRunningType.CS) {
return;
}
final CommonQueryTask<DatabaseLockInfo> getLockInfotask = new CommonQueryTask<DatabaseLockInfo>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DatabaseLockInfo());
getLockInfotask.setDbName(database.getName());
final CommonQueryTask<DbTransactionList> getTransactionTask = new CommonQueryTask<DbTransactionList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbTransactionList());
getTransactionTask.setDbName(database.getName());
new Thread(new Runnable() {
public void run() {
getLockInfotask.execute();
if (!getLockInfotask.isSuccess()) {
getLockInfotask.finish();
return;
}
getTransactionTask.execute();
if (!getTransactionTask.isSuccess()) {
getTransactionTask.finish();
return;
}
Display.getDefault().asyncExec(new Runnable() {
public void run() {
process();
}
});
}
private void process() {
lockAndTransactionListData.clear();
databaseLockInfo = getLockInfotask.getResultModel();
LockInfo lockInfo = databaseLockInfo.getLockInfo();
if (lockInfo == null) {
return;
}
DbLotInfo dbLotInfo = lockInfo.getDbLotInfo();
if (dbLotInfo == null) {
return;
}
if (dbLotInfo.getDbLotEntryList() != null) {
//get Lock
for (DbLotEntry dbLot : dbLotInfo.getDbLotEntryList()) {
Map<String, String> map = new HashMap<String, String>();
if (dbLot.getLockHoldersList() != null) {
lockAndTransactionListData.add(map);
map.put("4", dbLot.getOb_type());
//get lock holder
for (int i = 0; i < dbLot.getLockHoldersList().size(); i++) {
LockHolders lockHolders = dbLot.getLockHoldersList().get(i);
//add mode to the last mode
String previousMode = map.get("5");
if (i != 0 && previousMode != null) {
previousMode += ",";
}
if (previousMode != null) {
previousMode += lockHolders.getGranted_mode();
} else {
previousMode = lockHolders.getGranted_mode();
}
map.put("5", previousMode);
//get DatabaseTransaction which id is equlas lock holder tranid
for (DatabaseTransaction tran : lockInfo.getTransaction()) {
if (tran.getIndex() == lockHolders.getTran_index()) {
map.put("0", Integer.toString(tran.getIndex()));
map.put("1", tran.getUid());
map.put("2", tran.getHost());
map.put("3", tran.getPid());
}
}
}
}
}
}
setTransactionInfoData();
getLockInfotask.finish();
getTransactionTask.finish();
}
}).start();
}
use of com.cubrid.cubridmanager.core.cubrid.database.model.transaction.DbTransactionList in project cubrid-manager by CUBRID.
the class TransactionInfoDialog method killTransaction.
/**
*
* Kill the transaction
*
* @param type the transaction type
* @param parameter the parameter
*/
private void killTransaction(KillTranType type, String parameter) {
CommonQueryTask<KillTransactionList> task = new CommonQueryTask<KillTransactionList>(database.getServer().getServerInfo(), CommonSendMsg.getKillTransactionMSGItems(), new KillTransactionList());
task.setDbName(database.getName());
task.setKillTranType(type);
task.setKillTranParameter(parameter);
execTask(-1, new SocketTask[] { task }, true, getShell());
if (task.getErrorMsg() != null) {
return;
}
CommonUITool.openInformationBox(parentComp.getShell(), Messages.titleSuccess, Messages.msgKillSuccess);
KillTransactionList killTransactionList = task.getResultModel();
DbTransactionList dbDbTransactionList = new DbTransactionList();
dbDbTransactionList.setTransationInfo(killTransactionList.getTransationInfo());
setDbTransactionList(dbDbTransactionList);
}
use of com.cubrid.cubridmanager.core.cubrid.database.model.transaction.DbTransactionList in project cubrid-manager by CUBRID.
the class TransactionInfoDialog method loadData.
/**
* load the init data from the server
*
* @param shell the shell
* @return <code>true</code> if it is valid;<code>false</code>otherwise
*/
public boolean loadData(Shell shell) {
CommonQueryTask<DbTransactionList> task = new CommonQueryTask<DbTransactionList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbTransactionList());
task.setDbName(database.getName());
DbUserInfo userInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
if (userInfo != null) {
task.setDbUser(userInfo.getName() == null ? "" : userInfo.getName());
task.setDbpasswd(userInfo.getNoEncryptPassword() == null ? "" : userInfo.getNoEncryptPassword());
}
execTask(-1, new SocketTask[] { task }, true, shell);
if (task.getErrorMsg() != null) {
return false;
}
setDbTransactionList(task.getResultModel());
return true;
}
Aggregations