CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
Object primaryKey = threadContext.getPrimaryKey();
// if we have a real timerservice, stop all timers. Otherwise, ignore...
if (primaryKey != null) {
EjbTimerService timerService = deploymentInfo.getEjbTimerService();
if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
for (Timer timer : deploymentInfo.getEjbTimerService().getTimers(primaryKey)) {
timer.cancel();
}
}