SEBSERV-182 updateErrors
This commit is contained in:
parent
5724a750b7
commit
03c05c7372
2 changed files with 50 additions and 35 deletions
|
@ -174,7 +174,7 @@ public class MonitoringRunningExam implements TemplateComposer {
|
||||||
this.serverPushService.runServerPush(
|
this.serverPushService.runServerPush(
|
||||||
new ServerPushContext(
|
new ServerPushContext(
|
||||||
content,
|
content,
|
||||||
Utils.truePredicate(),
|
context -> clientTable.getUpdateErrors() > 5,
|
||||||
createServerPushUpdateErrorHandler(this.pageService, pageContext)),
|
createServerPushUpdateErrorHandler(this.pageService, pageContext)),
|
||||||
this.pollInterval,
|
this.pollInterval,
|
||||||
context -> clientTable.updateValues(),
|
context -> clientTable.updateValues(),
|
||||||
|
|
|
@ -116,6 +116,8 @@ public final class ClientConnectionTable {
|
||||||
private boolean forceUpdateAll = false;
|
private boolean forceUpdateAll = false;
|
||||||
private boolean updateInProgress = false;
|
private boolean updateInProgress = false;
|
||||||
|
|
||||||
|
private int updateErrors = 0;
|
||||||
|
|
||||||
public ClientConnectionTable(
|
public ClientConnectionTable(
|
||||||
final PageService pageService,
|
final PageService pageService,
|
||||||
final Composite tableRoot,
|
final Composite tableRoot,
|
||||||
|
@ -188,6 +190,10 @@ public final class ClientConnectionTable {
|
||||||
this.table.layout();
|
this.table.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getUpdateErrors() {
|
||||||
|
return this.updateErrors;
|
||||||
|
}
|
||||||
|
|
||||||
public WidgetFactory getWidgetFactory() {
|
public WidgetFactory getWidgetFactory() {
|
||||||
return this.pageService.getWidgetFactory();
|
return this.pageService.getWidgetFactory();
|
||||||
}
|
}
|
||||||
|
@ -320,44 +326,53 @@ public final class ClientConnectionTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateValuesAsync() {
|
private void updateValuesAsync() {
|
||||||
if (this.statusFilterChanged || this.forceUpdateAll) {
|
|
||||||
this.toDelete.clear();
|
try {
|
||||||
this.toDelete.addAll(this.tableMapping.keySet());
|
|
||||||
}
|
if (this.statusFilterChanged || this.forceUpdateAll) {
|
||||||
this.restCallBuilder
|
this.toDelete.clear();
|
||||||
.withHeader(API.EXAM_MONITORING_STATE_FILTER, this.statusFilterParam)
|
this.toDelete.addAll(this.tableMapping.keySet());
|
||||||
.call()
|
}
|
||||||
.get(error -> {
|
this.restCallBuilder
|
||||||
log.error("Unexpected error while trying to get client connection table data: ", error);
|
.withHeader(API.EXAM_MONITORING_STATE_FILTER, this.statusFilterParam)
|
||||||
recoverFromDisposedRestTemplate(error);
|
.call()
|
||||||
return Collections.emptyList();
|
.get(error -> {
|
||||||
})
|
log.error("Unexpected error while trying to get client connection table data: ", error);
|
||||||
.forEach(data -> {
|
recoverFromDisposedRestTemplate(error);
|
||||||
final UpdatableTableItem tableItem = this.tableMapping.computeIfAbsent(
|
return Collections.emptyList();
|
||||||
data.getConnectionId(),
|
})
|
||||||
UpdatableTableItem::new);
|
.forEach(data -> {
|
||||||
tableItem.push(data);
|
final UpdatableTableItem tableItem = this.tableMapping.computeIfAbsent(
|
||||||
if (this.statusFilterChanged || this.forceUpdateAll) {
|
data.getConnectionId(),
|
||||||
this.toDelete.remove(data.getConnectionId());
|
UpdatableTableItem::new);
|
||||||
|
tableItem.push(data);
|
||||||
|
if (this.statusFilterChanged || this.forceUpdateAll) {
|
||||||
|
this.toDelete.remove(data.getConnectionId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!this.toDelete.isEmpty()) {
|
||||||
|
this.toDelete.forEach(id -> {
|
||||||
|
final UpdatableTableItem item = this.tableMapping.remove(id);
|
||||||
|
if (item != null) {
|
||||||
|
final List<Long> list = this.sessionIds.get(item.connectionData.clientConnection.userSessionId);
|
||||||
|
if (list != null) {
|
||||||
|
list.remove(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.statusFilterChanged = false;
|
||||||
|
this.toDelete.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.toDelete.isEmpty()) {
|
this.forceUpdateAll = false;
|
||||||
this.toDelete.forEach(id -> {
|
this.updateInProgress = false;
|
||||||
final UpdatableTableItem item = this.tableMapping.remove(id);
|
this.updateErrors = 0;
|
||||||
if (item != null) {
|
|
||||||
final List<Long> list = this.sessionIds.get(item.connectionData.clientConnection.userSessionId);
|
} catch (final Exception e) {
|
||||||
if (list != null) {
|
log.error("Unexpected error while updating client connection table: ", e);
|
||||||
list.remove(id);
|
this.updateErrors++;
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.statusFilterChanged = false;
|
|
||||||
this.toDelete.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.forceUpdateAll = false;
|
|
||||||
this.updateInProgress = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateGUI() {
|
public void updateGUI() {
|
||||||
|
|
Loading…
Reference in a new issue