Changes

Jump to: navigation, search

Proxy

1,087 bytes added, 18:03, 18 January 2007
no edit summary
daemon.connect(self) # will also set self.daemon...
uri = self.NS.resolve(Pyro.constants.EVENTSERVER_NAME)
// # creates a proxy for the remote classto be called on later to access the # remote object and saves making an expensive call to a DB/disk if it isn't # required.
self.eventservice=Pyro.core.getProxyForURI(uri)
self.eventservice._setIdentification(ident)
# Subscribe to one or more subjects.
# It is safe to call this multiple times.
// # gets a proxy for the serviceso that an expensive call isn't require until # the actual service is needed.
self.eventservice.subscribe(subjects, self.getProxy())
def subscribeMatch(self,subjectPatterns):
# Subscribe to one or more subjects (by pattern)
# It is safe to call this multiple times.
// # gets a proxy for the serviceso that an expensive call isn't require until # the actual service is needed.
self.eventservice.subscribeMatch(subjectPatterns, self.getProxy())
def unsubscribe(self, subjects):
# Unsubscribe the subscriber for the given subject(s).
// # gets a proxy for the serviceso that an expensive call isn't require until # the actual service is needed.
self.eventservice.unsubscribe(subjects, self.getProxy())
ns = locator.getNS(host=Pyro.config.PYRO_NS_HOSTNAME)
uri = ns.resolve(Pyro.constants.EVENTSERVER_NAME)
// gets # creates a proxy for the serviceremote class to be called on later to access the # remote object and saves making an expensive call to a DB/disk if it isn't # required.
self.eventservice=Pyro.core.getProxyForURI(uri)
self.eventservice._setIdentification(ident)
if (!getPatterns().isEmpty() && getProxy() == null) {
// add a dependency on our target and create the proxy
/* sets a collection of proxies for each object instead of making an expensive
call to a DB/disk to retrieve all of the object information when it isn't
required. */
setProxy(new ProxyCollection(getName(), getReferenceType(),
getKernel().getProxyManager(), getTargets()));
}
/* Destroys all of the proxies for the objects as the system is deconstructing. */
public synchronized void stop() {
ProxyCollection proxy = (ProxyCollection) getProxy();
}
/* Adds a target object to the proxy to be instantiated if or when it is
required. */
protected synchronized void targetAdded(ObjectName target) {
ProxyCollection proxy = (ProxyCollection) getProxy();
}
/* Removes a target object from the proxy to to open it's use up to another
object. */
protected synchronized void targetRemoved(ObjectName target) {
ProxyCollection proxy = (ProxyCollection) getProxy();
1
edit

Navigation menu