src/java.rmi/share/classes/java/rmi/dgc/DGC.java
author rriggs
Wed, 02 Oct 2019 13:57:03 -0400
changeset 58446 5c83830390ba
parent 47216 71c04702a3d5
permissions -rw-r--r--
8231663: Incorrect GPL header in some RMI/SQL package-info.java files Reviewed-by: bpb, iris, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package java.rmi.dgc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.rmi.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.rmi.server.ObjID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * The DGC abstraction is used for the server side of the distributed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * garbage collection algorithm. This interface contains the two
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * methods: dirty and clean. A dirty call is made when a remote
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * reference is unmarshaled in a client (the client is indicated by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * its VMID). A corresponding clean call is made when no more
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * references to the remote reference exist in the client. A failed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * dirty call must schedule a strong clean call so that the call's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * sequence number can be retained in order to detect future calls
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * received out of order by the distributed garbage collector.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * A reference to a remote object is leased for a period of time by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * the client holding the reference. The lease period starts when the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * dirty call is received. It is the client's responsibility to renew
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * the leases, by making additional dirty calls, on the remote
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * references it holds before such leases expire. If the client does
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * not renew the lease before it expires, the distributed garbage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * collector assumes that the remote object is no longer referenced by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * that client.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * @author Ann Wollrath
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
public interface DGC extends Remote {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * The dirty call requests leases for the remote object references
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * associated with the object identifiers contained in the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * 'ids'. The 'lease' contains a client's unique VM identifier (VMID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * and a requested lease period. For each remote object exported
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * in the local VM, the garbage collector maintains a reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * list-a list of clients that hold references to it. If the lease
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * is granted, the garbage collector adds the client's VMID to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * reference list for each remote object indicated in 'ids'. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * 'sequenceNum' parameter is a sequence number that is used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * detect and discard late calls to the garbage collector. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * sequence number should always increase for each subsequent call
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * to the garbage collector.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Some clients are unable to generate a VMID, since a VMID is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * universally unique identifier that contains a host address
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * which some clients are unable to obtain due to security
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * restrictions. In this case, a client can use a VMID of null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * and the distributed garbage collector will assign a VMID for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * the client.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * The dirty call returns a Lease object that contains the VMID
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * used and the lease period granted for the remote references (a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * server may decide to grant a smaller lease period than the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * client requests). A client must use the VMID the garbage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * collector uses in order to make corresponding clean calls when
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * the client drops remote object references.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * A client VM need only make one initial dirty call for each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * remote reference referenced in the VM (even if it has multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * references to the same remote object). The client must also
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * make a dirty call to renew leases on remote references before
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * such leases expire. When the client no longer has any
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * references to a specific remote object, it must schedule a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * clean call for the object ID associated with the reference.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @param ids IDs of objects to mark as referenced by calling client
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @param sequenceNum sequence number
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @param lease requested lease
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * @return granted lease
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @throws RemoteException if dirty call fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    Lease dirty(ObjID[] ids, long sequenceNum, Lease lease)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        throws RemoteException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * The clean call removes the 'vmid' from the reference list of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * each remote object indicated in 'id's.  The sequence number is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * used to detect late clean calls.  If the argument 'strong' is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * true, then the clean call is a result of a failed dirty call,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * thus the sequence number for the client 'vmid' needs to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * remembered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @param ids IDs of objects to mark as unreferenced by calling client
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @param sequenceNum sequence number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @param vmid client VMID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @param strong make 'strong' clean call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @throws RemoteException if clean call fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    void clean(ObjID[] ids, long sequenceNum, VMID vmid, boolean strong)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        throws RemoteException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
}