Java 类javax.ejb.SessionSynchronization 实例源码

项目:tomee    文件:CheckCallbacks.java   
private void checkSessionSynchronization(final Class ejbClass, final SessionBean bean) {
    if (SessionSynchronization.class.isAssignableFrom(ejbClass)) {
        if (bean.getAfterBeginMethod() != null || bean.getBeforeCompletionMethod() != null || bean.getAfterCompletionMethod() != null) {
            fail(bean, "callback.sessionSynchronization.invalidUse", ejbClass.getName());
        } else {
            final ClassFinder classFinder = new ClassFinder(ejbClass);
            if (classFinder.findAnnotatedMethods(AfterBegin.class).size() > 0 || classFinder.findAnnotatedMethods(BeforeCompletion.class).size() > 0
                || classFinder.findAnnotatedMethods(AfterCompletion.class).size() > 0) {
                fail(bean, "callback.sessionSynchronization.invalidUse", ejbClass.getName());
            }
        }
    }
}