Class SimpleSignalProgressReporter

java.lang.Object
net.sf.basedb.core.SimpleProgressReporter
net.sf.basedb.clients.web.util.SimpleSignalProgressReporter
All Implemented Interfaces:
ProgressReporter, SignalReceiver

public class SimpleSignalProgressReporter extends SimpleProgressReporter implements SignalReceiver
This class can be used to report progress and hold signal receiver for those export plugins that download immediately. There can only be one SignalHandler registerd at a time to this class.
Version:
2.8
Author:
Martin
  • Field Details

    • logger

      private static final Logger logger
      Log signals processing.
    • handler

      private SignalHandler handler
    • notifyThread

      private Thread notifyThread
  • Constructor Details

    • SimpleSignalProgressReporter

      public SimpleSignalProgressReporter(ProgressReporter progress)
  • Method Details

    • close

      public void close(int wait)
      Description copied from interface: SignalReceiver
      Close the receiver. The receiver should close and cleanup any opened resources, unregister itself if neccesary and stop listening for signals.
      Specified by:
      close in interface SignalReceiver
      Parameters:
      wait - If the value is zero or positive, the Signal.ABORT should be sent to all registered signal handlers. The signal receiver should then wait at most the specified number of milliseconds for all signal handlers to get unregistered. If the timeout expires before all signal handlers has processed the signal, the signal receiver should continue it's shutdown.
    • getSignalTransporterClass

      public Class<? extends SignalTransporter> getSignalTransporterClass()
      This class does not need any signal transporter.
      Specified by:
      getSignalTransporterClass in interface SignalReceiver
      Returns:
      A class objects that must be a subclass of SignalTransporter
      See Also:
    • init

      public void init(String receiverId)
      Nothing need to be initilized.
      Specified by:
      init in interface SignalReceiver
      Parameters:
      receiverId - Parameters needed to initialise the receiver
      See Also:
    • registerSignalHandler

      public String registerSignalHandler(SignalHandler handler)
      This return null when there is no need for a global id.
      Specified by:
      registerSignalHandler in interface SignalReceiver
      Parameters:
      handler - The signal handler that should receive signals through this receiver
      Returns:
      A string that allows a transporter instance locate and send a signal to the given signal handler
      See Also:
    • sendToAll

      public void sendToAll(SignalSender sender)
      Description copied from interface: SignalReceiver
      Let the signal sender send one or more signals to all registered signal handlers on this reciever.
      Specified by:
      sendToAll in interface SignalReceiver
      Parameters:
      sender - A signal sender implementation
    • unregisterSignalHandler

      public void unregisterSignalHandler(SignalHandler handler)
      Description copied from interface: SignalReceiver
      Unregister a signal handler from this receiever. After this method returns, the receiver must not send any more signals to the specified handler.
      Specified by:
      unregisterSignalHandler in interface SignalReceiver
      Parameters:
      handler - The handler to unregister