I have a JSF/Primefaces page where I display the content of a table. In this table there are the results of a timer which tests every 15 minutes the accessibility of some related services. I also have a refresh button beneath the table which starts the test directly. The tests for some services may take very long and the page doesn't freeze while testing.
I want to know, if it would be possible to start those test asynchronous all paralell and the page shows if a test for a service ist still running, or if it has a result.
I know it could be difficult for a table but if you think it is too complicatet than it would be nice if it would be possible to show that the test-function is still running.
Simplified Code:
<h:form id="statusfrm">
<div class="card">
<p:dataTable var="sys" value="#{statushandler.availableList}"
showGridlines="true" size="small">
<p:column headerText="System">
<h:outputText value="#{sys.systemName}" />
</p:column>
<p:column headerText="Verfügbarkeit">
<h:outputText value="#{sys.availability}" />
</p:column>
<p:column headerText="Letzte Prüfung">
<h:outputText value="#{sys.lastUpdate}" rendered="#{not sys.requestPending}"/>
<h:outputText value="Pending..." rendered="#{sys.requestPending}"/>
</p:column>
</p:dataTable>
</div>
<p:commandButton value="Neu laden" icon="pi pi-refresh"
actionListener="#{statushandler.refreshParameter}"/>
</h:form>
And in the statushandler
public String refreshParameter() {
Async: Interface1.checkSystem();
Async: Interface2.checkSystem();
Async: Interface3.checkSystem();
Async: Interface4.checkSystem();
return null;
}
The objective is that everytime the user returns to the page with the table the system knows that there are pending requests for some systems.
But I will try also the solution with @Inject @Push
this also looks useful.