Class JCoConnectionStateful

java.lang.Object
de.hybris.platform.sap.core.jco.connection.impl.JCoConnectionImpl
de.hybris.platform.sap.core.jco.connection.impl.JCoConnectionStateful
All Implemented Interfaces:
JCoConnection, JCoStateful

public class JCoConnectionStateful extends JCoConnectionImpl implements JCoStateful
Stateful RFC connection.
Establishes a stateful RFC connection to the backend by calling JCoContext.begin() during initialization and JCoContext.end() during destruction. Destruction is done during destroy() method. After the destroy() method was called, it is no more possible to execute JCoFunctions with that connection.
During finalize() this class tests if the RFC connection was ended properly. If not it writes error messages to the log file and tries to end the RFC connection in order to avoid hanging RFC connections.
  • Constructor Details

    • JCoConnectionStateful

      public JCoConnectionStateful(Properties properties)
      Constructor.
      Parameters:
      properties - properties
  • Method Details

    • init

      public void init() throws BackendException
      Description copied from class: JCoConnectionImpl
      Init method called by spring init method definition.
      Overrides:
      init in class JCoConnectionImpl
      Throws:
      BackendException - Exception in case of failure.
    • destroy

      public void destroy() throws BackendException
      Description copied from interface: JCoStateful
      Gets called if connection should be destroyed.
      Specified by:
      destroy in interface JCoStateful
      Throws:
      BackendException - in case of failure.
    • endJCoContextInALoop

      protected void endJCoContextInALoop()
      Tries to terminate a stateful connection several times until the context is ended.
      In case of a destination is called several times with JCoContext.begin() the JCoContext.end() needs to be called the equivalent. This method is for preventing hanging connections in the backend and logs an error if the connection was not destroyed properly.
      This circumstance should not happen if just this class is used for connection handling. But if a JCoDestination is requested directly through the JCoDestinationManager, which reuses instances, is is technically possible to begin a context several times.
    • getFunction

      public com.sap.conn.jco.JCoFunction getFunction(String funcName) throws BackendException
      Description copied from interface: JCoConnection
      Returns a JCoFunction object for the given function name.
      Specified by:
      getFunction in interface JCoConnection
      Overrides:
      getFunction in class JCoConnectionImpl
      Parameters:
      funcName - name of remote callable function module on the SAP system
      Returns:
      JCoFunction
      Throws:
      BackendException - when something goes wrong while retrieving meta data
    • execute

      public void execute(com.sap.conn.jco.JCoFunction function) throws BackendException
      Description copied from interface: JCoConnection
      This method is used to execute a JCoFunction on behalf of this connection.
      Specified by:
      execute in interface JCoConnection
      Overrides:
      execute in class JCoConnectionImpl
      Parameters:
      function - a JCoFunction which should be executed
      Throws:
      BackendException - thrown if something goes wrong in the EAI layer or if an JCoException is thrown by the SAP Java Connector.
    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable