title: show message if method call takes longer time than expected
body: <p>Question in short : If a method executed on press of a commandButton on a JSF page in a managed bean is taking more than 20 seconds, i am not interested in waiting for method execution to complete and display a message to user to try later. In the method called on button click, i am calling an API method provided by other system, its a single line method called with some input parametes.</p>
  
  <p>Question in detail :
  I have a scenario where I have a JSF 2 page which has a upper part which contains some input fields where user enters some search criteria and another lower part which contains a result table. Table is filled with search results which come from another system when user clicks a search button. on click of search button, I capture all input fields in a <code>HashMap&lt;String,String&gt;</code> and pass it as input parameter to a method which further calls a service exposed by an external application. Sometimes this statement which does the method call takes very long time before returning result. I want to display some message to the user in case this method call takes more than 20 seconds without having the user to wait till the time method returns some result. I think I will have to use some concurrent mechanism for this. Is there a pattern to implement such requirement ?</p>