boolean performWork(TaskManager.Task who,Object param) throws JobException {
  Integer tmp=null;
synchronized (tasks) {
    tmp=(Integer)tasks.get(who);
  }
  if (tmp == null)   throw new UnknownTaskException();
  int rank=tmp.intValue();
synchronized (attempts) {
    attempts[rank]++;
  }
  Object result=doWork(who,param);
  if (result == null)   return false;
  try {
    reportDone(who,result);
  }
 catch (  UnknownTaskException e) {
  }
catch (  PartialResultException e) {
  }
catch (  JobException e) {
  }
  return true;
}

boolean performWork ( TaskManager . Task who , Object param ) throws JobException { Integer tmp = null ; synchronized ( tasks ) { tmp = ( Integer ) tasks . get ( who ) ; } if ( tmp == null ) throw new UnknownTaskException ( ) ; int rank = tmp . intValue ( ) ; synchronized ( attempts ) { attempts [ rank ] ++ ; } Object result = doWork ( who , param ) ; if ( result == null ) return false ; try { reportDone ( who , result ) ; } catch ( UnknownTaskException e ) { } catch ( PartialResultException e ) { } catch ( JobException e ) { } return true ; }
used by a task to do a piece of work and record the number of attempts .
