Skip to content

Commit

Permalink
Merge pull request #505 from hpehl/HAL-1767
Browse files Browse the repository at this point in the history
HAL-1767: Add active thread count
  • Loading branch information
hpehl committed Jan 31, 2022
2 parents c05db18 + 198da30 commit ee57eda
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
Expand Up @@ -33,14 +33,25 @@
import static org.jboss.gwt.elemento.core.Elements.h;
import static org.jboss.gwt.elemento.core.Elements.section;
import static org.jboss.hal.client.runtime.subsystem.batch.AddressTemplates.BATCH_SUBSYSTEM_TEMPLATE;
import static org.jboss.hal.dmr.ModelDescriptionConstants.*;
import static org.jboss.hal.dmr.ModelDescriptionConstants.ACTIVE_COUNT;
import static org.jboss.hal.dmr.ModelDescriptionConstants.CURRENT_THREAD_COUNT;
import static org.jboss.hal.dmr.ModelDescriptionConstants.DEFAULT_JOB_REPOSITORY;
import static org.jboss.hal.dmr.ModelDescriptionConstants.DEFAULT_THREAD_POOL;
import static org.jboss.hal.dmr.ModelDescriptionConstants.INCLUDE_RUNTIME;
import static org.jboss.hal.dmr.ModelDescriptionConstants.LARGEST_THREAD_COUNT;
import static org.jboss.hal.dmr.ModelDescriptionConstants.MAX_THREADS;
import static org.jboss.hal.dmr.ModelDescriptionConstants.READ_RESOURCE_OPERATION;
import static org.jboss.hal.dmr.ModelDescriptionConstants.RECURSIVE;
import static org.jboss.hal.dmr.ModelDescriptionConstants.RESTART_JOBS_ON_RESUME;
import static org.jboss.hal.dmr.ModelDescriptionConstants.THREAD_POOL;
import static org.jboss.hal.dmr.ModelNodeHelper.failSafeGet;

public class BatchPreview extends PreviewContent<SubsystemMetadata> {

private final Dispatcher dispatcher;
private final StatementContext statementContext;
private final PreviewAttributes<ModelNode> attributes;
private final Utilization activeCount;
private final Utilization currentThreadCount;
private final Utilization largestThreadCount;
private final HTMLElement details;
Expand All @@ -55,8 +66,10 @@ public BatchPreview(Dispatcher dispatcher, StatementContext statementContext, Re

details = section()
.add(h(2, Names.THREADS))
.add(currentThreadCount = new Utilization(
.add(activeCount = new Utilization(
resources.constants().active(), Names.THREADS, false, true))
.add(currentThreadCount = new Utilization(
resources.constants().current(), Names.THREADS, false, true))
.add(largestThreadCount = new Utilization(
resources.constants().largest(), Names.THREADS, false, true)).element();

Expand All @@ -82,8 +95,10 @@ public void update(SubsystemMetadata item) {
if (threadPool.isDefined()) {
Elements.setVisible(details, true);
int max = threadPool.get(MAX_THREADS).asInt();
int active = threadPool.get(ACTIVE_COUNT).asInt();
int current = threadPool.get(CURRENT_THREAD_COUNT).asInt();
int largest = threadPool.get(LARGEST_THREAD_COUNT).asInt();
activeCount.update(active, max);
currentThreadCount.update(current, max);
largestThreadCount.update(largest, max);
}
Expand Down
Expand Up @@ -105,6 +105,7 @@ public interface Constants extends com.google.gwt.i18n.client.Constants {
String create();
String createAccount();
String creationTime();
String current();
String currentPage();
String data();
String day();
Expand Down
Expand Up @@ -89,6 +89,7 @@ counter=Counter
create=Create
createAccount=Create Account
creationTime=Creation Time
current=Current
currentPage=Current Page
custom=Custom
data=Data
Expand Down
Expand Up @@ -89,6 +89,7 @@ counter=Zähler
create=Erstellen
createAccount=Konto erstellen
creationTime=Erstellungszeit
current=Aktuell
currentPage=Aktuelle Seite
custom=Benutzerdefiniert
data=Daten
Expand Down

0 comments on commit ee57eda

Please sign in to comment.