Search in sources :

Example 21 with EJBException

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());
        }
    }
}
Also used : TriggerKey(org.apache.openejb.quartz.TriggerKey) Trigger(org.apache.openejb.quartz.Trigger) AbstractTrigger(org.apache.openejb.quartz.impl.triggers.AbstractTrigger) OpenEJBException(org.apache.openejb.OpenEJBException) EJBException(javax.ejb.EJBException)

Example 22 with EJBException

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;
}
Also used : SchedulerException(org.apache.openejb.quartz.SchedulerException) Scheduler(org.apache.openejb.quartz.Scheduler) EJBException(javax.ejb.EJBException)

Example 23 with EJBException

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);
    }
}
Also used : EJBException(javax.ejb.EJBException)

Example 24 with EJBException

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);
    }
}
Also used : SchedulerException(org.apache.openejb.quartz.SchedulerException) Scheduler(org.apache.openejb.quartz.Scheduler) EJBException(javax.ejb.EJBException)

Example 25 with EJBException

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());
    }
}
Also used : NoSuchEJBException(javax.ejb.NoSuchEJBException) OpenEJBException(org.apache.openejb.OpenEJBException) EJBException(javax.ejb.EJBException) InitialContext(javax.naming.InitialContext)

Aggregations

EJBException (javax.ejb.EJBException)86 InitialContext (javax.naming.InitialContext)40 OpenEJBException (org.apache.openejb.OpenEJBException)24 Test (org.junit.Test)16 RemoteException (java.rmi.RemoteException)13 CreateException (javax.ejb.CreateException)12 NamingException (javax.naming.NamingException)11 Connection (java.sql.Connection)10 PreparedStatement (java.sql.PreparedStatement)10 DataSource (javax.sql.DataSource)10 Properties (java.util.Properties)9 ThreadContext (org.apache.openejb.core.ThreadContext)9 FinderException (javax.ejb.FinderException)7 HashMap (java.util.HashMap)6 RemoveException (javax.ejb.RemoveException)6 BeanContext (org.apache.openejb.BeanContext)6 File (java.io.File)5 NoSuchObjectLocalException (javax.ejb.NoSuchObjectLocalException)5 JMSException (javax.jms.JMSException)5 Assembler (org.apache.openejb.assembler.classic.Assembler)5