Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/transport/stomp/AsyncHelper.java


1   /*
2    * Copyright (c) 2005 Your Corporation. All Rights Reserved.
3    */
4   package org.activemq.transport.stomp;
5   
6   class AsyncHelper
7   {
8       public static Object tryUntilNotInterrupted(HelperWithReturn helper)
9       {
10          while (true)
11          {
12              try
13              {
14                  return helper.cycle();
15              }
16              catch (InterruptedException e){ /* */}
17          }
18      }
19  
20      static void tryUntilNotInterrupted(final Helper helper)
21      {
22          tryUntilNotInterrupted(new HelperWithReturn(){
23  
24              public Object cycle() throws InterruptedException
25              {
26                  helper.cycle();
27                  return null;
28              }
29          });
30      }
31  
32  
33      interface HelperWithReturn
34      {
35          Object cycle() throws InterruptedException;
36      }
37  
38      interface Helper
39      {
40          void cycle() throws InterruptedException;
41      }
42  }