ServiceTemplate tmpl,
RemoteEventListener listenerProxy,
long duration) throws RemoteException
{
/* Register with the event mechanism of the given lookup service */
EventRegistration e = null;
int transition = ( ServiceRegistrar.TRANSITION_NOMATCH_MATCH
| ServiceRegistrar.TRANSITION_MATCH_NOMATCH
| ServiceRegistrar.TRANSITION_MATCH_MATCH );
e = proxy.notify(tmpl, transition, listenerProxy, null, duration);
/* Proxy preparation -
*
* Prepare the proxy to the lease on the event registration just
* returned. Because lease management (renewal and cancellation)
* involves remote calls, lease proxies should be prepared before
* management of the associated leases begins. This allows one to
* verify trust in the lease, and ensures that the appropriate
* constraints are attached to the lease.
*/
Lease eventLease = e.getLease();
eventLease = (Lease)eventLeasePreparer.prepareProxy(eventLease);
logger.log(Level.FINEST, "ServiceDiscoveryManager - proxy to event "
+"registration lease prepared: {0}", eventLease);
/* Management the lease on the event registration */
leaseRenewalMgr.renewFor(eventLease,
duration,
new LeaseListenerImpl(proxy));
/* Wrap source, id, event sequence & lease in EventReg, and return. */
return ( new EventReg(e.getSource(),
e.getID(),
e.getSequenceNumber(),
eventLease) );
}//end registerListener