Changeset 4073


Ignore:
Timestamp:
Dec 20, 2007, 2:47:41 PM (15 years ago)
Author:
Nicklas Nordborg
Message:

References #636: Kill a running job

Infrastructure for signal processing is set up. Need more implementors. Need more support
in the core to be able to use it (in Job class). Internal job queue and job agents must also be updated.

Location:
trunk/src
Files:
17 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/InternalJobQueue.java

    r3871 r4073  
    430430          throw t;
    431431        }
    432         dc.close();
     432        //exec.setSignalReceiver(signalReceiver);
     433        dc.commit();
    433434       
    434435        // Now, we can execute the job
  • trunk/src/core/net/sf/basedb/core/PluginExecutionRequest.java

    r3679 r4073  
    2828import net.sf.basedb.core.plugin.Request;
    2929import net.sf.basedb.core.plugin.Response;
     30import net.sf.basedb.core.signal.SignalHandler;
     31import net.sf.basedb.core.signal.SignalReceiver;
     32import net.sf.basedb.core.signal.SignalTarget;
    3033
    3134/**
     
    118121  }
    119122 
     123  public void setSignalReceiver(SignalReceiver signalReceiver)
     124  {
     125    Plugin p = getPlugin();
     126    SignalHandler signalHandler = null;
     127    if (p instanceof SignalTarget)
     128    {
     129      signalHandler = ((SignalTarget)p).getSignalHandler();
     130    }
     131    if (signalHandler != null)
     132    {
     133      String ID = signalReceiver.registerSignalHandler(signalHandler);
     134      Job job = getJob();
     135      //job.setSignalReceiverId(ID);
     136    }
     137  }
     138 
    120139}
  • trunk/src/plugins/core/net/sf/basedb/plugins/AbstractFlatFileImporter.java

    r3889 r4073  
    5252import net.sf.basedb.core.plugin.Response;
    5353import net.sf.basedb.core.plugin.Plugin;
     54import net.sf.basedb.core.signal.SignalHandler;
     55import net.sf.basedb.core.signal.SignalTarget;
     56import net.sf.basedb.core.signal.ThreadSignalHandler;
    5457
    5558import net.sf.basedb.util.NumberFormatUtil;
     
    143146public abstract class AbstractFlatFileImporter
    144147  extends AbstractPlugin
    145   implements AutoDetectingImporter
     148  implements AutoDetectingImporter, SignalTarget
    146149{
    147150
     
    661664  }
    662665  // -------------------------------------------
     666  /*
     667    From the SignalTarget interface
     668    -------------------------------------------
     669  */
     670  /**
     671    Create a new {@link ThreadSignalHandler} that supports
     672    the {@link net.sf.basedb.core.signal.Signal#ABORT} signal.
     673    Subclasses may override this to provide another signal
     674    handler, or return null if they don't support signals.
     675    @since 2.6
     676  */
     677  public SignalHandler getSignalHandler()
     678  {
     679    return new ThreadSignalHandler();
     680  }
     681  // -------------------------------------------
    663682
    664683  private int getProgress(long parsedCharacters)
Note: See TracChangeset for help on using the changeset viewer.