0

I have a page with a table in it representing some network devices in a bean

Bean:

private List<Devices> MyDevices;
public List<Devices> getDevices()
{return this.MyDevices;}

JSF:
<p:dataTable var="device" value="#{network.MyDevices}">

There is a scan button which will call a non blocking Java function (and will return with 200 Ok right away, no data) in the bean to perform the required tasks through Futures, and the results go through validation and initialization and what not. Eventually, and I mean maybe 1 to 3 mins later (depending on network size) MyDevices list contents will change and I want that change to reflect immediately to the JSF page without the user having to refresh. I am under the impression that any blocking transaction from client to server will timeout (hence the function call) if it waits for the result. I know I can implement a websocket signaling mechanism, but I feel its an overkill for something as simple as updating user view. I would rather not poll, but it definitely beats opening websockets (specially that this application is not intended for cloud deployment and will run on site, so data consumption,bandwidth and response times are not an issue at all).

I am looking for the simplest tried and tested solution/approach to tackle this issue in Primefaces framework. Sorry if it seems too trivial, but I am not exactly a UI guy

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
a.atlam
  • 742
  • 5
  • 17
  • Websocket is not overkill. It is the best solution for this problem. – Peter Gelderbloem Oct 24 '16 at 17:00
  • Thanks Peter ... I kinda agree, but it involves custom JS, an extra JS library, extra Java logic and library, and custom communication protocol to tell the browser when to update which element ... all that extra work and sources of error just to update a stupid UI piece asa the job is done ... was kinda looking for a short cut, but point noted – a.atlam Oct 24 '16 at 17:10
  • AND an extra service to open in firewall on site :( – a.atlam Oct 24 '16 at 17:11
  • Then use polling. All it does is put a load on your server where each request every 1-10 seconds, depending on your required 'accuracy',determines of the data is already there an 95% of the time fires a unneeded request. But seriously, if you already use PrimeFaces, nothing much is additionally needed. – Kukeltje Oct 24 '16 at 17:54

0 Answers0