Package net.jini.core.event

Examples of net.jini.core.event.EventRegistration


             new StorableObject[]{tmpl});

      templates.add(reg, tmpl);
  }

  return new EventRegistration(eventID, spaceProxy,
      leaseFactory.newLease(cookie, reg.getExpiration()),
      0);
    }
View Full Code Here


  }

  protected void setupNotify() {
    if(registrar != null) {
      try {
  EventRegistration reg =
      registrar.notify(stmpl,
           ServiceRegistrar.TRANSITION_MATCH_NOMATCH |
           ServiceRegistrar.TRANSITION_NOMATCH_MATCH |
           ServiceRegistrar.TRANSITION_MATCH_MATCH,
           receiver.proxy,
           null,
           Lease.ANY);
  elease = (Lease) browser.leasePreparer.prepareProxy(reg.getLease());
  browser.leaseMgr.renewUntil(elease, Lease.ANY,
            new Browser.LeaseNotify());
  eventID = reg.getID();
  seqNo = reg.getSequenceNumber();
      } catch (Throwable t) {
  logger.log(Level.INFO, "event registration failed", t);
      }
    }
  }
View Full Code Here

      for (int i=0; i<tmpls.length; i++) {
    templates.add(reg, tmpls[i]);
      }
  }

  return new EventRegistration(eventID, spaceProxy,
      leaseFactory.newLease(cookie, reg.getExpiration()),
      0);
    }
View Full Code Here

                    ServiceTemplate tmpl,
                    RemoteEventListener listenerProxy,
                    long durationthrows 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
View Full Code Here

  throws RemoteException
   
  concurrentObj.writeLock();
  try {
      ready.check();
      EventRegistration reg = notifyDo(
    tmpl, transitions, listener, handback, leaseDuration);
      if (logger.isLoggable(Level.FINE)) {
    logger.log(
        Level.FINE,
        "registered event listener {0} as {1}",
        new Object[]{
      listener,
      ((ReferentUuid) reg.getLease()).getReferentUuid()
        });
      }
      return reg;
  } finally {
      concurrentObj.writeUnlock();
View Full Code Here

  /* see if the expire thread needs to wake up earlier */
  if (reg.leaseExpiration < minEventExpiration) {
      minEventExpiration = reg.leaseExpiration;
      concurrentObj.waiterNotify(eventNotifier);
  }
  return new EventRegistration(
      reg.eventID,
      proxy,
      EventLease.getInstance(
    myRef,
    myServiceID,
View Full Code Here

      elease = null;
  }
  if (lookup == null)
      return;
  try {
      EventRegistration reg =
    lookup.notify(tmpl,
            ServiceRegistrar.TRANSITION_MATCH_NOMATCH |
            ServiceRegistrar.TRANSITION_NOMATCH_MATCH |
            ServiceRegistrar.TRANSITION_MATCH_MATCH,
            listen.proxy, null, Lease.ANY);
      elease = (Lease) leasePreparer.prepareProxy(reg.getLease());
      leaseMgr.renewUntil(elease, Lease.ANY, lnotify);
      eventID = reg.getID();
      seqNo = reg.getSequenceNumber();
  } catch (Throwable t) {
      failure(t);
  }
    }
View Full Code Here

  set = prepareSet(set);
  logger.log(Level.FINE, "Created Set with lease duration of " +
        "Lease.FOREVER.");

  // register listener to receive events
  EventRegistration evReg = set.setRenewalFailureListener(rrl, null);
  evReg = prepareRegistration(evReg);

  // check event registration (not formally part of this test)
  if (rstUtil.isValidRenewFailEventReg(evReg, set) == false) {
      String message = "Registration is invalid because:\n" +
View Full Code Here

  // create a handback object
  MarshalledObject handback = new MarshalledObject(new Integer(99));

  // register listener to receive events
  EventRegistration evReg =
      set.setExpirationWarningListener(rrl, minWarning, handback);
  evReg = prepareRegistration(evReg);

  if (rstUtil.isValidExpWarnEventReg(evReg, set) == false) {
      String message = "Event Registration is invalid.";
View Full Code Here

  // create a handback object
  MarshalledObject handback = new MarshalledObject(new Integer(99));

  // register listener to receive events
  EventRegistration evReg =
      set.setRenewalFailureListener(rrl, handback);
  evReg = prepareRegistration(evReg);

  // create a lease that will fail to renew
  logger.log(Level.FINE, "Creating the lease to be managed.");
View Full Code Here

TOP

Related Classes of net.jini.core.event.EventRegistration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.