Hi all.
My setup is as following:
I've a Zope server, with 4 threads, and the same number of oood
processes running. In order to avoid problems of connections which can
be closed or not, I'm using a dictionary to associate a zope thread
with a connection to oood, so that each thread always reuse the same
connection.
The problem is when oood restarts its connection because, at that
time, my connection is no longer valid.
Is there a way to check if a connection is still good? I'm including
the (python) code in order to explain me:
def openOODoc(path):
desktop = getOODesktop()
url = systemPathToFileUrl(path)
doc = desktop.loadComponentFromURL(url, '_blank', 0, ())
return doc
oood_connections = {}
def getOODesktop():
thread_id = get_ident()
_oood_lock.acquire()
if oood_connections.has_key(thread_id):
connection = oood_connections[thread_id]
_oood_lock.release()
return connection
try:
localContext = getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
'com.sun.star.bridge.UnoUrlResolver', localContext)
ctx = resolver.resolve(
'uno:socket,host=localhost,port=2002;'
'urp;StarOffice.ComponentContext')
connection =
ctx.ServiceManager.createInstanceWithContext('com.sun.star.frame.Desktop',
ctx)
oood_connections[thread_id] = connection
finally:
_oood_lock.release()
return connection
Inside zope I will use the getOODoc() to open a (file system) document
inside OOo. I would like to be able to try something on the
connection, so that I check if it is still open.
Thanks!
Regards
Marco
--
Icube Srl
http://www.icube.it/
m dot bizzarri at icube dot it
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]