bstr_reference_recover(3) — Subroutines
Name
bstr_reference_recover − Attempts to recover an application by restoring the connection with its server and rebuilding all recoverable object references.
Syntax
bstr_t_status bstr_reference_recover (
bstr_t_status (∗new_callback)(
bstr_t_natural reason,
bstr_t_natural ∗timeout,
bstr_t_address user_param),
bstr_t_status (∗∗old_callback)(
bstr_t_natural reason,
bstr_t_natural ∗timeout,
bstr_t_address user_param),
bstr_t_address user_param);
Description
The bstr_reference_recover procedure calls the user callback routine. If the callback returns BSTR_S_NORMAL, it attempts to establish a connection with the server. If this operation is successful, it rebuilds all recoverable object references; otherwise, it makes another attempt to connect with the server.
This loop continues until the callback returns a value other than BSTR_S_NORMAL, in which case BASEstar Open assumes that the application aborted.
The example below illustrates the syntax of the callback:
bstr_t_status do_recovery (bstr_t_natural reason,
bstr_t_natural ∗ptimeout,
bstr_t_address p)
{
bstr_t_status sts;
switch(reason)
{
case BSTR_C_RECOVERY_STARTED:
sts = BSTR_S_NORMAL;
break;
case BSTR_C_RECOVERY_RETRY:
sts = BSTR_S_NORMAL;
break;
case BSTR_C_RECOVERY_COMPLETED:
sts = BSTR_S_NORMAL;
break;
case BSTR_C_RECOVERY_NOT_COMPLETED:
sts = BSTR_S_ABORT;
break;
default:
sts = BSTR_S_INTERNAL_ERROR;
break;
}
return sts;
}
Arguments
∗new_callback
access: read
The address of a user-written function. bstr_reference_recover uses this address to notify you that the recovery procedure is in progress.
∗old_callback
access: read
The address of the previous callback.
user_param
access: read
An address that you specify to bstr_reference_recover, and that bstr_reference_recover passes to the callback. If this parameter contains NULL, bstr_reference_recover aborts the recovery procedure.
Return Values
| BSTR_S_ABORTED | Operation aborted |
| BSTR_S_BAD_PARAMETER | Bad parameter value |
| BSTR_S_NORMAL | Normal successful completion |
See Also
| bstr_reference_set | # |