use of org.jboss.hal.core.finder.PreviewAttributes in project console by hal.
the class WorkerPreview method update.
@Override
public void update(NamedNode worker) {
ResourceAddress address = WORKER_TEMPLATE.resolve(statementContext, worker.getName());
Operation operation = new Operation.Builder(address, READ_RESOURCE_OPERATION).param(INCLUDE_RUNTIME, true).param(RECURSIVE, true).build();
dispatcher.execute(operation, result -> {
corePoolSize.update(result.get(CORE_POOL_SIZE).asLong(), result.get(TASK_MAX_THREADS).asLong());
maxPoolSize.update(result.get(MAX_POOL_SIZE).asLong(), result.get(TASK_MAX_THREADS).asLong());
busyWorkerThreadCount.update(result.get(BUSY_WORKER_THREAD_COUNT).asLong(), result.get(TASK_MAX_THREADS).asLong());
ioThreadCount.update(result.get(IO_THREAD_COUNT).asLong(), result.get(IO_THREADS).asLong());
List<Property> serverConnections = failSafePropertyList(result, SERVER);
Elements.removeChildrenFrom(connectionsContainer);
if (!serverConnections.isEmpty()) {
NamedNode dummy = new NamedNode(new ModelNode());
PreviewAttributes<NamedNode> attributes = new PreviewAttributes<>(dummy, Names.CONNECTIONS);
for (Property property : serverConnections) {
ModelNode serverConnection = property.getValue();
attributes.append(unused -> {
int connectionCount = serverConnection.get(CONNECTION_COUNT).asInt();
int lowWaterMark = serverConnection.get(CONNECTION_LIMIT_LOW_WATER_MARK).asInt();
int highWaterMark = serverConnection.get(CONNECTION_LIMIT_HIGH_WATER_MARK).asInt();
HTMLElement element = span().add(span().title(labelBuilder.label(CONNECTION_COUNT)).textContent(String.valueOf(connectionCount))).add(// NON-NLS
span().style("color: " + PatternFly.colors.black500).add(" (").add(span().title(labelBuilder.label(CONNECTION_LIMIT_LOW_WATER_MARK)).textContent(String.valueOf(lowWaterMark))).add(" / ").add(span().title(labelBuilder.label(CONNECTION_LIMIT_HIGH_WATER_MARK)).textContent(String.valueOf(highWaterMark))).add(")")).element();
return new PreviewAttribute(property.getName(), element);
});
}
attributes.forEach(connectionsContainer::appendChild);
}
});
}
Aggregations