Package java.rmi.dgc

Examples of java.rmi.dgc.Lease


    log.entering ("com.sun.grid.jgrid.proxy.ComputeProxy", "processDirtyCall");
   
    //Read arguments
    ObjID[] ids = null;
    long seqNum = -1L;
    Lease lease = null;
   
    log.log (Level.FINEST, "Reading arguments");
    try {
      ids = (ObjID[])objIn.readObject ();
      seqNum = objIn.readLong ();
      lease = (Lease)objIn.readObject ();
     
      if (ids.length > 0) {
        log.log (Level.FINE, "Dirty call for " + ids[0].toString ());
      }
    }
    catch (ClassNotFoundException e) {
      this.processException (out, new RemoteException ("Unable to find class", e));
      log.throwing ("com.sun.grid.jgrid.ComputeEngine", "processDirtyCall", e);
     
      return;
    }
    catch (ClassCastException e) {
      this.processException (out, new RemoteException ("Incorrect argument type", e));
      log.throwing ("com.sun.grid.jgrid.ComputeEngine", "processDirtyCall", e);
     
      return;
    }

    //Write message type
    log.log (Level.FINEST, "Writing return header");
    out.writeByte (TransportConstants.Return);

    MarshalOutputStream objOut = new MarshalOutputStream (out);

    //Write message header
    objOut.writeByte (TransportConstants.NormalReturn);
    uid.write (objOut);

    //If the lease we were passed has a valid VM ID, write it
    if (lease.getVMID () != null) {
      log.log (Level.FINEST, "Writing old lease object");
      objOut.writeObject (lease);
    }
    //If not, create a valid lease and write it
    else {
      log.log (Level.FINEST, "Writing new lease object");
      objOut.writeObject (new Lease (new VMID (), lease.getValue ()));
    }

    objOut.flush ();
   
    log.exiting ("com.sun.grid.jgrid.proxy.ComputeProxy", "processDirtyCall");
View Full Code Here


                ids = (ObjID[]) renewTable.keySet().toArray(
                        new ObjID[renewTable.size()]);
            }

            try {
                Lease lease = dgcStub.dirty(ids, getSeqNumber(),
                        new Lease(vmid, DGCImpl.maxDuration));
                failedDirtyCallsNum = 0;
                failureStartTime = 0;
                latestLeaseDuration = lease.getValue();
                renewTime = System.currentTimeMillis()
                        + latestLeaseDuration / 2;
            } catch (RemoteException re) {
                // dirty call failed
                long curTime = System.currentTimeMillis();
View Full Code Here

                dgcLog.log(Log.BRIEF, " assigning vmid " + vmid +
                           " to client " + clientHost);
            }
        }

        lease = new Lease(vmid, duration);
        // record lease information
        synchronized (leaseTable) {
            LeaseInfo info = leaseTable.get(vmid);
            if (info == null) {
                leaseTable.put(vmid, new LeaseInfo(vmid, duration));
View Full Code Here

                ids = emptyObjIDArray;
            }

            long startTime = System.currentTimeMillis();
            try {
                Lease lease =
                    dgc.dirty(ids, sequenceNum, new Lease(vmid, leaseValue));
                long duration = lease.getValue();

                long newRenewTime = computeRenewTime(startTime, duration);
                long newExpirationTime = startTime + duration;

                synchronized (this) {
View Full Code Here

        }
        long duration = lease.getValue();
        if (duration > maxDuration || duration < 0) {
            duration = maxDuration;
        }
        Lease l = new Lease(vmid, duration);

        synchronized (vmidTable) {
            Set s = (Set) vmidTable.get(vmid);

            if (s == null) {
View Full Code Here

                ids = (ObjID[]) renewTable.keySet().toArray(
                        new ObjID[renewTable.size()]);
            }

            try {
                Lease lease = dgcStub.dirty(ids, getSeqNumber(),
                        new Lease(vmid, DGCImpl.maxDuration));
                failedDirtyCallsNum = 0;
                failureStartTime = 0;
                latestLeaseDuration = lease.getValue();
                renewTime = System.currentTimeMillis()
                        + latestLeaseDuration / 2;
            } catch (RemoteException re) {
                // dirty call failed
                long curTime = System.currentTimeMillis();
View Full Code Here

        }
        long duration = lease.getValue();
        if (duration > maxDuration || duration < 0) {
            duration = maxDuration;
        }
        Lease l = new Lease(vmid, duration);

        synchronized (vmidTable) {
            Set s = (Set) vmidTable.get(vmid);

            if (s == null) {
View Full Code Here

                ids = (ObjID[]) renewTable.keySet().toArray(
                        new ObjID[renewTable.size()]);
            }

            try {
                Lease lease = dgcStub.dirty(ids, getSeqNumber(),
                        new Lease(vmid, DGCImpl.maxDuration));
                failedDirtyCallsNum = 0;
                failureStartTime = 0;
                latestLeaseDuration = lease.getValue();
                renewTime = System.currentTimeMillis()
                        + latestLeaseDuration / 2;
            } catch (RemoteException re) {
                // dirty call failed
                long curTime = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of java.rmi.dgc.Lease

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.