/** {@inheritDoc} */
public boolean interrupt(){
try {
interruptLock.lock();
Sampler samp = currentSampler; // fetch once; must be done under lock
if (samp instanceof Interruptible){ // (also protects against null)
log.warn("Interrupting: " + threadName + " sampler: " +samp.getName());
try {
boolean found = ((Interruptible)samp).interrupt();
if (!found) {
log.warn("No operation pending");
}
return found;
} catch (Exception e) {
log.warn("Caught Exception interrupting sampler: "+e.toString());
}
} else if (samp != null){
log.warn("Sampler is not Interruptible: "+samp.getName());
}
} finally {
interruptLock.unlock();
}
return false;