@PostConstruct public void initialize() { ScheduleExpression scheduleExpression = new ScheduleExpression() .hour("*") .minute("*") .second("*/5"); TimerConfig timerConfig = new TimerConfig(); timerConfig.setInfo("Every 5 second timer"); timerService.createCalendarTimer(scheduleExpression, timerConfig); }
@javax.ejb.TransactionAttribute(TransactionAttributeType.SUPPORTS) interface ITestEjb { @javax.ejb.TransactionAttribute int getAge(); void setAge(int age); String getName(); void setName(String name); }
/** * EJB implementation of {@link TestEntityDao} which declares transaction * semantics for {@link #incrementCount(String)} with * {@link TransactionAttributeType#REQUIRED}. * * @author Sam Brannen * @author Xavier Detant * @since 4.0.1 * @see RequiresNewEjbTxTestEntityDao */ @Stateless @Local(TestEntityDao.class) @TransactionAttribute(TransactionAttributeType.MANDATORY) public class RequiredEjbTxTestEntityDao extends AbstractEjbTxTestEntityDao { @Override public int getCount(String name) { return super.getCountInternal(name); } @TransactionAttribute(TransactionAttributeType.REQUIRED) @Override public int incrementCount(String name) { return super.incrementCountInternal(name); } }
@EJB(beanName="testBean3", beanInterface=ITestBean.class) private void setTestBean4(ITestBean testBean4) { if (this.testBean4 != null) { throw new IllegalStateException("Already called"); } this.testBean4 = testBean4; }
@Remove @TransactionAttribute(TransactionAttributeType.REQUIRED) public void stop() { // closing the SF should run the delayed schema drop delegate emf.close(); } }
public TransactionAttribute parseTransactionAnnotation(javax.ejb.TransactionAttribute ann) { return new Ejb3TransactionAttribute(ann.value()); }
/** * Remove the given EJB instance. * @param ejb the EJB instance to remove * @see javax.ejb.EJBLocalObject#remove() */ protected void removeSessionBeanInstance(@Nullable EJBLocalObject ejb) { if (ejb != null && !this.homeAsComponent) { try { ejb.remove(); } catch (Throwable ex) { logger.warn("Could not invoke 'remove' on local EJB proxy", ex); } } }
public Ejb3TransactionAttribute(TransactionAttributeType type) { setPropagationBehaviorName(PREFIX_PROPAGATION + type.name()); }
/** * EJB implementation of {@link TestEntityDao} which declares transaction * semantics for {@link #incrementCount(String)} with * {@link TransactionAttributeType#REQUIRES_NEW}. * * @author Sam Brannen * @author Xavier Detant * @since 4.0.1 * @see RequiredEjbTxTestEntityDao */ @Stateless @Local(TestEntityDao.class) @TransactionAttribute(TransactionAttributeType.MANDATORY) public class RequiresNewEjbTxTestEntityDao extends AbstractEjbTxTestEntityDao { @Override public int getCount(String name) { return super.getCountInternal(name); } @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Override public int incrementCount(String name) { return super.incrementCountInternal(name); } }
@Override @javax.ejb.TransactionAttribute public int getAge() { return age; }
@EJB public void setTestBean6(INestedTestBean testBean6) { if (this.testBean6 != null) { throw new IllegalStateException("Already called"); } this.testBean6 = testBean6; }
@Override @javax.ejb.TransactionAttribute public int getAge() { return age; }
@Override @EJB public void setTestBean2(TestBean testBean2) { super.setTestBean2(testBean2); }
@Override @javax.ejb.TransactionAttribute(TransactionAttributeType.SUPPORTS) public String getName() { return name; }
@javax.ejb.TransactionAttribute int getAge();
@javax.ejb.TransactionAttribute(TransactionAttributeType.SUPPORTS) static class Ejb3AnnotatedBean2 implements ITestBean1 { private String name; private int age; @Override public String getName() { return name; } @Override public void setName(String name) { this.name = name; } @Override @javax.ejb.TransactionAttribute public int getAge() { return age; } @Override public void setAge(int age) { this.age = age; } }
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Override public int incrementCount(String name) { return super.incrementCountInternal(name); }
@TransactionAttribute(TransactionAttributeType.REQUIRED) @Override public int incrementCount(String name) { return super.incrementCountInternal(name); }