src/java.rmi/share/classes/java/rmi/server/RemoteRef.java
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 51437 6221a199ec20
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
51317
e122220d7d7e 8209024: Use SuppressWarnings on serialVersionUID fields in interfaces
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 1996, 2018, 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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.rmi.server;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.rmi.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * <code>RemoteRef</code> represents the handle for a remote object. A
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * <code>RemoteStub</code> uses a remote reference to carry out a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * remote method invocation to a remote object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * @author  Ann Wollrath
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
    36
 * @since   1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @see     java.rmi.server.RemoteStub
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
public interface RemoteRef extends java.io.Externalizable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
51437
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
    41
    /** indicate compatibility with JDK 1.1.x version of class.
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
    42
     *
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
    43
     * @deprecated A {@code serialVersionUID} field in an interface is
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
    44
     * ineffectual. Do not use; no replacement.
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
    45
     */
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
    46
    @Deprecated
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
    47
    @SuppressWarnings("serial")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    static final long serialVersionUID = 3632638527362204081L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * Initialize the server package prefix: assumes that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * implementation of server ref classes (e.g., UnicastRef,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * UnicastServerRef) are located in the package defined by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * prefix.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    final static String packagePrefix = "sun.rmi.server";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * Invoke a method. This form of delegating method invocation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * to the reference allows the reference to take care of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * setting up the connection to the remote host, marshaling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * some representation for the method and parameters, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * communicating the method invocation to the remote host.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * This method either returns the result of a method invocation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * on the remote object which resides on the remote host or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * throws a RemoteException if the call failed or an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * application-level exception if the remote invocation throws
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * an exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @param obj the object that contains the RemoteRef (e.g., the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     *            RemoteStub for the object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * @param method the method to be invoked
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * @param params the parameter list
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @param opnum  a hash that may be used to represent the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @return result of remote method invocation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @exception Exception if any exception occurs during remote method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * invocation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    Object invoke(Remote obj,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                  java.lang.reflect.Method method,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                  Object[] params,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                  long opnum)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        throws Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * Creates an appropriate call object for a new remote method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * invocation on this object.  Passing operation array and index,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * allows the stubs generator to assign the operation indexes and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * interpret them. The remote reference may need the operation to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * encode in the call.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     *
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
    93
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @deprecated 1.2 style stubs no longer use this method. Instead of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * using a sequence of method calls on the stub's the remote reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * (<code>newCall</code>, <code>invoke</code>, and <code>done</code>), a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * stub uses a single method, <code>invoke(Remote, Method, Object[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * int)</code>, on the remote reference to carry out parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * marshalling, remote method executing and unmarshalling of the return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @param obj remote stub through which to make call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * @param op array of stub operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @param opnum operation number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param hash stub/skeleton interface hash
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @return call object representing remote call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @throws RemoteException if failed to initiate new remote call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @see #invoke(Remote,java.lang.reflect.Method,Object[],long)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    @Deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        throws RemoteException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * Executes the remote call.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * Invoke will raise any "user" exceptions which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * should pass through and not be caught by the stub.  If any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * exception is raised during the remote invocation, invoke should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * take care of cleaning up the connection before raising the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * "user" or remote exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
   123
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @deprecated 1.2 style stubs no longer use this method. Instead of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * using a sequence of method calls to the remote reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * (<code>newCall</code>, <code>invoke</code>, and <code>done</code>), a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * stub uses a single method, <code>invoke(Remote, Method, Object[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * int)</code>, on the remote reference to carry out parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * marshalling, remote method executing and unmarshalling of the return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @param call object representing remote call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * @throws Exception if any exception occurs during remote method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @see #invoke(Remote,java.lang.reflect.Method,Object[],long)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    @Deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    void invoke(RemoteCall call) throws Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * Allows the remote reference to clean up (or reuse) the connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * Done should only be called if the invoke returns successfully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * (non-exceptionally) to the stub.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     *
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
   144
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @deprecated 1.2 style stubs no longer use this method. Instead of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * using a sequence of method calls to the remote reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * (<code>newCall</code>, <code>invoke</code>, and <code>done</code>), a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * stub uses a single method, <code>invoke(Remote, Method, Object[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * int)</code>, on the remote reference to carry out parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * marshalling, remote method executing and unmarshalling of the return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * @param call object representing remote call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * @throws RemoteException if remote error occurs during call cleanup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @see #invoke(Remote,java.lang.reflect.Method,Object[],long)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    @Deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    void done(RemoteCall call) throws RemoteException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * Returns the class name of the ref type to be serialized onto
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * the stream 'out'.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * @param out the output stream to which the reference will be serialized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @return the class name (without package qualification) of the reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * type
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
   166
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    String getRefClass(java.io.ObjectOutput out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * Returns a hashcode for a remote object.  Two remote object stubs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * that refer to the same remote object will have the same hash code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * (in order to support remote objects as keys in hash tables).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @return remote object hashcode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * @see             java.util.Hashtable
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
   177
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    int remoteHashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * Compares two remote objects for equality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * Returns a boolean that indicates whether this remote object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * equivalent to the specified Object. This method is used when a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * remote object is stored in a hashtable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @param   obj     the Object to compare with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * @return  true if these Objects are equal; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @see             java.util.Hashtable
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
   189
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    boolean remoteEquals(RemoteRef obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * Returns a String that represents the reference of this remote
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @return string representing remote object reference
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 5506
diff changeset
   197
     * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    String remoteToString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
}