author | rehn |
Fri, 29 Nov 2019 12:09:25 +0100 | |
changeset 59325 | 3636bab5e81e |
parent 58609 | fbfc72ec8e6b |
permissions | -rw-r--r-- |
2 | 1 |
/* |
58609
fbfc72ec8e6b
8232234: Suppress warnings on non-serializable non-transient instance fields in java.rmi
darcy
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.rmi.server; |
|
27 |
||
28 |
import java.io.IOException; |
|
29 |
import java.io.NotSerializableException; |
|
30 |
import java.io.ObjectOutput; |
|
31 |
import java.rmi.*; |
|
32 |
import java.rmi.server.*; |
|
33 |
import java.rmi.activation.ActivationID; |
|
34 |
import sun.rmi.transport.LiveRef; |
|
35 |
||
36 |
/** |
|
37 |
* Server-side ref for a persistent remote impl. |
|
38 |
* |
|
39 |
* @author Ann Wollrath |
|
40 |
*/ |
|
58609
fbfc72ec8e6b
8232234: Suppress warnings on non-serializable non-transient instance fields in java.rmi
darcy
parents:
47216
diff
changeset
|
41 |
@SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor |
2 | 42 |
public class ActivatableServerRef extends UnicastServerRef2 { |
43 |
||
44 |
private static final long serialVersionUID = 2002967993223003793L; |
|
45 |
||
46 |
private ActivationID id; |
|
47 |
||
48 |
/** |
|
49 |
* Construct a Unicast server remote reference to be exported |
|
50 |
* on the specified port. |
|
51 |
*/ |
|
52 |
public ActivatableServerRef(ActivationID id, int port) |
|
53 |
{ |
|
54 |
this(id, port, null, null); |
|
55 |
} |
|
56 |
||
57 |
/** |
|
58 |
* Construct a Unicast server remote reference to be exported |
|
59 |
* on the specified port. |
|
60 |
*/ |
|
61 |
public ActivatableServerRef(ActivationID id, int port, |
|
62 |
RMIClientSocketFactory csf, |
|
63 |
RMIServerSocketFactory ssf) |
|
64 |
{ |
|
65 |
super(new LiveRef(port, csf, ssf)); |
|
66 |
this.id = id; |
|
67 |
} |
|
68 |
||
69 |
/** |
|
70 |
* Returns the class of the ref type to be serialized |
|
71 |
*/ |
|
72 |
public String getRefClass(ObjectOutput out) |
|
73 |
{ |
|
74 |
return "ActivatableServerRef"; |
|
75 |
} |
|
76 |
||
77 |
/** |
|
78 |
* Return the client remote reference for this remoteRef. |
|
79 |
* In the case of a client RemoteRef "this" is the answer. |
|
80 |
* For a server remote reference, a client side one will have to |
|
81 |
* found or created. |
|
82 |
*/ |
|
83 |
protected RemoteRef getClientRef() { |
|
84 |
return new ActivatableRef(id, new UnicastRef2(ref)); |
|
85 |
} |
|
86 |
||
87 |
/** |
|
88 |
* Prevents serialization (because deserializaion is impossible). |
|
89 |
*/ |
|
90 |
public void writeExternal(ObjectOutput out) throws IOException { |
|
91 |
throw new NotSerializableException( |
|
92 |
"ActivatableServerRef not serializable"); |
|
93 |
} |
|
94 |
} |