Package org.nebulaframework.core.job

Examples of org.nebulaframework.core.job.ResultCallback


      // Insert GridJob to active jobs map
      this.jobs.put(jobId, profile);
    }

    if (resultCallbackQueue != null) {
      ResultCallback proxy = jmsSupport.createResultCallbackProxy(jobId, resultCallbackQueue);
      profile.setResultCallback(proxy);
    }

    if (archive != null) {
      // If Job has a GridArchive, verify integrity
View Full Code Here


      // Submit Job
      log.debug("Submitting Job");
     
      sw.start();
     
      GridJobFuture future = node.getJobSubmissionService().submitJob(testJob,new ResultCallback() {

        public void onResult(Serializable result) {
          System.err.println(result);
        }
       
View Full Code Here

      // Submit Job
      log.debug("Submitting Job");
     
      sw.start();
     
      GridJobFuture future = node.getJobSubmissionService().submitJob(testJob,new ResultCallback() {

        public void onResult(Serializable result) {
          System.err.println(result);
        }
       
View Full Code Here

     
      // Start Job Submission
      sw.start();
     
      GridJobFuture future = node.getJobSubmissionService()
          .submitJob(mandelbrotJob, new ResultCallback() {

            public void onResult(Serializable result) {
             
              MandelbrotResult mResult = (MandelbrotResult) result;
              app.displayResult(mResult);
View Full Code Here

      sw.start();
     
      System.err.println(new Date());
     
      GridJobFuture future = node.getJobSubmissionService()
          .submitJob(buddhabrotJob, new ResultCallback() {

            public void onResult(Serializable result) {
             
              log.debug("CALLBACK");
             
View Full Code Here

   
    Grid.startLightGridNode();
   
    AnnotatedUnboundedJob job = new AnnotatedUnboundedJob();
   
    GridNode.getInstance().getJobSubmissionService().submitJob(job, new ResultCallback() {

      @Override
      public void onResult(Serializable result) {
        System.err.println(result);
      }
View Full Code Here

    this.future = future;
   
    // Attach a ResultCallback to track results
    if (future.isFinalResultSupported()) {
     
      addFinalResultCallback(new ResultCallback () {
       
        public void onResult(Serializable result) {
          GridJobFutureClientProxy.this.result = result;
          jobFinished = true;
         
View Full Code Here

       throw new IllegalStateException("GridJob does not support final results");
    }
   
    // Create Proxy for callback
    ConnectionFactory cf = ClusterManager.getInstance().getConnectionFactory();
    final ResultCallback callback = JMSRemotingSupport.createProxy (cf, queueName, ResultCallback.class);
   
    // Clean Up Hook
    CleanUpSupport.removeQueueWhenFinished(jobId, queueName);
   
    Thread t = new Thread(new Runnable(){

      public void run() {
       
        // This sync block waits until result is available.
        synchronized (mutex) {
          try {
            // If job is not finished, wait till it finishes
            while (!isJobFinished()) {
              // Wait for result
              mutex.wait();
            }
           
            // Job Finished
            if (state==GridJobState.COMPLETE) {
              callback.onResult(result);
            }
            else {
              Exception e = null;
             
              // If we got an exception while execution
              if (exception!=null) {
                e = new GridExecutionException("Execution Failed", exception);
              }
              else { // If failed for other reason
                e = new GridExecutionException("Execution Failed (Job State : " + getState() + ")");
               
              }
              // Send Exception
              callback.onResult(e);
            }
          } catch (InterruptedException e) {
            log.error(e);
            throw new RuntimeException("Interrupted while waiting for Result");
          }
View Full Code Here

TOP

Related Classes of org.nebulaframework.core.job.ResultCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.