Search in sources :

Example 1 with VMID

use of java.rmi.dgc.VMID in project jdk8u_jdk by JetBrains.

the class CheckVMID method main.

public static void main(String[] args) {
    System.err.println("\nRegression test for bug 4171370\n");
    TestLibrary.suggestSecurityManager(null);
    try {
        System.err.println("Create a VMID");
        VMID vmid = new VMID();
        System.err.println("vmid = " + vmid);
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException("TEST FAILED: " + e.toString());
    }
}
Also used : VMID(java.rmi.dgc.VMID)

Example 2 with VMID

use of java.rmi.dgc.VMID in project jdk8u_jdk by JetBrains.

the class SequenceEntry method unexport.

/**
     * Mark this target as not accepting new calls if any of the
     * following conditions exist: a) the force parameter is true,
     * b) the target's call count is zero, or c) the object is already
     * not accepting calls. Returns true if target is marked as not
     * accepting new calls; returns false otherwise.
     */
synchronized boolean unexport(boolean force) {
    if ((force == true) || (callCount == 0) || (disp == null)) {
        disp = null;
        /*
             * Fix for 4331349: unpin object so that it may be gc'd.
             * Also, unregister all vmids referencing this target
             * so target can be gc'd.
             */
        unpinImpl();
        DGCImpl dgc = DGCImpl.getDGCImpl();
        Enumeration<VMID> enum_ = refSet.elements();
        while (enum_.hasMoreElements()) {
            VMID vmid = enum_.nextElement();
            dgc.unregisterTarget(vmid, this);
        }
        return true;
    } else {
        return false;
    }
}
Also used : VMID(java.rmi.dgc.VMID)

Example 3 with VMID

use of java.rmi.dgc.VMID in project jdk8u_jdk by JetBrains.

the class DGCImpl method dirty.

/**
     * The dirty call adds the VMID "vmid" to the set of clients
     * that hold references to the object associated with the ObjID
     * id.  The long "sequenceNum" is used to detect late dirty calls.  If
     * the VMID "vmid" is null, a VMID will be generated on the
     * server (for use by the client in subsequent calls) and
     * returned.
     *
     * The client must call the "dirty" method to renew the lease
     * before the "lease" time expires or all references to remote
     * objects in this VM that the client holds are considered
     * "unreferenced".
     */
public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease) {
    VMID vmid = lease.getVMID();
    /*
         * The server specifies the lease value; the client has
         * no say in the matter.
         */
    long duration = leaseValue;
    if (dgcLog.isLoggable(Log.VERBOSE)) {
        dgcLog.log(Log.VERBOSE, "vmid = " + vmid);
    }
    // create a VMID if one wasn't supplied
    if (vmid == null) {
        vmid = new VMID();
        if (dgcLog.isLoggable(Log.BRIEF)) {
            String clientHost;
            try {
                clientHost = RemoteServer.getClientHost();
            } catch (ServerNotActiveException e) {
                clientHost = "<unknown host>";
            }
            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));
            if (checker == null) {
                checker = scheduler.scheduleWithFixedDelay(new Runnable() {

                    public void run() {
                        checkLeases();
                    }
                }, leaseCheckInterval, leaseCheckInterval, TimeUnit.MILLISECONDS);
            }
        } else {
            info.renew(duration);
        }
    }
    for (ObjID id : ids) {
        if (dgcLog.isLoggable(Log.VERBOSE)) {
            dgcLog.log(Log.VERBOSE, "id = " + id + ", vmid = " + vmid + ", duration = " + duration);
        }
        ObjectTable.referenced(id, sequenceNum, vmid);
    }
    // return the VMID used
    return lease;
}
Also used : ServerNotActiveException(java.rmi.server.ServerNotActiveException) Lease(java.rmi.dgc.Lease) ObjID(java.rmi.server.ObjID) VMID(java.rmi.dgc.VMID)

Aggregations

VMID (java.rmi.dgc.VMID)3 Lease (java.rmi.dgc.Lease)1 ObjID (java.rmi.server.ObjID)1 ServerNotActiveException (java.rmi.server.ServerNotActiveException)1