/usr/share/doc/pyro/examples/proxysharing/client.py is in pyro-examples 1:3.14-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #!/usr/bin/env python
import Pyro.core, Pyro.naming
import threading
import time
stop=False
def myThread(nsproxy, proxy):
global stop
name=threading.currentThread().getName()
try:
while not stop:
result=nsproxy.list(":test")
result=proxy.method("the quick brown fox jumps over the lazy dog")
except Exception,x:
print "**** Exception in thread %s: {%s} %s" % (name, type(x), x)
print "done in thread %s." % name
nsproxy = Pyro.naming.NameServerLocator().getNS()
proxy = Pyro.core.getAttrProxyForURI("PYRONAME://:test.proxysharing")
# now create a handful of threads and give each of them the same two proxy objects
threads = []
for i in range(20):
thread=threading.Thread(target=myThread, args=(nsproxy, proxy) )
# thread.setDaemon(True)
threads.append(thread)
print "Starting all threads and running them for 5 seconds."
print "They're hammering the name server and the test server using the same proxy objects."
print "You should not see any exceptions."
for t in threads:
t.start()
time.sleep(5)
print "END!"
stop=True
|