code: public DeviceAttribute[] read_attribute_reply(final DeviceProxy deviceProxy,
                                                    final int id, final int timeout) throws DevFailed {
          DeviceAttribute[] argout = null;
          final int ms_to_sleep = 10;
          AsynReplyNotArrived except = null;
          final long t0 = System.currentTimeMillis();
          long t1 = t0;
  
          while ((t1 - t0 < timeout || timeout == 0) && argout == null) {
              try {
                  argout = read_attribute_reply(deviceProxy, id);
              }
              catch (final AsynReplyNotArrived na) {
                  except = na;
                  // Wait a bit before retry
                  try { Thread.sleep(ms_to_sleep); } catch (final InterruptedException e) { /* */ }
                  t1 = System.currentTimeMillis();
              }
          }
          // If reply not arrived throw last exception
          if (argout == null) {
              ApiUtil.remove_async_request(id);
              throw except;
          }
  
          return argout;
      }
docs: ==========================================================================