use of javax.ejb.EJBException in project tomee by apache.
the class EjbTimerServiceImpl method cleanTimerData.
private void cleanTimerData() {
if (timerStore == null || scheduler == null || deployment == null) {
return;
}
final Collection<TimerData> timerDatas = timerStore.getTimers(deployment.getDeploymentID().toString());
if (timerDatas == null) {
return;
}
for (final TimerData data : timerDatas) {
final Trigger trigger = data.getTrigger();
if (trigger == null) {
continue;
}
final TriggerKey key = trigger.getKey();
try {
data.stop();
} catch (final EJBException ignored) {
log.warning("An error occured deleting trigger '" + key + "' on bean " + deployment.getDeploymentID());
}
}
}
use of javax.ejb.EJBException in project tomee by apache.
the class TimerData method stop.
public void stop() {
if (trigger != null) {
try {
final Scheduler s = timerService.getScheduler();
if (!s.isShutdown()) {
if (!isPersistent()) {
s.unscheduleJob(trigger.getKey());
} else {
s.pauseTrigger(trigger.getKey());
}
}
} catch (final SchedulerException e) {
throw new EJBException("fail to cancel the timer", e);
}
}
cancelled = true;
stopped = true;
}
use of javax.ejb.EJBException in project tomee by apache.
the class TimerData method newTimer.
public void newTimer() {
//Initialize the Quartz Trigger
trigger = initializeTrigger();
trigger.computeFirstFireTime(null);
trigger.setGroup(OPEN_EJB_TIMEOUT_TRIGGER_GROUP_NAME);
trigger.setName(OPEN_EJB_TIMEOUT_TRIGGER_NAME_PREFIX + deploymentId + "_" + id);
newTimer = true;
try {
registerTimerDataSynchronization();
} catch (final TimerStoreException e) {
throw new EJBException("Failed to register new timer data synchronization", e);
}
}
use of javax.ejb.EJBException in project tomee by apache.
the class TimerData method cancel.
public void cancel() {
if (stopped) {
return;
}
timerService.cancelled(TimerData.this);
if (trigger != null) {
try {
final Scheduler s = timerService.getScheduler();
if (!s.isShutdown()) {
s.unscheduleJob(trigger.getKey());
}
} catch (final SchedulerException e) {
throw new EJBException("fail to cancel the timer", e);
}
}
cancelled = true;
try {
registerTimerDataSynchronization();
} catch (final TimerStoreException e) {
throw new EJBException("Failed to register timer data synchronization on cancel", e);
}
}
use of javax.ejb.EJBException in project tomee by apache.
the class EntityManagerPropogationTest method _testSFTr2SFEx.
public void _testSFTr2SFEx() throws Exception {
final InitialContext ctx = new InitialContext();
final Node node = (Node) ctx.lookup("TransactionToExtendedLocalBean");
try {
// System.out.println("SFSB+TPC --> SFSB+EPC");
node.createUntilLeaf(5, "Yellow");
fail("5.6.3.1 Requirements for Persistence Context Propagation (persistence spec)" + "\n\t--> we cannot have two persistence contexts associated with the transaction");
} catch (final EJBException e) {
// OK
// System.out.println(e.getMessage());
}
}
Aggregations