com.norconex.jef.suite
Class FileStopRequestHandler

java.lang.Object
  extended by com.norconex.jef.suite.FileStopRequestHandler
All Implemented Interfaces:
IJobSuiteStopRequestHandler, Serializable

public class FileStopRequestHandler
extends Object
implements IJobSuiteStopRequestHandler

Listens for STOP requests using a stop file. The stop file file name matches the suite namespace, plus the ".stop" extension. The directory where to locate the file depends on the constructor invoked.

Since:
2.0
Author:
Pascal Essiembre
See Also:
Serialized Form

Constructor Summary
FileStopRequestHandler(String namespace, String jobDir)
          Creates a file-based job stop request advisor storing files in the given job directory.
 
Method Summary
 void fireStopRequest()
          Fires a stop request.
 void startListening(ISuiteStopRequestListener listener)
          Starts to listen for stop requests.
 void stopListening()
          Stops listening for stop requests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileStopRequestHandler

public FileStopRequestHandler(String namespace,
                              String jobDir)
Creates a file-based job stop request advisor storing files in the given job directory.

Parameters:
jobDir - the base directory where to store/read the stop file
Method Detail

startListening

public void startListening(ISuiteStopRequestListener listener)
Description copied from interface: IJobSuiteStopRequestHandler
Starts to listen for stop requests. Implementors must call the ISuiteStopRequestListener.stopRequestReceived() method when a stop request was received.

Specified by:
startListening in interface IJobSuiteStopRequestHandler
Parameters:
listener - framework listener for stop signals

stopListening

public void stopListening()
Description copied from interface: IJobSuiteStopRequestHandler
Stops listening for stop requests.

Specified by:
stopListening in interface IJobSuiteStopRequestHandler

fireStopRequest

public void fireStopRequest()
Fires a stop request. It will write a stop file where it normally expects it. This method conveniently create a stop file for a running instance of a suite to pick it up.



Copyright © 2007-2013 Norconex Inc.. All Rights Reserved.