DOFObjectbeginSession Method (DOFInterface, DOFInterfaceID, DOFOperationControl, Int32, DOFObjectSessionOperationListener, Object)OpenDOF Object Access Library
Used by a Requestor to begin a session.

Namespace: org.opendof.core.oal
Assembly: dof-oal (in dof-oal.dll) Version: 7.0.1.2
Syntax

C#
public DOFOperationSession beginSession(
	DOFInterface iface,
	DOFInterfaceID sessionType,
	DOFOperationControl control,
	int timeout,
	DOFObjectSessionOperationListener operationListener,
	Object context
)

Parameters

iface
Type: org.opendof.core.oalDOFInterface
Any interface being currently provided by the target provider of this session. The system uses this interface to locate the correct provider. Also, if a DOFProviderException is thrown by the Provider, the system uses iface to decode the exception. This must not be null.
sessionType
Type: org.opendof.core.oalDOFInterfaceID
The session type. This is a hint to the provider that this interface should be provided on the session object (possibly in addition to others), and defines the purpose and contract for the session. Must not be null.
control
Type: org.opendof.core.oalDOFOperationControl
The control to use for the request.
timeout
Type: SystemInt32
The duration of the session, in milliseconds. After this time, the session object will no longer be available. Use DOF.TIMEOUT_NEVER to create a session with indefinite duration. Then use DOFOperation.cancel() to end the session. Must be >= 0.
operationListener
Type: org.opendof.core.oalDOFObjectSessionOperationListener
The listener to receive notification of the session being opened. If null, the session may be obtained by calling Session.waitSession(int) .
context
Type: SystemObject
An optional, user-definable object that will be passed back in listeners as a member of DOFOperation. May be null.

Return Value

Type: DOFOperationSession
The session operation. You may call DOFOperation.cancel() on this operation to end the session. Will not be null.
Remarks

Used by a Requestor to begin a session. A session is an object provided exclusively for a requestor. No other requestor is allowed to access the session object. Use Session.waitSession(int) to ensure that the session object is available. Use DOFSystem.waitProvider(DOFInterfaceID, int) to make sure there's a route to the provider. The session ends when its timeout expires or when the session operation is cancelled. Attempting to open a session on a "session object" (an object returned by Session.waitSession(int) ) is not supported.

NOTE: It is not necessary to call

destroy()
on the session object. The library will destroy the session object when the operation completes or is cancelled.

NOTE: Interest is required (through DOFSystem.beginInterest(DOFObjectID, DOFInterestLevel) for this operation in order to determine the primary provider. If no interest is specified, then this operation will result in a DOFErrorException.TIMEOUT exception.

NOTE: If the primary provider changes during the lifetime of this operation, and the Control response level includes exceptions, then see SessionOperationListener.complete(DOFOperation, DOFException) .

See Also

Reference