use of com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor in project cubrid-manager by CUBRID.
the class DBSpaceLabelProvider method loadVolumeData.
public void loadVolumeData() {
//if no database on this server ,don't get volumn data
if (serverInfo.getAllDatabaseList().size() == 0 || databaseInfoList == null) {
return;
}
final List<CommonQueryTask<DbSpaceInfoList>> getVolumnTaskList = new ArrayList<CommonQueryTask<DbSpaceInfoList>>();
if (serverInfo.getAllDatabaseList() != null) {
for (String dbName : serverInfo.getAllDatabaseList()) {
for (DatabaseInfo databaseInfo : databaseInfoList) {
// only load start database volumn data
if (dbName.equals(databaseInfo.getDbName()) && databaseInfo.getRunningType() == DbRunningType.CS) {
CommonQueryTask<DbSpaceInfoList> task = new CommonQueryTask<DbSpaceInfoList>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoList());
task.setDbName(dbName);
getVolumnTaskList.add(task);
break;
}
}
}
}
//if no start database don't get volumn data
if (getVolumnTaskList.size() == 0) {
return;
}
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
List<DBVolumeSpaceInfo> dbVolumeSpaceInfoList = new ArrayList<DBVolumeSpaceInfo>();
for (CommonQueryTask<DbSpaceInfoList> task : getVolumnTaskList) {
DbSpaceInfoList dbSpaceInfoList = task.getResultModel();
freespaceOnStorage = ((long) dbSpaceInfoList.getFreespace()) * 1024l * 1024l;
DBVolumeSpaceInfo dbSpaceInfo = new DBVolumeSpaceInfo(dbSpaceInfoList.getDbname());
dbSpaceInfo.setPageSize(dbSpaceInfoList.getPagesize());
dbVolumeSpaceInfoList.add(dbSpaceInfo);
if (dbSpaceInfoList != null) {
for (DbSpaceInfo spaceInfo : dbSpaceInfoList.getSpaceinfo()) {
dbSpaceInfo.addVolumeSpaceInfo(spaceInfo);
}
}
}
setVolumeData(dbVolumeSpaceInfoList);
finishedCount++;
updateToolBar();
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
for (CommonQueryTask<DbSpaceInfoList> task : getVolumnTaskList) {
taskJobExec.addTask(task);
}
String serverName = serverInfo.getServerName();
String jobName = Messages.taskGetVolumeInfo + serverName;
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
taskJobExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
use of com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor in project cubrid-manager by CUBRID.
the class DBSpaceLabelProvider method loadDbData.
public void loadDbData() {
final GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
final GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
List<String> orignAutoStartDBList = getCubridConfParameterTask.getAutoStartDb(false);
setDatabaseData(databaseInfoList, orignAutoStartDBList);
finishedCount++;
updateToolBar();
//after get database data ,load volumn data
loadVolumeData();
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
taskJobExec.addTask(getDatabaseListTask);
taskJobExec.addTask(getCubridConfParameterTask);
String serverName = serverInfo.getServerName();
String jobName = Messages.taskGetDBInfo + serverName;
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
taskJobExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
use of com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor in project cubrid-manager by CUBRID.
the class ServiceDashboardEditor method loadServerBrokerInfo.
/**
* Load Server Broker Info
*/
private void loadServerBrokerInfo(final ServerInfo serverInfo, final String key) {
final CommonQueryTask<BrokerInfos> task = new CommonQueryTask<BrokerInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), new BrokerInfos());
TaskJobExecutor taskJobExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {
public void completeAll() {
Object input = serviceTreeViewer.getInput();
ServiceDashboardInfo sDashInfo = getSelectedDashInfo(input, serverInfo.getServerName(), key);
BrokerInfos brokerInfos = task.getResultModel();
setBrokerData(sDashInfo, brokerInfos);
serviceTreeViewer.refresh(input);
}
public IStatus postTaskFinished(ITask task) {
return Status.OK_STATUS;
}
});
taskJobExec.addTask(task);
executeTask(taskJobExec, serverInfo.getServerName(), Messages.taskGetServerBrokerInfo);
}
Aggregations