Tabnine Logo
SFSBCallStack
Code IndexAdd Tabnine to your IDE (free)

How to use
SFSBCallStack
in
org.jboss.as.jpa.container

Best Java code snippets using org.jboss.as.jpa.container.SFSBCallStack (Showing top 20 results out of 315)

origin: org.wildfly/wildfly-jpa

@Override
public Object processInvocation(InterceptorContext interceptorContext) throws Exception {
  try {
    // beginSfsbCreation() will setup a "creation time" thread local store for tracking references to extended
    // persistence contexts.
    SFSBCallStack.beginSfsbCreation();
    return interceptorContext.proceed();
  } finally {
    // bean PostCreate event lifecycle has already completed.
    // endSfsbCreation() will clear the thread local knowledge of "creation time" referenced extended
    // persistence contexts.
    SFSBCallStack.endSfsbCreation();
  }
}
origin: org.wildfly/wildfly-jpa

/**
 * Pops the current SFSB invocation off the invocation call stack
 *
 * @return the entity manager map
 */
public static Map<String, ExtendedEntityManager> popCall() {
  ArrayList<Map<String, ExtendedEntityManager>> stack = currentSFSBCallStack();
  Map<String, ExtendedEntityManager> result = stack.remove(stack.size() - 1);
  stack.trimToSize();
  return result;
}
origin: org.jboss.eap/wildfly-jpa

  @Override
  public ExtendedEntityManager findExtendedPersistenceContext(String puScopedName) {
    ExtendedEntityManager result = null;
    // if current bean is injected from a parent bean that is also being created, current bean
    // can inherit only from the parent bean.
    if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 1) {
      SFSBInjectedXPCs currentInjectedXPCs = SFSBCallStack.getSFSBCreationTimeInjectedXPCs(puScopedName);
      result = currentInjectedXPCs.findExtendedPersistenceContextShallowInheritance(puScopedName);
    } else {
      // else inherit from parent bean that created current bean (if any).  The parent bean is the one
      // that did a JNDI lookup of the current bean.
      Map<String, ExtendedEntityManager> handle = SFSBCallStack.getCurrentCall();
      if (handle != null) {
        result = handle.get(puScopedName);
        if (result != null) {
          return result;
        }
      }
    }
    return result;

  }
}
origin: org.jboss.eap/wildfly-jpa

@Override
public void registerExtendedPersistenceContext(String scopedPuName, ExtendedEntityManager entityManager) {
  if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 0) {
    SFSBCallStack.getSFSBCreationTimeInjectedXPCs(scopedPuName).registerDeepInheritance(scopedPuName, entityManager);
  }
}
origin: org.wildfly/wildfly-jpa

  @Override
  public Object processInvocation(InterceptorContext context) throws Exception {
    final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
    ManagedReference entityManagerRef = (ManagedReference) componentInstance.getInstanceData(SFSBInvocationInterceptor.CONTEXT_KEY);
    if(entityManagerRef != null) {
      Map<String, ExtendedEntityManager> entityManagers = (Map<String, ExtendedEntityManager>) entityManagerRef.getInstance();
      SFSBCallStack.pushCall(entityManagers);
    }
    try {
      return context.proceed();   // call the next interceptor or target
    } finally {
      if(entityManagerRef != null) {
        SFSBCallStack.popCall();
      }
    }
  }
}
origin: org.jboss.eap/wildfly-jpa

  @Override
  public ExtendedEntityManager findExtendedPersistenceContext(String puScopedName) {
    ExtendedEntityManager result;
    SFSBInjectedXPCs currentInjectedXPCs = SFSBCallStack.getSFSBCreationTimeInjectedXPCs(puScopedName);
    // will look directly at the top level bean being created (registerExtendedPersistenceContext() registers xpc there).
    result = currentInjectedXPCs.findExtendedPersistenceContextDeepInheritance(puScopedName);

    if (result == null) {
      // walk up the BEAN call stack (this also covers the case of a bean method JNDI searching for another bean)
      for (Map<String, ExtendedEntityManager> handle : SFSBCallStack.currentSFSBCallStack()) {
        result = handle.get(puScopedName);
        if(result != null) {
          return result;
        }
      }
    }

    return result;

  }
}
origin: org.wildfly/wildfly-jpa

  @Override
  public void userTransactionStarted() throws SystemException {

    Map<String, ExtendedEntityManager> currentActiveEntityManagers = SFSBCallStack.currentSFSBCallStackInvocation();
    if (currentActiveEntityManagers != null && currentActiveEntityManagers.size() > 0) {
      for (ExtendedEntityManager extendedEntityManager: currentActiveEntityManagers.values()) {
        extendedEntityManager.internalAssociateWithJtaTx();
      }
    }
  }
}
origin: org.wildfly/wildfly-jpa

@Override
public void registerExtendedPersistenceContext(String scopedPuName, ExtendedEntityManager entityManager) {
  if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 0) {
    SFSBCallStack.getSFSBCreationTimeInjectedXPCs(scopedPuName).registerDeepInheritance(scopedPuName, entityManager);
  }
}
origin: org.jboss.eap/wildfly-jpa

  @Override
  public Object processInvocation(InterceptorContext context) throws Exception {
    final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
    ManagedReference entityManagerRef = (ManagedReference) componentInstance.getInstanceData(SFSBInvocationInterceptor.CONTEXT_KEY);
    if(entityManagerRef != null) {
      Map<String, ExtendedEntityManager> entityManagers = (Map<String, ExtendedEntityManager>) entityManagerRef.getInstance();
      SFSBCallStack.pushCall(entityManagers);
    }
    try {
      return context.proceed();   // call the next interceptor or target
    } finally {
      if(entityManagerRef != null) {
        SFSBCallStack.popCall();
      }
    }
  }
}
origin: org.wildfly/wildfly-jpa

  @Override
  public ExtendedEntityManager findExtendedPersistenceContext(String puScopedName) {
    ExtendedEntityManager result;
    SFSBInjectedXPCs currentInjectedXPCs = SFSBCallStack.getSFSBCreationTimeInjectedXPCs(puScopedName);
    // will look directly at the top level bean being created (registerExtendedPersistenceContext() registers xpc there).
    result = currentInjectedXPCs.findExtendedPersistenceContextDeepInheritance(puScopedName);

    if (result == null) {
      // walk up the BEAN call stack (this also covers the case of a bean method JNDI searching for another bean)
      for (Map<String, ExtendedEntityManager> handle : SFSBCallStack.currentSFSBCallStack()) {
        result = handle.get(puScopedName);
        if(result != null) {
          return result;
        }
      }
    }

    return result;

  }
}
origin: org.jboss.eap/wildfly-jpa

  @Override
  public void userTransactionStarted() throws SystemException {

    Map<String, ExtendedEntityManager> currentActiveEntityManagers = SFSBCallStack.currentSFSBCallStackInvocation();
    if (currentActiveEntityManagers != null && currentActiveEntityManagers.size() > 0) {
      for (ExtendedEntityManager extendedEntityManager: currentActiveEntityManagers.values()) {
        extendedEntityManager.internalAssociateWithJtaTx();
      }
    }
  }
}
origin: org.wildfly/wildfly-jpa

  @Override
  public ExtendedEntityManager findExtendedPersistenceContext(String puScopedName) {
    ExtendedEntityManager result = null;
    // if current bean is injected from a parent bean that is also being created, current bean
    // can inherit only from the parent bean.
    if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 1) {
      SFSBInjectedXPCs currentInjectedXPCs = SFSBCallStack.getSFSBCreationTimeInjectedXPCs(puScopedName);
      result = currentInjectedXPCs.findExtendedPersistenceContextShallowInheritance(puScopedName);
    } else {
      // else inherit from parent bean that created current bean (if any).  The parent bean is the one
      // that did a JNDI lookup of the current bean.
      Map<String, ExtendedEntityManager> handle = SFSBCallStack.getCurrentCall();
      if (handle != null) {
        result = handle.get(puScopedName);
        if (result != null) {
          return result;
        }
      }
    }
    return result;

  }
}
origin: org.wildfly/wildfly-jpa

@Override
public void registerExtendedPersistenceContext(String scopedPuName, ExtendedEntityManager entityManager) {
  if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 0) {
    SFSBCallStack.getSFSBCreationTimeInjectedXPCs(scopedPuName).registerShallowInheritance(scopedPuName, entityManager);
  }
}
origin: org.jboss.eap/wildfly-jpa

@Override
public Object processInvocation(InterceptorContext interceptorContext) throws Exception {
  try {
    // beginSfsbCreation() will setup a "creation time" thread local store for tracking references to extended
    // persistence contexts.
    SFSBCallStack.beginSfsbCreation();
    return interceptorContext.proceed();
  } finally {
    // bean PostCreate event lifecycle has already completed.
    // endSfsbCreation() will clear the thread local knowledge of "creation time" referenced extended
    // persistence contexts.
    SFSBCallStack.endSfsbCreation();
  }
}
origin: org.wildfly/wildfly-jpa

/**
 * gets the current SFSB invocation off the invocation call stack
 *
 * @return the entity manager map
 */
static Map<String, ExtendedEntityManager> getCurrentCall() {
  ArrayList<Map<String, ExtendedEntityManager>> stack = currentSFSBCallStack();
  Map<String, ExtendedEntityManager> result = null;
  if (stack != null) {
    result = stack.get(stack.size() - 1);
  }
  return result;
}
origin: org.jboss.eap/wildfly-jpa

@Override
public void registerExtendedPersistenceContext(String scopedPuName, ExtendedEntityManager entityManager) {
  if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 0) {
    SFSBCallStack.getSFSBCreationTimeInjectedXPCs(scopedPuName).registerShallowInheritance(scopedPuName, entityManager);
  }
}
origin: org.jboss.eap/wildfly-jpa

/**
 * gets the current SFSB invocation off the invocation call stack
 *
 * @return the entity manager map
 */
static Map<String, ExtendedEntityManager> getCurrentCall() {
  ArrayList<Map<String, ExtendedEntityManager>> stack = currentSFSBCallStack();
  Map<String, ExtendedEntityManager> result = null;
  if (stack != null) {
    result = stack.get(stack.size() - 1);
  }
  return result;
}
origin: org.jboss.eap/wildfly-jpa

/**
 * Pops the current SFSB invocation off the invocation call stack
 *
 * @return the entity manager map
 */
public static Map<String, ExtendedEntityManager> popCall() {
  ArrayList<Map<String, ExtendedEntityManager>> stack = currentSFSBCallStack();
  Map<String, ExtendedEntityManager> result = stack.remove(stack.size() - 1);
  stack.trimToSize();
  return result;
}
origin: org.wildfly/wildfly-jpa

/**
 * Push the passed SFSB context handle onto the invocation call stack
 *
 * @param entityManagers the entity manager map
 */
public static void pushCall(Map<String, ExtendedEntityManager> entityManagers) {
  currentSFSBCallStack().add(entityManagers);
  if (entityManagers != null) {
    /**
     * JPA 2.0 spec section 7.9.1 Container Responsibilities:
     * "When a business method of the stateful session bean is invoked,
     *  if the stateful session bean uses container managed transaction demarcation,
     *  and the entity manager is not already associated with the current JTA transaction,
     *  the container associates the entity manager with the current JTA transaction and
     *  calls EntityManager.joinTransaction.
     *  "
     */
    for(ExtendedEntityManager extendedEntityManager: entityManagers.values()) {
      extendedEntityManager.internalAssociateWithJtaTx();
    }
  }
}
origin: org.jboss.eap/wildfly-jpa

/**
 * Push the passed SFSB context handle onto the invocation call stack
 *
 * @param entityManagers the entity manager map
 */
public static void pushCall(Map<String, ExtendedEntityManager> entityManagers) {
  currentSFSBCallStack().add(entityManagers);
  if (entityManagers != null) {
    /**
     * JPA 2.0 spec section 7.9.1 Container Responsibilities:
     * "When a business method of the stateful session bean is invoked,
     *  if the stateful session bean uses container managed transaction demarcation,
     *  and the entity manager is not already associated with the current JTA transaction,
     *  the container associates the entity manager with the current JTA transaction and
     *  calls EntityManager.joinTransaction.
     *  "
     */
    for(ExtendedEntityManager extendedEntityManager: entityManagers.values()) {
      extendedEntityManager.internalAssociateWithJtaTx();
    }
  }
}
org.jboss.as.jpa.containerSFSBCallStack

Javadoc

For tracking of SFSB call stack on a per thread basis. When a SFSB with an extended persistence context (XPC) is injected, the SFSB call stack is searched for a XPC that can be inherited from.

Most used methods

  • beginSfsbCreation
    called from SFSBPreCreateInterceptor, before bean creation
  • currentSFSBCallStack
    Return the current entity manager call stack
  • currentSFSBCallStackInvocation
    return for just the current entity manager invocation
  • endSfsbCreation
    called from SFSBPreCreateInterceptor, after bean creation
  • getCurrentCall
    gets the current SFSB invocation off the invocation call stack
  • getSFSBCreationBeanNestingLevel
  • getSFSBCreationTimeInjectedXPCs
  • popCall
    Pops the current SFSB invocation off the invocation call stack
  • pushCall
    Push the passed SFSB context handle onto the invocation call stack

Popular in Java

  • Reading from database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • setScale (BigDecimal)
  • getExternalFilesDir (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Table (org.hibernate.mapping)
    A relational table
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now