Produced by Araxis Merge on 9/25/2018 2:13:10 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\java\rmi\server | UnicastRemoteObject.java | Mon Jan 22 14:46:52 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\java\rmi\server | UnicastRemoteObject.java | Wed Sep 12 17:12:01 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 768 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /* | |
2 | * Copyrig ht (c) 199 6, 2013, O racle and/ or its aff iliates. A ll rights reserved. | |
3 | * DO NOT ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER. | |
4 | * | |
5 | * This co de is free software; you can r edistribut e it and/o r modify i t | |
6 | * under t he terms o f the GNU General Pu blic Licen se version 2 only, a s | |
7 | * publish ed by the Free Softw are Founda tion. Ora cle design ates this | |
8 | * particu lar file a s subject to the "Cl asspath" e xception a s provided | |
9 | * by Orac le in the LICENSE fi le that ac companied this code. | |
10 | * | |
11 | * This co de is dist ributed in the hope that it wi ll be usef ul, but WI THOUT | |
12 | * ANY WAR RANTY; wit hout even the implie d warranty of MERCHA NTABILITY or | |
13 | * FITNESS FOR A PAR TICULAR PU RPOSE. Se e the GNU General Pu blic Licen se | |
14 | * version 2 for mor e details (a copy is included in the LIC ENSE file that | |
15 | * accompa nied this code). | |
16 | * | |
17 | * You sho uld have r eceived a copy of th e GNU Gene ral Public License v ersion | |
18 | * 2 along with this work; if not, write to the Fr ee Softwar e Foundati on, | |
19 | * Inc., 5 1 Franklin St, Fifth Floor, Bo ston, MA 0 2110-1301 USA. | |
20 | * | |
21 | * Please contact Or acle, 500 Oracle Par kway, Redw ood Shores , CA 94065 USA | |
22 | * or visi t www.orac le.com if you need a dditional informatio n or have any | |
23 | * questio ns. | |
24 | */ | |
25 | package ja va.rmi.ser ver; | |
26 | ||
27 | import jav a.rmi.*; | |
28 | import sun .rmi.serve r.UnicastS erverRef; | |
29 | import sun .rmi.serve r.UnicastS erverRef2; | |
30 | ||
31 | /** | |
32 | * Used fo r exportin g a remote object wi th JRMP an d obtainin g a stub | |
33 | * that co mmunicates to the re mote objec t. Stubs a re either generated | |
34 | * at runt ime using dynamic pr oxy object s, or they are gener ated stati cally | |
35 | * at buil d time, ty pically us ing the {@ code rmic} tool. | |
36 | * | |
37 | * <p><str ong>Deprec ated: Stat ic Stubs.< /strong> < em>Support for stati cally | |
38 | * generat ed stubs i s deprecat ed. This i ncludes th e API in t his class that | |
39 | * require s the use of static stubs, as well as th e runtime support fo r | |
40 | * loading static st ubs. Gene rating stu bs dynamic ally is pr eferred, u sing one | |
41 | * of the five non-d eprecated ways of ex porting ob jects as l isted belo w. Do | |
42 | * not run {@code rm ic} to gen erate stat ic stub cl asses. It is unneces sary, and | |
43 | * it is a lso deprec ated.</em> | |
44 | * | |
45 | * <p>Ther e are six ways to ex port remot e objects: | |
46 | * | |
47 | * <ol> | |
48 | * | |
49 | * <li>Sub classing { @code Unic astRemoteO bject} and calling t he | |
50 | * {@link #UnicastRe moteObject ()} constr uctor. | |
51 | * | |
52 | * <li>Sub classing { @code Unic astRemoteO bject} and calling t he | |
53 | * {@link #UnicastRe moteObject (int) Unic astRemoteO bject(port )} constru ctor. | |
54 | * | |
55 | * <li>Sub classing { @code Unic astRemoteO bject} and calling t he | |
56 | * {@link #UnicastRe moteObject (int, RMIC lientSocke tFactory, RMIServerS ocketFacto ry) | |
57 | * Unicast RemoteObje ct(port, c sf, ssf)} constructo r. | |
58 | * | |
59 | * <li>Cal ling the | |
60 | * {@link #exportObj ect(Remote ) exportOb ject(Remot e)} method . | |
61 | * <strong >Deprecate d.</strong > | |
62 | * | |
63 | * <li>Cal ling the | |
64 | * {@link #exportObj ect(Remote , int) exp ortObject( Remote, po rt)} metho d. | |
65 | * | |
66 | * <li>Cal ling the | |
67 | * {@link #exportObj ect(Remote , int, RMI ClientSock etFactory, RMIServer SocketFact ory) | |
68 | * exportO bject(Remo te, port, csf, ssf)} method. | |
69 | * | |
70 | * </ol> | |
71 | * | |
72 | * <p>The fourth tec hnique, {@ link #expo rtObject(R emote)}, | |
73 | * always uses stati cally gene rated stub s and is d eprecated. | |
74 | * | |
75 | * <p>The other five technique s all use the follow ing approa ch: if the | |
76 | * {@code java.rmi.s erver.igno reStubClas ses} prope rty is {@c ode true} | |
77 | * (case i nsensitive ) or if a static stu b cannot b e found, s tubs are g enerated | |
78 | * dynamic ally using {@link ja va.lang.re flect.Prox y Proxy} o bjects. Ot herwise, | |
79 | * static stubs are used. | |
80 | * | |
81 | * <p>The default va lue of the | |
82 | * {@code java.rmi.s erver.igno reStubClas ses} prope rty is {@c ode false} . | |
83 | * | |
84 | * <p>Stat ically gen erated stu bs are typ ically pre generated from the | |
85 | * remote object's c lass using the {@cod e rmic} to ol. A stat ic stub is | |
86 | * loaded and an ins tance of t hat stub c lass is co nstructed as describ ed | |
87 | * below. | |
88 | * | |
89 | * <ul> | |
90 | * | |
91 | * <li>A " root class " is deter mined as f ollows: if the remot e object's | |
92 | * class d irectly im plements a n interfac e that ext ends {@lin k Remote}, then | |
93 | * the rem ote object 's class i s the root class; ot herwise, t he root cl ass is | |
94 | * the mos t derived superclass of the re mote objec t's class that direc tly | |
95 | * impleme nts an int erface tha t extends {@code Rem ote}. | |
96 | * | |
97 | * <li>The name of t he stub cl ass to loa d is deter mined by c oncatenati ng | |
98 | * the bin ary name o f the root class wit h the suff ix {@code _Stub}. | |
99 | * | |
100 | * <li>The stub clas s is loade d by name using the class load er of the root | |
101 | * class. The stub c lass must extend {@l ink Remote Stub} and must have a | |
102 | * public constructo r that has one param eter of ty pe {@link RemoteRef} . | |
103 | * | |
104 | * <li>Fin ally, an i nstance of the stub class is c onstructed with a | |
105 | * {@link RemoteRef} . | |
106 | * | |
107 | * <li>If the approp riate stub class cou ld not be found, or if the stu b class | |
108 | * could n ot be load ed, or if a problem occurs cre ating the stub insta nce, a | |
109 | * {@link StubNotFou ndExceptio n} is thro wn. | |
110 | * | |
111 | * </ul> | |
112 | * | |
113 | * <p>Stub s are dyna mically ge nerated by construct ing an ins tance of | |
114 | * a {@lin k java.lan g.reflect. Proxy Prox y} with th e followin g characte ristics: | |
115 | * | |
116 | * <ul> | |
117 | * | |
118 | * <li>The proxy's c lass is de fined by t he class l oader of t he remote | |
119 | * object' s class. | |
120 | * | |
121 | * <li>The proxy imp lements al l the remo te interfa ces implem ented by t he | |
122 | * remote object's c lass. | |
123 | * | |
124 | * <li>The proxy's i nvocation handler is a {@link | |
125 | * RemoteO bjectInvoc ationHandl er} instan ce constru cted with a | |
126 | * {@link RemoteRef} . | |
127 | * | |
128 | * <li>If the proxy could not be created , a {@link StubNotFo undExcepti on} | |
129 | * will be thrown. | |
130 | * | |
131 | * </ul> | |
132 | * | |
133 | * @implNo te | |
134 | * Dependi ng upon wh ich constr uctor or s tatic meth od is used for expor ting an | |
135 | * object, {@link RM ISocketFac tory} may be used fo r creating sockets. | |
136 | * By defa ult, serve r sockets created by {@link RM ISocketFac tory} | |
137 | * listen on all net work inter faces. See the | |
138 | * {@link RMISocketF actory} cl ass and th e section | |
139 | * <a href ="{@docRoo t}/../plat form/rmi/s pec/rmi-se rver29.htm l">RMI Soc ket Factor ies</a> | |
140 | * in the | |
141 | * <a href ="{@docRoo t}/../plat form/rmi/s pec/rmiTOC .html">Jav a RMI Spec ification< /a>. | |
142 | * | |
143 | * @author Ann Woll rath | |
144 | * @author Peter Jo nes | |
145 | * @since JDK1.1 | |
146 | **/ | |
147 | public cla ss Unicast RemoteObje ct extends RemoteSer ver { | |
148 | ||
149 | /** | |
150 | * @se rial port number on which to e xport obje ct | |
151 | */ | |
152 | private in t PORT
|
|
153 | ||
154 | /** | |
155 | * @se rial clien t-side soc ket factor y (if any) | |
156 | */ | |
157 | privat e RMIClien tSocketFac tory csf = null; | |
158 | ||
159 | /** | |
160 | * @se rial serve r-side soc ket factor y (if any) to use wh en | |
161 | * exp orting obj ect | |
162 | */ | |
163 | privat e RMIServe rSocketFac tory ssf = null; | |
164 | ||
165 | /* ind icate comp atibility with JDK 1 .1.x versi on of clas s */ | |
166 | privat e static f inal long serialVers ionUID = 4 9745271489 36298033L; | |
167 | ||
168 | /** | |
169 | * Cre ates and e xports a n ew Unicast RemoteObje ct object using an | |
170 | * ano nymous por t. | |
171 | * | |
172 | * <p> The object is export ed with a server soc ket | |
173 | * cre ated using the {@lin k RMISocke tFactory} class. | |
174 | * | |
175 | * @th rows Remot eException if failed to export object | |
176 | * @si nce JDK1.1 | |
177 | */ | |
178 | protec ted Unicas tRemoteObj ect() thro ws RemoteE xception | |
179 | { | |
180 | th is(0); | |
181 | } | |
182 | ||
183 | /** | |
184 | * Cre ates and e xports a n ew Unicast RemoteObje ct object using the | |
185 | * par ticular su pplied por t. | |
186 | * | |
187 | * <p> The object is export ed with a server soc ket | |
188 | * cre ated using the {@lin k RMISocke tFactory} class. | |
189 | * | |
190 | * @pa ram port t he port nu mber on wh ich the re mote objec t receives calls | |
191 | * (if <code>por t</code> i s zero, an anonymous port is c hosen) | |
192 | * @th rows Remot eException if failed to export object | |
193 | * @si nce 1.2 | |
194 | */ | |
195 | protec ted Unicas tRemoteObj ect(int po rt) throws RemoteExc eption | |
196 | { | |
197 | th is.port = port; | |
198 | ex portObject ((Remote) this, port ); | |
199 | } | |
200 | ||
201 | /** | |
202 | * Cre ates and e xports a n ew Unicast RemoteObje ct object using the | |
203 | * par ticular su pplied por t and sock et factori es. | |
204 | * | |
205 | * <p> Either soc ket factor y may be { @code null }, in whic h case | |
206 | * the correspon ding clien t or serve r socket c reation me thod of | |
207 | * {@l ink RMISoc ketFactory } is used instead. | |
208 | * | |
209 | * @pa ram port t he port nu mber on wh ich the re mote objec t receives calls | |
210 | * (if <code>por t</code> i s zero, an anonymous port is c hosen) | |
211 | * @pa ram csf th e client-s ide socket factory f or making calls to t he | |
212 | * rem ote object | |
213 | * @pa ram ssf th e server-s ide socket factory f or receivi ng remote calls | |
214 | * @th rows Remot eException if failed to export object | |
215 | * @si nce 1.2 | |
216 | */ | |
217 | protec ted Unicas tRemoteObj ect(int po rt, | |
218 | RMICli entSocketF actory csf , | |
219 | RMISer verSocketF actory ssf ) | |
220 | th rows Remot eException | |
221 | { | |
222 | th is.port = port; | |
223 | th is.csf = c sf; | |
224 | th is.ssf = s sf; | |
225 | ex portObject ((Remote) this, port , csf, ssf ); | |
226 | } | |
227 | ||
228 | /** | |
229 | * Re- export the remote ob ject when it is dese rialized. | |
230 | */ | |
231 | privat e void rea dObject(ja va.io.Obje ctInputStr eam in) | |
232 | th rows java. io.IOExcep tion, java .lang.Clas sNotFoundE xception | |
233 | { | |
234 | in .defaultRe adObject() ; | |
235 | re export(); | |
236 | } | |
237 | ||
238 | /** | |
239 | * Ret urns a clo ne of the remote obj ect that i s distinct from | |
240 | * the original. | |
241 | * | |
242 | * @ex ception Cl oneNotSupp ortedExcep tion if cl one failed due to | |
243 | * a R emoteExcep tion. | |
244 | * @re turn the n ew remote object | |
245 | * @si nce JDK1.1 | |
246 | */ | |
247 | public Object cl one() thro ws CloneNo tSupported Exception | |
248 | { | |
249 | tr y { | |
250 | UnicastR emoteObjec t cloned = (UnicastR emoteObjec t) super.c lone(); | |
251 | cloned.r eexport(); | |
252 | return c loned; | |
253 | } catch (Rem oteExcepti on e) { | |
254 | throw ne w ServerCl oneExcepti on("Clone failed", e ); | |
255 | } | |
256 | } | |
257 | ||
258 | /* | |
259 | * Exp orts this UnicastRem oteObject using its initialize d fields b ecause | |
260 | * its creation bypassed r unning its construct ors (via d eserializa tion | |
261 | * or cloning, f or example ). | |
262 | */ | |
263 | privat e void ree xport() th rows Remot eException | |
264 | { | |
265 | if (csf == n ull && ssf == null) { | |
266 | exportOb ject((Remo te) this, port); | |
267 | } else { | |
268 | exportOb ject((Remo te) this, port, csf, ssf); | |
269 | } | |
270 | } | |
271 | ||
272 | /** | |
273 | * Exp orts the r emote obje ct to make it availa ble to rec eive incom ing | |
274 | * cal ls using a n anonymou s port. Th is method will alway s return a | |
275 | * sta tically ge nerated st ub. | |
276 | * | |
277 | * <p> The object is export ed with a server soc ket | |
278 | * cre ated using the {@lin k RMISocke tFactory} class. | |
279 | * | |
280 | * @pa ram obj th e remote o bject to b e exported | |
281 | * @re turn remot e object s tub | |
282 | * @ex ception Re moteExcept ion if exp ort fails | |
283 | * @si nce JDK1.1 | |
284 | * @de precated T his method is deprec ated becau se it supp orts only static stu bs. | |
285 | * Use {@link #e xportObjec t(Remote, int) expor tObject(Re mote, port )} or | |
286 | * {@l ink #expor tObject(Re mote, int, RMIClient SocketFact ory, RMISe rverSocket Factory) | |
287 | * exp ortObject( Remote, po rt, csf, s sf)} | |
288 | * ins tead. | |
289 | */ | |
290 | @Depre cated | |
291 | public static Re moteStub e xportObjec t(Remote o bj) | |
292 | th rows Remot eException | |
293 | { | |
294 | /* | |
295 | * Use Unica stServerRe f construc tor passin g the bool ean value true | |
296 | * to indica te that on ly a gener ated stub class shou ld be used . A | |
297 | * generated stub clas s must be used inste ad of a dy namic prox y | |
298 | * because t he return value of t his method is Remote Stub which a | |
299 | * dynamic p roxy class cannot ex tend. | |
300 | * / | |
301 | re turn (Remo teStub) ex portObject (obj, new UnicastSer verRef(tru e)); | |
302 | } | |
303 | ||
304 | /** | |
305 | * Exp orts the r emote obje ct to make it availa ble to rec eive incom ing | |
306 | * cal ls, using the partic ular suppl ied port. | |
307 | * | |
308 | * <p> The object is export ed with a server soc ket | |
309 | * cre ated using the {@lin k RMISocke tFactory} class. | |
310 | * | |
311 | * @pa ram obj th e remote o bject to b e exported | |
312 | * @pa ram port t he port to export th e object o n | |
313 | * @re turn remot e object s tub | |
314 | * @ex ception Re moteExcept ion if exp ort fails | |
315 | * @si nce 1.2 | |
316 | */ | |
317 | public static Re mote expor tObject(Re mote obj, int port) | |
318 | th rows Remot eException | |
319 | { | |
320 | re turn expor tObject(ob j, new Uni castServer Ref(port)) ; | |
321 | } | |
322 | ||
323 | /** | |
324 | * Exp orts the r emote obje ct to make it availa ble to rec eive incom ing | |
325 | * cal ls, using a transpor t specifie d by the g iven socke t factory. | |
326 | * | |
327 | * <p> Either soc ket factor y may be { @code null }, in whic h case | |
328 | * the correspon ding clien t or serve r socket c reation me thod of | |
329 | * {@l ink RMISoc ketFactory } is used instead. | |
330 | * | |
331 | * @pa ram obj th e remote o bject to b e exported | |
332 | * @pa ram port t he port to export th e object o n | |
333 | * @pa ram csf th e client-s ide socket factory f or making calls to t he | |
334 | * rem ote object | |
335 | * @pa ram ssf th e server-s ide socket factory f or receivi ng remote calls | |
336 | * @re turn remot e object s tub | |
337 | * @ex ception Re moteExcept ion if exp ort fails | |
338 | * @si nce 1.2 | |
339 | */ | |
340 | public static Re mote expor tObject(Re mote obj, int port, | |
341 | RM IClientSoc ketFactory csf, | |
342 | RM IServerSoc ketFactory ssf) | |
343 | th rows Remot eException | |
344 | { | |
345 | ||
346 | re turn expor tObject(ob j, new Uni castServer Ref2(port, csf, ssf) ); | |
347 | } | |
348 | ||
349 | /** | |
350 | * Rem oves the r emote obje ct, obj, f rom the RM I runtime. If | |
351 | * suc cessful, t he object can no lon ger accept incoming RMI calls. | |
352 | * If the force parameter is true, t he object is forcibl y unexport ed | |
353 | * eve n if there are pendi ng calls t o the remo te object or the | |
354 | * rem ote object still has calls in progress. If the fo rce | |
355 | * par ameter is false, the object is only unex ported if there are | |
356 | * no pending or in progre ss calls t o the obje ct. | |
357 | * | |
358 | * @pa ram obj th e remote o bject to b e unexport ed | |
359 | * @pa ram force if true, u nexports t he object even if th ere are | |
360 | * pen ding or in -progress calls; if false, onl y unexport s the obje ct | |
361 | * if there are no pending or in-pro gress call s | |
362 | * @re turn true if operati on is succ essful, fa lse otherw ise | |
363 | * @ex ception No SuchObject Exception if the rem ote object is not | |
364 | * cur rently exp orted | |
365 | * @si nce 1.2 | |
366 | */ | |
367 | public static bo olean unex portObject (Remote ob j, boolean force) | |
368 | th rows java. rmi.NoSuch ObjectExce ption | |
369 | { | |
370 | re turn sun.r mi.transpo rt.ObjectT able.unexp ortObject( obj, force ); | |
371 | } | |
372 | ||
373 | /** | |
374 | * Exp orts the s pecified o bject usin g the spec ified serv er ref. | |
375 | */ | |
376 | privat e static R emote expo rtObject(R emote obj, UnicastSe rverRef sr ef) | |
377 | th rows Remot eException | |
378 | { | |
379 | // if obj ex tends Unic astRemoteO bject, set its ref. | |
380 | if (obj inst anceof Uni castRemote Object) { | |
381 | ((Unicas tRemoteObj ect) obj). ref = sref ; | |
382 | } | |
383 | re turn sref. exportObje ct(obj, nu ll, false) ; | |
384 | } | |
385 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.