CORBA::Object_ptr AWSLoadBalancing::pickObject( )
{
VISMutex_var lock(m_loadBalancingMtx);
CORBA::Object_var objVar = NULL;
/*
* Continue until an available object is found.
*/
while (objVar == NULL)
{
/*
* Call the (virtual) method to select the
* next object. Throws no exceptions
* but returns a null on any error.
*/
objVar = selectObject( );
if (objVar == NULL) return NULL;
/*
* If the object does not exist,
* remove it and select again.
*/
if (objVar->_non_existent())
{
m_serverList.removeObject( objVar );
objVar = NULL;
}
}
return CORBA::Object::_duplicate( objVar );
}