Examples of MailboxPullRegistration


Examples of net.jini.event.MailboxPullRegistration

      EventMailbox mb = getMailbox();
      mr = getRegistration(mb, DURATION);
      mrl = getMailboxLease(mr);
  } else if (mbType.equals(PULL_MAILBOX_IF_NAME)) {
            PullEventMailbox pmb = getPullMailbox();
      MailboxPullRegistration mpr = getPullRegistration(pmb, DURATION);
      mrl = getPullMailboxLease(mpr);
            mr = mpr;
   } else {
            throw new TestException(
    "Unsupported mailbox type requested" + mbType);
View Full Code Here

Examples of net.jini.event.MailboxPullRegistration

  PullEventMailbox mb = getPullMailbox();
  int i = 0;

  // Register and check lease
        Date gotLease = new Date();
  MailboxPullRegistration mr = getPullRegistration(mb, REG_LEASE);
  Lease mrl = getPullMailboxLease(mr);
  checkLease(mrl, REG_LEASE);

        // Start canceler thread with a delay of REG_LEASE_CANCEL_WAIT
        Thread t =
            new Thread(
                new Canceler(mrl, REG_LEASE_CANCEL_WAIT, logger));
        t.start();
       
        // Get events and verify
  logger.log(Level.INFO, "Getting events from empty mailbox.");
        RemoteEventIterator rei = mr.getRemoteEvents();
        RemoteEvent rei_event;
        Date before = new Date();
  logger.log(Level.INFO, "Calling next() on empty set @ {0}", before);       
        try {
            rei_event = rei.next(REG_LEASE_WAIT);
View Full Code Here

Examples of net.jini.event.MailboxPullRegistration

      logger.log(Level.INFO, "Getting registration lease");
      lease = getMailboxLease(mbr);
  } else if (mbType.equals(PULL_MAILBOX_IF_NAME)) {
      PullEventMailbox mb = getPullMailbox();
      logger.log(Level.INFO, "Generating a pull registration");
      MailboxPullRegistration mbr = getPullRegistration(mb, DURATION);
      logger.log(Level.INFO, "Getting registration lease");
      lease = getPullMailboxLease(mbr);
  } else {
      throw new TestException(
    "Unsupported mailbox type requested" + mbType);
View Full Code Here

Examples of net.jini.event.MailboxPullRegistration

  PullEventMailbox mb = getPullMailbox();
  int i = 0;

  // Register and check lease
  MailboxPullRegistration mr = getPullRegistration(mb, DURATION1);
  Lease mrl = getPullMailboxLease(mr);
  checkLease(mrl, DURATION1);

  // Get the mailbox service provided listener
  RemoteEventListener mbRel = getPullMailboxListener(mr);
View Full Code Here

Examples of net.jini.event.MailboxPullRegistration

      EventMailbox mb = getMailbox();
      mr = getRegistration(mb, DURATION);
      mrl = getMailboxLease(mr);
  } else if (mbType.equals(PULL_MAILBOX_IF_NAME)) {
            PullEventMailbox pmb = getPullMailbox();
      MailboxPullRegistration mpr = getPullRegistration(pmb, DURATION);
      mrl = getPullMailboxLease(mpr);
            mr = mpr;
   } else {
            throw new TestException(
    "Unsupported mailbox type requested" + mbType);
View Full Code Here

Examples of net.jini.event.MailboxPullRegistration

      EventMailbox mb = getMailbox();
      MailboxRegistration mr = getRegistration(mb, DURATION);
      mrl = getMailboxLease(mr);
  } else if (mbType.equals(PULL_MAILBOX_IF_NAME)) {
            PullEventMailbox mb = getPullMailbox();
      MailboxPullRegistration mr = getPullRegistration(mb, DURATION);
      mrl = getPullMailboxLease(mr);
  } else {
            throw new TestException(
    "Unsupported mailbox type requested" + mbType);
  }
View Full Code Here

Examples of net.jini.event.MailboxPullRegistration

      EventMailbox mb = getMailbox();
      mr = getRegistration(mb, DURATION);
      mrl = getMailboxLease(mr);
  } else if (mbType.equals(PULL_MAILBOX_IF_NAME)) {
            PullEventMailbox pmb = getPullMailbox();
      MailboxPullRegistration mpr = getPullRegistration(pmb, DURATION);
      mrl = getPullMailboxLease(mpr);
            mr = mpr;
   } else {
            throw new TestException(
    "Unsupported mailbox type requested" + mbType);
View Full Code Here

Examples of net.jini.event.MailboxPullRegistration

  PullEventMailbox mb = getPullMailbox();
  int i = 0;

  // Register and check lease
  MailboxPullRegistration mr = getPullRegistration(mb, DURATION1);
  Lease mrl = getPullMailboxLease(mr);
  checkLease(mrl, DURATION1);

  // Get the mailbox service provided listener
  RemoteEventListener mbRel = getPullMailboxListener(mr);

  // Create an event generator and pass it the
  // mailbox's remote event listener.
  TestGenerator myGen = TestUtils.createGenerator(manager);
  logger.log(Level.FINEST,
      "Test generator class tree"
      + getClassLoaderTree(myGen.getClass().getClassLoader()));
  EventRegistration evtReg =
      myGen.register(EVENT_ID,  // Event ID to use
         null,    // handback
         mbRel,    // Notification target
         DURATION1)// Lease duration
  Lease tgl = evtReg.getLease();
  checkLease(tgl, DURATION1);

  // Create another event generator and pass it the
  // mailbox's remote event listener.
  TestGenerator myGen2 = TestUtils.createGenerator(manager);
  logger.log(Level.FINEST,
      "Test generator class tree"
      + getClassLoaderTree(myGen2.getClass().getClassLoader()));
  EventRegistration evtReg2 =
      myGen2.register(EVENT_ID2,  // Event ID to use
         null,    // handback
         mbRel,    // Notification target
         DURATION1)// Lease duration
  Lease tgl2 = evtReg2.getLease();
  checkLease(tgl2, DURATION1);
       
        // Get events and verify
  logger.log(Level.INFO, "Getting events from empty mailbox.");
        RemoteEventIterator rei = mr.getRemoteEvents();
        RemoteEvent rei_event;
        Date before = new Date();
  logger.log(Level.INFO, "Calling next() on empty set @ {0}", before);       
        rei_event = rei.next(MAX_WAIT_GET_EVENT);
        Date after = new Date();
  logger.log(Level.INFO, "Returned from next() @ {0}", after);  
        //Verify that timeout was honored
        long delta = after.getTime() - before.getTime();
        if (delta < MAX_WAIT_GET_EVENT) {
             throw new TestException("Returned from next() before expected: "
                     + delta);
        }
        if (rei_event != null) {
            throw new TestException(
                "Received unexpected event from empty mailbox: " + rei_event);
        }

        // Start event generator thread with a delay of MAX_WAIT_SEND_EVENT
        Thread t =
            new Thread(
                new MyEventGeneratorRunnable(myGen, evtReg.getID(), 3, 1,
                                             logger, MAX_WAIT_SEND_EVENT ));
        t.start();
        before = new Date();
  logger.log(Level.INFO, "Calling next() on empty set @ {0}", before);       
        rei_event = rei.next(MAX_WAIT_GET_EVENT);
        after = new Date();
        //Verify that we returned before the timeout
        delta = after.getTime() - before.getTime();       
  logger.log(Level.INFO, "Returned from next() @ {0}, delta = {1}",
            new Object[] {after, new Long(delta)});  
        if (delta >= MAX_WAIT_GET_EVENT) {
             throw new TestException("Returned from next() after expected: "
                     + delta);
        } else if (delta <= MAX_WAIT_SEND_EVENT) {
             throw new TestException("Returned from next() before expected: "
                     + delta);           
        }
        if (rei_event == null) {
            throw new TestException(
                "Did not receive expected event from mailbox.");
        }
           
        //Generate a soon-to-be unknown event.
        myGen.generateEvent(evtReg.getID(), 3);
       
        /*
         * Add genereated event to unknown list and verify that they aren't
         * subsequently received.
         */
        ArrayList unknowns = new ArrayList(1);
        unknowns.add(rei_event);
        mr.addUnknownEvents(unknowns);
       
        before = new Date();
  logger.log(Level.INFO, "Calling next() on empty set @ {0}", before);       
        rei_event = rei.next(MAX_WAIT_GET_EVENT);
        after = new Date();
View Full Code Here

Examples of net.jini.event.MailboxPullRegistration

  PullEventMailbox mb = getPullMailbox();
  int i = 0;

  // Register and check lease
  MailboxPullRegistration mr = getPullRegistration(mb, DURATION1);
  Lease mrl = getPullMailboxLease(mr);
  checkLease(mrl, DURATION1);

  // Get the mailbox service provided listener
  RemoteEventListener mbRel = getPullMailboxListener(mr);
View Full Code Here

Examples of net.jini.event.MailboxPullRegistration

      EventMailbox mb = getMailbox();
      MailboxRegistration mr = getRegistration(mb, DURATION);
      mrl = getMailboxLease(mr);
  } else if (mbType.equals(PULL_MAILBOX_IF_NAME)) {
            PullEventMailbox mb = getPullMailbox();
      MailboxPullRegistration mr = getPullRegistration(mb, DURATION);
      mrl = getPullMailboxLease(mr);
  } else {
            throw new TestException(
    "Unsupported mailbox type requested" + mbType);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.