[omniORB] How to minimize the timeout on a connection broken ?

Slava Garelin garelin@ukr.net
Fri Aug 23 14:19:00 2002


On Friday 23 August 2002 11:45, Thierry Descombes wrote:
> OmniOrb 3.0.4 does it integrate the notion of interceptors ?
> And, concerning the -ORBclientCallTimeOutPeriod option, isn't it rather
> in second ?
> I may need interceptors... Indeed, my server is the client of another
> Management's program.
> Could you send me a short example ?

My example based on example by Brecht Vermeulen ( 
http://www.realvnc.com/pipermail/omniorb-list/2002-February/009715.html ) 
with little changes.

insert this in eg2_impl: 

// For interceptors
#include <omniORB4/omniInterceptors.h> 
// Thread specific data
#include <omnithread.h>

omni_thread::key_t key; 

CORBA::Boolean testfunc(omni::omniInterceptors::clientSendRequest_T::info_T& 
info) {
  cout << "InterceptorFunc ThreadId = " << OffThread::Self() << endl;
  unsigned long abs_secs,abs_nanosecs;
  unsigned long* TimeOutSec =
        (unsigned long*)omni_thread::self()->get_value(key));
  if(TimeOutSec){
    omni_thread::get_time(&abs_secs,&abs_nanosecs,*TimeOutSec,0);
    info.giopstream.setDeadline(abs_secs,abs_nanosecs);
    cout << "InterceptorFunc Deadline set to " << TimeOutSec <<".\n";
  }
  return true;
} 

before poa_manager->activate: 

key = omni_thread::allocate_key();
omniORB::getInterceptors()->clientSendRequest.add(&testfunc); 

and before call IDL operation:

unsigned long TIMEOUT_IN_MKS = 12345;
omni_thread::self()->set_value(key, &TIMEOUT_IN_MKS);

All calls from this thread will had TIMEOUT_IN_MKS timeout from that moment.
You can set in each thread this value arbitrary quantity of times.


-- 
Slava Garelin