IOP::IOR *LoadBalancingInterceptor::locate(
CORBA::ULong /* req_id */,
CORBA_OctetSequence *objKey /* object_key */,
VISClosure& /* closure */)
{
IOP::IOR *retObjectIOR;
char *repId;
char *name;
/*
* Initialize the return value.
*/
retObjectIOR = NULL;
/*
* Extract the repository id from the key
*/
repId = NULL;
if (VISUtil::is_persistent_key(*objKey))
VISUtil::extract_persistent_key(*objKey, repId, name);
/*
* If this is a locate request for a proxy object interface
* then respond with one of the load balancing objects.
* Otherwise, the request is for some other interface type,
* so let the orb handling dispatching the request.
*/
if (repId != NULL && g_proxyObject->_is_a( repId ))
{
CORBA::Object_var objVar;
objVar = g_loadBalancingServer->pickObject();
/*
* If an object was successfully selected, convert
* the object reference to an IOR.
*/
if (objVar != NULL)
retObjectIOR = VISUtil::to_ior(objVar);
}
return retObjectIOR;
}