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
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.
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, scopeTypeFields inherited from interface de.hybris.platform.sap.core.jco.connection.JCoConnection
JCO_DESTINATION, JCO_LANG, JCO_SCOPE_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Gets called if connection should be destroyed.protected voidTries 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(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
-
Constructor Details
-
JCoConnectionStateful
Constructor.- Parameters:
properties- properties
-
-
Method Details
-
init
Description copied from class:JCoConnectionImplInit method called by spring init method definition.- Overrides:
initin classJCoConnectionImpl- Throws:
BackendException- Exception in case of failure.
-
destroy
Description 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
Description 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
Description 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
-