ASAP 2.7 Extension Manual

Implementing the ASAP Extension in an Application
HP NonStop ASAP Extension Manual425265-004
4-10
Removing a Domain
Example 2 – Application Uses an Extended Data Segment
int(32) seg^offset
,.ext s^offset
;
int error
,version
,segment^id
;
string domain^name[0:63]; !max 64 bytes
.
.
.
error := segment_allocate_(segment^id,…..
.
.
.
@s^offset := $xadr(seg^offset)
domain^name ‘:=’ my^domain^name for name^len;
version := %402; !set version
segment^id := segment^id + 1; !set seg id
segment^base := next^32^segment; !set seg base
if (error := ASAP_REGISTER_( domain^name:name^len
, s^offset
,!error^detail!
,segment^id
,segment^base
,version
,!asap^id:id^len!
,!flags! )) <> 0 then begin
updates := false; !not ok, set updates off
call write(ems^collector,error^message…..
end;
Removing a Domain
When any process registers a domain with the ASAP Extension, a statistics record is
generated for that domain as long as it remains registered and the ASAP Extension
remains active—even if the process fails or is stopped. When a process is not
available for an entire interval, the statistics records for all its metrics might contain all
zero values or might display constant values previously set by the application.
Although this behavior is fine for most online applications, it is not appropriate for
transient processes that run periodically, such as batch processes.
Typically, only batch processes use the optional removal procedure. Calling the
removal procedure at the end of a batch-type process execution makes the ASAP
Extension write the last statistics record for the domain, remove it from the registered
set, and stop writing statistics for the domain.
Like the registration procedure, the removal procedure requires the caller to supply the
shared segment ID if it is not 0. The caller must also supply the 32-bit address passed
back from the registration procedure. The removal procedure uses the message box
within shared memory to notify ASAPX of the domain’s removal at its next gathering
interval. It does not communicate directly with ASAPX. For a short time, a process
removes all its domains, yet they still appear within ASAPX. ASAPX considers those
domains active until it writes their last statistics records.