Skip to main content

VBC 4.5 - How to avoid recursive bind calls within the bind_failed() method of bind interceptor ?

  • February 16, 2013
  • 0 replies
  • 1 view

Dominique Sacre
Forum|alt.badge.img+2

Problem:

  • Product Name: VisiBroker for C
  • Product Version: 4.5
  • Product Component: ORB
  • Platform/OS Version: All

Objective is to determine at the CORBA Client end if a Server"s IOR (obtained from Naming Service) is stale or not. Client process is using bind interceptor for this purpose and using _non_existent() call within the bind_failed() method. If the obtained Server IOR is of the Server process which is down, then the bind_failed() gets called and the _non_existent() call results in recursive call to bind_failed().

How to avoid this recursive bind calls within the bind_failed() method of bind interceptor ?

Resolution:

Calling a Server invocation in bind_failed() of BindInterceptor with stale Server IOR is going to result in recursive calls of bind_failed(). So, calling _non_existent() in the bind_failed is not going to be a solution.

If the Server is going to be restarted on the same platform (OS), then a suggestion is to use the _is_equivalent() call for comparing whether the Server object got from the naming service, and the one which resulted in the bind_failed are equivalent. If these are equivalent then let bind_failed return NULL, otherwise the bind_failed can return the new Server IOR.

The above comment about the Server being started on same OS is made since Server object references generated by different ORBs can be different.

Following is the modified bind_failed() of SampleBindInterceptor.h of client_server interceptor example of VBC 4.5, that shows a sample code of the above suggestion.

.....
IOP::IORValue_ptr bind_failed(IOP::IORValue_ptr ior, CORBA_Object_ptr object, VISClosure& closure) {
 CORBA::Object_ptr newObj = string_to_object(objref);
 if (object->_is_equivalent(newObj))
   return NULL;
 else {
   IOP::IORValue_ptr newIOR = VISUtil::to_ior(objref);
   return newIOR; 
 }
 return NULL;
}
......

 


#Security
#VisiBroker