|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JCoSessionReference
A JCoSessionReference is a simple reference to a session or scope in a runtime environment
that implemented and registered a SessionReferenceProvider. A session or scope is identified
by JCo by its ID(getID()
).
A session is not necessarily the local user session, but could also be some nested sub-session or scope.
It shall be a unit that has its own local state,
and keeps this somewhere in that scope or session. In complex environments, there could be a
session-tree, and scopeTypes could identify each level of the hierarchy. In simple environments,
there might be only the user session. What fits best to your needs, depends on your use cases. The fewer
complexity, the simpler are the scenarios that are possible.
The following short sequence shall illustrate, when the two event methods will be invoked that signal
to session management that the business application now wants to establish a context on the remote side.
It is assumed that the complete example code is run within the same scope:
As soon as a context has been started, JCo expects that this scope is no longer used
concurrently in different threads for all destinations, for which the
JCoContext.begin(destination1);
//--> contextStarted() will be invoked on the current session reference
...
JCoContext.begin(destination2);
...
JCoContext.end(destination1);
...
JCoContext.end(destination2);
//--> contextFinished() will be invoked on the current session reference
JCoContext
is still open. If a scope is used concurrently, it might end up in a JCoException
of group JCO_ERROR_CONCURRENT_CALL
being thrown, when trying to execute
a function module on a destination set to stateful in this scope. The reasoning behind that
is the fact that concurrent execution would end up in random results as the order is not
clearly defined. Backend state is associated with the connection. Hence, for a given scope and
destination, there is only a single connection allowed.
Method Summary | |
---|---|
void |
contextFinished()
This method will be executed when the last connection is released in a stateful sequence within a session. |
void |
contextStarted()
This method will be executed when the first call is executed in a stateful sequence within a session. |
java.lang.String |
getID()
This method must return a session ID that uniquely identifies the referenced JCoSessionReference
in the runtime environment, in which JCo is running. |
Method Detail |
---|
java.lang.String getID()
JCoSessionReference
in the runtime environment, in which JCo is running. This session ID is used by JCo
internally, whenever it is required to identify a specific session or scope context. In particular, JCo is using
the ID in order to find out, whether there exists a stateful connection for a certain destination.
This happens always when executing a function module or committing a function unit.
void contextStarted()
void contextFinished()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |