[omniORB] omniORBpy: setClientCallTimeout not working
Kristóf Stróbl
stroblk at t-mobile.hu
Wed Sep 28 11:03:04 BST 2005
Hi,
We are experiencing problems with omniORB.setClientCallTimeout(objref, millisec) method invocation.
If we set the global client timeout (omniORB.setClientCallTimeout(millisec)) a method call lasting over the set timeout will be interrupted. If we set only the timeout for the object using the omniORB.setClientCallTimeout(objref, millisec), the method call will not be interrupted even if it lasts longer then the set timeout.
What are we doing wrong (we are using: omniORB 4.0.5, omniORBpy 2.5., RedHat Advanced Server 3.0)?
A sample client/server Python application:
foo.idl
-------
interface Foo
{
void FooMethod(in string param1, in string param2);
};
idlgen.sh
---------
#! /usr/bin/env sh
omniidl -bpython -Wbpackage=idl -Wbglobal=FOOidl *.idl
server.py
---------
#! /usr/bin/env python
import time
from idl import FOOidl
from idl import FOOidl__POA
from omniORB import CORBA, PortableServer
class Servant(FOOidl__POA.Foo):
def FooMethod(self, param1, param2):
time.sleep(5)
print param1, param2
commandLineArguments = ['', '-ORBendPoint', "giop:tcp:localhost:55555"]
orb = CORBA.ORB_init(commandLineArguments, CORBA.ORB_ID)
poa = orb.resolve_initial_references("omniINSPOA")
servant = Servant()
poa.activate_object_with_id("FooObject", servant)
poaManager = poa._get_the_POAManager()
poaManager.activate()
orb.run()
client.py
---------
#! /usr/bin/env python
import time
from idl import FOOidl
from idl import FOOidl__POA
import omniORB
from omniORB import CORBA
orb = CORBA.ORB_init([], CORBA.ORB_ID)
obj = orb.string_to_object("corbaloc:iiop:localhost:55555/FooObject")
#omniORB.setClientCallTimeout(1000)
FooObject = obj._narrow(FOOidl.Foo)
omniORB.setClientCallTimeout(obj, 1000)
counter = 0
while True:
print time.strftime("%Y-%m-%d %H:%M:%S"), "Before CORBA call", counter
try:
FooObject.FooMethod("param1", "param2")
except:
print time.strftime("%Y-%m-%d %H:%M:%S"), "EXCEPTION!!!"
raise
print time.strftime("%Y-%m-%d %H:%M:%S"), "After CORBA call"
time.sleep(1)
counter += 1
Thanks,
Kristof
More information about the omniORB-list
mailing list