Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Managing your threads in application servers is not recommended. If you are using EJBs, the spec <a href="http://java.sun.com/blueprints/qanda/ejb_tier/restrictions.html#threads" rel="nofollow">disallows that</a>.</p> <p>Why don't you use use a caching solution to improve the performance? The first few requests will be slower, but once the cache is hot everything will be very fast.</p> <p>If caching the data is not feasible, what about changing the client to make multiple requests to the server, instead of splitting one request in multiple threads? You would need to change your web application, so that each method would call one web service. The client would call (in parallel) each method needed for the current page and assemble the final result (it may be possible to display partial results if you wish). By doing this you will do work in parallel and won't violate the spec. </p> <p>I assume you have something like this, in your server:</p> <pre><code>public Result retriveData(Long id) { Result myResult = new Result(); //... //do some stuff myResult.setSomeData(slowWebService1.retriveSomeData(id)); myResult.setSomeOtherData(slowWebService2.retriveSomeOtherData(id)); myResult.setData(slowWebService3.retriveData(id)); return myResult; } </code></pre> <p>In your client:</p> <pre><code>Result result = webApplication.retriveData(10); //use the result </code></pre> <p>My proposal, is to split the calls in multiple methods:</p> <pre><code> public SomeData retriveSomeData(Long id) { //do some stuff SomeData data = slowWebService1.retriveSomeData(id); //do more stuff return data; } public SomeOtherData retriveSomeOtherData(Long id) { //do some stuff SomeOtherData data = slowWebService2.retriveSomeOtherData(id); //do more stuff return data; } public Data retriveData(Long id) { //do some stuff Data data = slowWebService3.retriveData(id); //do more stuff return data; } </code></pre> <p>In your client:</p> <pre><code>//Call these methods in parallel, if you were using Swing, this could be done with //SwingWorker (I have no idea how to it with Flash :)). //You can either wait for all methods to return or show partial results. callInBackground(webApplication.retriveSomeData(10), useDataWhenDone); callInBackground(webApplication.retriveSomeOtherData(10), useDataWhenDone); callInBackground(webApplication.retriveData(10), useDataWhenDone); </code></pre> <p>By doing this you are calling only your web application, just like before, so there shouldn't be any security issues.</p> <p>I am not familiar with Websphere, so I can't tell if using its asynchronous beans are better than this, but <strong>IMHO</strong> you should avoid starting threads manually.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload