0 Replies Latest reply on Dec 6, 2008 12:34 PM by Phil Haigh

    Pausing asynchronous methods

    Phil Haigh Novice

      Hi,


      I have a simple asynchronous method. However, I want to, mid way though processing it, pause the method.


      I have found it impossible to call an asynchronous method from within itself...



          public void restoreResources(@Duration Long waitBeforeStart)
          {
              log.info("Restoring resources");
                
              if (Constants.APPLICATION_PATH!=null && Constants.APPLICATION_PATH.length()>0)
              {
                    storedResources = Constants.UPLOAD_PATH;
                   copyFiles(new File(storedResources));        
                   log.info("Resources restored..");
              }
              else
              {
                   log.info("Application not ready for restore resources... waiting...");
      // This is what doesn't work:  
      restoreResources(5000L);
      //Or any combination of trying to access the component, inject it etc etc.
              }       
          }



      Is there a way to achieve this?