I've re-written things to use AbstractToolRuntimeSystemJob. 
 
I wrote the following method (see below) on my subclass, which calls
changeJobState twice. Even though the job runs and the output appears
on the screen, no state change occurs and my submit progress remains at
85%. Any ideas? 
 
BTW: I included the waitFor() call at the end, otherwise I tend to get
this error: 
 
java.lang.IllegalThreadStateException: Process not Terminated 
    at org.eclipse.cdt.utils.spawner.Spawner.exitValue(Spawner.java:199) 
    at
org.eclipse.ptp.remote.internal.core.LocalProcess.exitValue(LocalProcess.java:107) 
    at
org.eclipse.ptp.rm.core.rtsystem.AbstractToolRuntimeSystemJob.run(AbstractToolRuntimeSystemJob.java:786) 
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) 
 
Cheers, 
Steve 
 
====== 
 
    @Override 
    protected void doExecutionStarted(IProgressMonitor monitor) 
            throws CoreException { 
        // TODO Auto-generated method stub 
        IRemoteProcess process = getProcess(); 
        InputStream in = process.getInputStream(); 
        changeJobState(JobAttributes.State.RUNNING); 
        while(true) { 
            int c; 
            try { 
                c = in.read(); 
            } catch (IOException e) { 
                break; 
            } 
            if(c < 0) 
                break; 
            System.out.append((char)c); 
        } 
        try { 
            in.close(); 
        } catch (IOException e) { 
        } 
        try { 
            getProcess().waitFor(); 
        } catch (InterruptedException e) { 
            e.printStackTrace(); 
        } 
        changeJobState(JobAttributes.State.COMPLETED); 
    } 
 
On 09/22/2010 06:46 AM, Greg Watson wrote:
(Redirecting to ptp-dev)
   
   
  Steve, 
   
   
  You need to change the job's state attribute from
JobAttributes.State.STARTING to JobAttributes.State.RUNNING for the
launch to complete. This needs to happen *after* the call to
doSubmitJob() returns, so you will need another thread or some other
way of changing the state. See
AbstractToolRuntimeSystemJob#changeJobState for sample code. 
   
   
  Regards, 
  Greg 
  
  
  On Sep 21, 2010, at 9:22 AM, Beth Tibbitts wrote: 
  
  
    
    ptp-dev is probably a better list for a this question but i
think most of the developers watch ptp-user as well 
     
...Beth 
     
Beth Tibbitts  
Eclipse Parallel Tools Platform http://eclipse.org/ptp 
IBM STG Communications Protocols and Tools 
Mailing Address: IBM Corp., Coldstream Research Campus, 745 West New
Circle Road, Lexington, KY 40511 
     
    <graycol.gif>"Steven R.
Brandt" ---09/20/2010 03:52:18 PM---This is probably the wrong list for
this question, so please help me find the right one. 
     
     
      
        
          <ecblank.gif> 
          From: | 
          <ecblank.gif> 
          "Steven R. Brandt" <sbrandt@xxxxxxxxxxx> | 
         
        
          <ecblank.gif> 
          To: | 
          <ecblank.gif> 
          PTP User <ptp-user@xxxxxxxxxxx> | 
         
        
          <ecblank.gif> 
          Date: | 
          <ecblank.gif> 
          09/20/2010 03:52 PM | 
         
        
          <ecblank.gif> 
          Subject: | 
          <ecblank.gif> 
          [ptp-user] Creating a new Resource Manager | 
         
        
          <ecblank.gif> 
          Sent by: | 
          <ecblank.gif> 
          ptp-user-bounces@xxxxxxxxxxx | 
         
      
     
    
     
    
    
    This is probably the wrong list for this question, so please
help me  
find the right one. 
     
I'm developing a new PTP resource manager object. By way of testing and
     
figuring out how things work, I create a fake job that does nothing. 
     
I subclass org.eclipse.ptp.rmsystem.AbstractResourceManager and provide
     
it with a method: 
     
    @Override 
    protected IPJob doSubmitJob(String subId, 
            ILaunchConfiguration configuration, AttributeManager
attrMgr, 
            IProgressMonitor monitor) throws CoreException { 
        // TODO Auto-generated method stub 
        System.out.println("doSubmitJob"); 
        if(monitor != null) { 
            monitor.done(); 
        } 
        IPJob job = newJob(queue, subId, new AttributeManager()); 
        return job; 
    } 
     
This puts the job to the 85% completed stage, but it does not get any  
further. How do I make the job show as complete? Thx. 
     
Cheers, 
Steve 
_______________________________________________ 
ptp-user mailing list 
    ptp-user@xxxxxxxxxxx 
    https://dev.eclipse.org/mailman/listinfo/ptp-user 
    
    
     
_______________________________________________ 
ptp-user mailing list 
    ptp-user@xxxxxxxxxxx 
    https://dev.eclipse.org/mailman/listinfo/ptp-user 
   
   
  
   
 
 |