# Locate requests

## Context

The CORBA specification describes locate requests as a way to find out if an object is available at the other end of the wire or not without invoking an actual method on it. This way expensive marshalling and demarshalling can be prohibited. Locate requests are part of GIOP.

## Implementation

The main classes involved in locate requests are the Server_Connection_Handler to do check for the object. This is done by invoking the non standard "non_existent" method on it. If it fails an exception will be thrown, if the exception is not the Forward_Request exception of the POA, the object is not there. If it is this specific exception, the new forwarded location can be extracted and returned in the locate reply. If the call on "non_existent" succeeds, we know the object is there and return that. The client part of the locate request is handled int Locate_Request_Invocation. The response is checked on the answer. If there, we go on and invoke the actual method on the distant object. If not there, we fail and throw the proper exception and if we get forwarded we replace our IIOP profile acordingly.

## API

To activate the locate requests, please invoke the non standard method "_use_locate_requests (CORBA::B_TRUE)" on your CORBA::Object or any object which inherits form this object. This will activate the locate request on the first call to the object. The second time and on all following calls "no" locate request will be used any more. To switch it on again use "_use_locate_requests (CORBA::B_TRUE)" again. You can also switch it of by "_use_locate_requests (CORBA::B_FALSE)".

For more details and questions,