Package java.rmi

Examples of java.rmi.MarshalledObject$MarshalledObjectOutputStream


    sTmpl[i][j] = new ServiceTemplate(null,sClassType,
              addAttrs[j]);
    proxy.notify(tmpl[i][j],
           transitionMask,
           listener,
           new MarshalledObject
         (new QATestUtils.SrvcAttrTuple
             (srvcItems[nSrvcsPerClass*i].service,
              addAttrs[j][0])),
                             Long.MAX_VALUE);

View Full Code Here


        for (i=0;i<srvcRegs.length;i++) {
            curSrvcID = srvcRegs[i].getServiceID();
            srvcIDTmpl[i] = new ServiceTemplate(curSrvcID,null,null);
      EventRegistration er;
      er = proxy.notify(srvcIDTmpl[i], regTransitions, listener,
            new MarshalledObject(curSrvcID),
            Long.MAX_VALUE);
      evntRegs[i] = prepareEventRegistration(er);
  }
    }
View Full Code Here

  evntRegs = new EventRegistration[srvcRegs.length];
        for (i=0;i<srvcRegs.length;i++) {
            curSrvcID = srvcRegs[i].getServiceID();
      EventRegistration er;
      er = proxy.notify(srvcIDTmpl[i],regTransitions,listener,
            new MarshalledObject(curSrvcID),
            Long.MAX_VALUE);
      evntRegs[i] = prepareEventRegistration(er);
  }
    }
View Full Code Here

    sTmpl[i][j] = new ServiceTemplate(null,sClassType,
              addAttrs[j]);
    proxy.notify(tmpl[i][j],
           transitionMask,
           listener,
           new MarshalledObject
         (new QATestUtils.SrvcAttrTuple
             (srvcItems[nSrvcsPerClass*i].service,
              addAttrs[j][0])),
           Long.MAX_VALUE);
      }
View Full Code Here

  LeaseRenewalSet set = lrs.createLeaseRenewalSet(Lease.FOREVER);
  set = prepareSet(set);
  lrm.renewFor(prepareLease(set.getRenewalSetLease()), Long.MAX_VALUE, null);

  // 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.");
  logger.log(Level.FINE, "Duration == " + renewGrant);
  TestLease testLease =
      leaseProvider.createNewLease(definiteOwner,
           rstUtil.durToExp(renewGrant));

  // start managing the lease for as long as we can
  logger.log(Level.FINE, "Adding managed lease to lease renewal set.");
  logger.log(Level.FINE, "Membership = Lease.FOREVER.");
  set.renewFor(testLease, Lease.FOREVER);
 
  // wait for the lease to expire
  rstUtil.waitForLeaseExpiration(testLease,
               "for client lease to expire.");

  /* Assert that the notification was received at approximately
     the lease expiration time */
  Long[] arrivalTimes = rrl.getArrivalTimes();

  // must at lease have received one event
  if (arrivalTimes.length == 0) {
      String message = "RenewalFailure event never received.";
      throw new TestException(message);
  }

  // must NOT have received more than one event
  if (arrivalTimes.length > 1) {
      String message = "Too many events received.";
      throw new TestException(message);
  }

  /* TESTING ASSERTION #1
     was the event received around the right time? */
  long leaseExpiration = testLease.getExpiration();
  long maxAllowed = leaseExpiration + latencySlop;

  long actualArrivalTime = arrivalTimes[0].longValue();

  // event must arrive within our assumed constraints
  if (actualArrivalTime < maxAllowed) {
      // we say event was received around the right time
      logger.log(Level.FINE, "Assertion #1 passes!");
  } else {
      /* There was a lag. This could be a network problem or an
         overloaded cpu but we will just have to assume that the
         specification was not met. */
      String message = "Assertion #1 failed ...\n" +
    "Event was not received within " + latencySlop +
    " milliseconds of client lease expiration.";
      throw new TestException(message);
  }

  /* TESTING ASSERTION #2
     the handback object is the one we expect. */
  RemoteEvent[] events = rrl.getEvents();
  MarshalledObject mObj = events[0].getRegistrationObject();
  if (handback.equals(mObj) == false) {
      String message = "Assertion #2 failed ...\n" +
    "Handback object does not match original.";
      throw new TestException(message);
  }
View Full Code Here

  /*
   * To perform all equals tests we require 4 different proxy
   * instances. Two from each service.
   */
  MarshalledObject marshObj01 = new MarshalledObject(getLRS(0));
  LeaseRenewalService lrs01 = (LeaseRenewalService) marshObj01.get();
  LeaseRenewalService lrs03 = (LeaseRenewalService) marshObj01.get();

  MarshalledObject marshObj02 = new MarshalledObject(getLRS(1));
  LeaseRenewalService lrs02 = (LeaseRenewalService) marshObj02.get();

  /* ensure that comparing two proxies from different LRS services
   * comes back false.
   */
  if (lrs01.equals(lrs02)) {
View Full Code Here

                 * unmarshalled, the element is removed from the set of
                 * marshalled registrars, decreasing that set by 1 element.
                 * Thus, the 'next' element to unmarshal is actually at
                 * the same index as the last element that was unmarshalled.
                 */
                MarshalledObject marshalledObj
                                 = (MarshalledObject)(marshalledRegs.get(i));
                ServiceRegistrar reg = (ServiceRegistrar)(marshalledObj.get());
                /* Success: record the un-marshalled element
                 *          delete the corresponding un-marshalled element
                 */
                unmarshalledRegs.add( reg );
                marshalledRegs.remove(i);
View Full Code Here

            for (j=0;j<nSrvcsPerClass;j++) {
                int n = k%(attrEntries.length);
          tmpl[k] = new ServiceTemplate(null,null,tmplAttrs[n]);
    setStateAttrInfo(k,n,tmplAttrs,state);
    proxy.notify(tmpl[k],transitionMask,listener,
           new MarshalledObject
         (new QATestUtils.SrvcAttrTuple
             (srvcItems[k].service,
              tmplAttrs[n][0])),
           Long.MAX_VALUE);
                k++;
View Full Code Here

    sTmpl[i][j] = new ServiceTemplate(null,sClassType,
              tmplAttrs[j]);
    proxy.notify(tmpl[i][j],
           transitionMask,
           listener,
           new MarshalledObject
         (new QATestUtils.SrvcAttrTuple
             (srvcItems[nSrvcsPerClass*i].service,
              tmplAttrs[j][0])),
           Long.MAX_VALUE);
      }
View Full Code Here

            for(int i=0;i<locatorsToDiscover.length;i++) {
                logger.log(Level.FINE, "   locator["+i+"] = "
                                                +locatorsToDiscover[i]);
            }
        }//endif
        MarshalledObject mHandback = null;
        int iHandback = -1;
        try {
            if(handback >= 0) {//negative handback param ==> null mHandback
                iHandback = handback;
                mHandback = new MarshalledObject(new Integer(handback));
            }//endif
        } catch (IOException e) {
            logger.log(Level.FINE, "WARNING -- failure on handback construction "
                              +"(handback = "+handback+")");
            e.printStackTrace();
View Full Code Here

TOP

Related Classes of java.rmi.MarshalledObject$MarshalledObjectOutputStream

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.