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.
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.sap.core.jco.connection.impl.JCoConnectionImpl
connectionParameters, destroyed, jcoManagedConnectionContainer, properties, rfcDestinationService
-
Fields inherited from interface de.hybris.platform.sap.core.jco.connection.JCoConnection
JCO_DESTINATION, JCO_LANG, JCO_SCOPE_TYPE
-
-
Constructor Summary
Constructors Constructor Description JCoConnectionStateful(java.util.Properties properties)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Gets called if connection should be destroyed.protected voidendJCoContextInALoop()Tries to terminate a stateful connection several times until the context is ended.voidexecute(com.sap.conn.jco.JCoFunction function)This method is used to execute a JCoFunction on behalf of this connection.protected voidfinalize()com.sap.conn.jco.JCoFunctiongetFunction(java.lang.String funcName)Returns a JCoFunction object for the given function name.voidinit()Init method called by spring init method definition.-
Methods inherited from class de.hybris.platform.sap.core.jco.connection.impl.JCoConnectionImpl
checkInternalStatus, executeCachedFunction, getCallerId, getDestination, getReplacedFunctionModuleName, getRFCDestination, getScopeType, handleCommunicationExceptionAndDestroyConnection, isBackendAvailable, isBackendOffline, isFunctionAvailable, isFunctionCached, isStateful, postProcessingExecute, preProcessingExecute, setCallerId, setConnectionParameters, setDestroyed, setJcoManagedConnectionContainer, setRfcDestinationService, setScopeType
-
-
-
-
Method Detail
-
init
public void init() throws BackendExceptionDescription copied from class:JCoConnectionImplInit method called by spring init method definition.- Overrides:
initin classJCoConnectionImpl- Throws:
BackendException- Exception in case of failure.
-
destroy
public void destroy() throws BackendExceptionDescription copied from interface:JCoStatefulGets called if connection should be destroyed.- Specified by:
destroyin interfaceJCoStateful- 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 withJCoContext.begin() theJCoContext.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 aJCoDestinationis requested directly through theJCoDestinationManager, which reuses instances, is is technically possible to begin a context several times.
-
getFunction
public com.sap.conn.jco.JCoFunction getFunction(java.lang.String funcName) throws BackendExceptionDescription copied from interface:JCoConnectionReturns a JCoFunction object for the given function name.- Specified by:
getFunctionin interfaceJCoConnection- Overrides:
getFunctionin classJCoConnectionImpl- 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 BackendExceptionDescription copied from interface:JCoConnectionThis method is used to execute a JCoFunction on behalf of this connection.- Specified by:
executein interfaceJCoConnection- Overrides:
executein classJCoConnectionImpl- 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 java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-