3.2.2.1.2 Caution to Users
For objects to be preactivated in this fashion, the state usually cannot be recovered if a crash occurs. (This is because the state was considered too complex or inconvenient to set upon initial, delayed activation.) This is a valid object technique, essentially stating that the object is valid only for a single activation period.
However, a problem may arise because of the “one-time” usage. Since a client still holds an object reference that leads to the process containing that state, and since the state cannot be recreated after the crash, care must be taken that the client’s next invocation does not automatically provoke a new activation of the object, because that object would have inapplicable state.
The solution is to refuse to allow the object to be activated
automatically by the TP Framework. If the user provides the
TobjS::ActivateObjectFailed
exception to the TP
Framework as a result of the activate_object
call, the
TP Framework will not complete the activation and will return an
exception to the client, CORBA::OBJECT_NOT_EXIST
. The
client has presumably been warned about this possibility, since it
knows about the iterator (or similar) pattern. The client must be
prepared to restart the iteration.
Note:
This defensive measure may not be necessary in the future; the TP Framework itself may detect that the object reference is no longer valid. In particular, you should not depend on the possibility that theactivate_object
method might be called. If the TP Framework does in fact change, activate_object will not be called and the framework itself will generate the OBJECT_NOT_EXIST
exception.
Parent topic: Explicit Activation