Changeset 7306


Ignore:
Timestamp:
Mar 7, 2017, 8:16:52 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #2059: Problems to abort plug-ins that use the snapshot manager to load annotations

Added ThreadSignalHandler.hasRecieved() method to make it possible to check if an ABORT signal has been received even if the threads interrupt flag has been reset by some other code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.10-stable/src/core/net/sf/basedb/core/signal/ThreadSignalHandler.java

    r6898 r7306  
    150150 
    151151  /**
     152    If TRUE, at least one ABORT signal has been recieved.
     153    @since 3.10.1
     154  */
     155  private boolean hasAborted;
     156 
     157  /**
    152158    Create a new thread signal handler. It will interrupt the
    153159    current thread when it recieves the {@link Signal#ABORT} signal.
     
    191197    if (Signal.ABORT.equals(signal))
    192198    {
     199      hasAborted = true;
    193200      logger.debug("Sending signal " + signal + " to thread: " + workerThread);
    194201      if (forceStop)
     
    235242  }
    236243 
    237 }
     244  /**
     245    Check if the given signal has been received by this signal handler.
     246    @param signal The signal to check for
     247    @return TRUE if the signal has been received, FALSE otherwise
     248    @since 3.10.1
     249  */
     250  public boolean hasReceived(Signal signal)
     251  {
     252    return hasAborted && signal == Signal.ABORT;
     253  }
     254
     255}
Note: See TracChangeset for help on using the changeset viewer.