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\activation | Activatable.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\activation | Activatable.java | Wed Sep 12 17:11:43 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 7 | 1146 |
Changed | 6 | 12 |
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 7, 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 | ||
26 | package ja va.rmi.act ivation; | |
27 | ||
28 | import jav a.rmi.Mars halledObje ct; | |
29 | import jav a.rmi.NoSu chObjectEx ception; | |
30 | import jav a.rmi.Remo te; | |
31 | import jav a.rmi.Remo teExceptio n; | |
32 | import jav a.rmi.acti vation.Unk nownGroupE xception; | |
33 | import jav a.rmi.acti vation.Unk nownObject Exception; | |
34 | import jav a.rmi.serv er.RMIClie ntSocketFa ctory; | |
35 | import jav a.rmi.serv er.RMIServ erSocketFa ctory; | |
36 | import jav a.rmi.serv er.RemoteS erver; | |
37 | import sun .rmi.serve r.Activata bleServerR ef; | |
38 | ||
39 | /** | |
40 | * The <co de>Activat able</code > class pr ovides sup port for r emote | |
41 | * objects that requ ire persis tent acces s over tim e and that | |
42 | * can be activated by the sys tem. | |
43 | * | |
44 | * <p>For the constr uctors and static <c ode>export Object</co de> method s, | |
45 | * the stu b for a re mote objec t being ex ported is obtained a s describe d in | |
46 | * {@link java.rmi.s erver.Unic astRemoteO bject}. | |
47 | * | |
48 | * <p>An a ttempt to serialize explicitly an instan ce of this class wil l | |
49 | * fail. | |
50 | * | |
51 | * @author Ann Wollrath | |
52 | * @since 1.2 | |
53 | * @serial excl ude | |
54 | */ | |
55 | public abs tract clas s Activata ble extend s RemoteSe rver { | |
56 | ||
57 | privat e Activati onID id; | |
58 | /** in dicate com patibility with the Java 2 SDK v1.2 vers ion of cla ss */ | |
59 | privat e static f inal long serialVers ionUID = - 3120617863 591563455L ; | |
60 | ||
61 | /** | |
62 | * Con structs an activatab le remote object by registerin g | |
63 | * an activation descripto r (with th e specifie d location , data, an d | |
64 | * res tart mode) for this object, an d exportin g the obje ct with th e | |
65 | * spe cified por t. | |
66 | * | |
67 | * <p> <strong>No te:</stron g> Using t he <code>A ctivatable </code> | |
68 | * con structors that both register a nd export an activat able remot e | |
69 | * obj ect is str ongly disc ouraged be cause the actions of registeri ng | |
70 | * and exporting the remot e object a re <i>not< /i> guaran teed to be | |
71 | * ato mic. Inst ead, an ap plication should reg ister an a ctivation | |
72 | * des criptor an d export a remote ob ject separ ately, so that excep tions | |
73 | * can be handle d properly . | |
74 | * | |
75 | * <p> This metho d invokes the {@link | |
76 | * #ex portObject (Remote,St ring,Marsh alledObjec t,boolean, int) | |
77 | * exp ortObject} method wi th this ob ject, and the specif ied locati on, | |
78 | * dat a, restart mode, and port. Su bsequent c alls to {@ link #getI D} | |
79 | * wil l return t he activat ion identi fier retur ned from t he call to | |
80 | * <co de>exportO bject</cod e>. | |
81 | * | |
82 | * @pa ram locati on the loc ation for classes fo r this obj ect | |
83 | * @pa ram data t he object' s initiali zation dat a | |
84 | * @pa ram port t he port on which the object is exported (an anonym ous | |
85 | * port is used if PORT ) | |
86 | * @pa ram restar t if true, the objec t is resta rted (reac tivated) w hen | |
87 | * eit her the ac tivator is restarted or the ob ject's act ivation gr oup | |
88 | * is restarted after an u nexpected crash; if false, the object is only | |
89 | * act ivated on demand. S pecifying <code>rest art</code> to be | |
90 | * <co de>true</c ode> does not force an initial immediate activatio n of | |
91 | * a n ewly regis tered obje ct; initi al activat ion is laz y. | |
92 | * @ex ception Ac tivationEx ception if object re gistration fails. | |
93 | * @ex ception Re moteExcept ion if eit her of the following fails: | |
94 | * a) registerin g the obje ct with th e activati on system or b) expo rting | |
95 | * the object to the RMI r untime. | |
96 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
97 | * not supported by this i mplementat ion. | |
98 | * @si nce 1.2 | |
99 | **/ | |
100 | protec ted Activa table(Stri ng locatio n, | |
101 | Mars halledObje ct<?> data , | |
102 | bool ean restar t, | |
103 | int port) | |
104 | th rows Activ ationExcep tion, Remo teExceptio n | |
105 | { | |
106 | su per(); | |
107 | id = exportO bject(this , location , data, re start, por t); | |
108 | } | |
109 | ||
110 | /** | |
111 | * Con structs an activatab le remote object by registerin g | |
112 | * an activation descripto r (with th e specifie d location , data, an d | |
113 | * res tart mode) for this object, an d exportin g the obje ct with th e | |
114 | * spe cified por t, and spe cified cli ent and se rver socke t factorie s. | |
115 | * | |
116 | * <p> <strong>No te:</stron g> Using t he <code>A ctivatable </code> | |
117 | * con structors that both register a nd export an activat able remot e | |
118 | * obj ect is str ongly disc ouraged be cause the actions of registeri ng | |
119 | * and exporting the remot e object a re <i>not< /i> guaran teed to be | |
120 | * ato mic. Inst ead, an ap plication should reg ister an a ctivation | |
121 | * des criptor an d export a remote ob ject separ ately, so that excep tions | |
122 | * can be handle d properly . | |
123 | * | |
124 | * <p> This metho d invokes the {@link | |
125 | * #ex portObject (Remote,St ring,Marsh alledObjec t,boolean, int,RMICli entSocketF actory,RMI ServerSock etFactory) | |
126 | * exp ortObject} method wi th this ob ject, and the specif ied locati on, | |
127 | * dat a, restart mode, por t, and cli ent and se rver socke t factorie s. | |
128 | * Sub sequent ca lls to {@l ink #getID } will ret urn the ac tivation | |
129 | * ide ntifier re turned fro m the call to <code> exportObje ct</code>. | |
130 | * | |
131 | * @pa ram locati on the loc ation for classes fo r this obj ect | |
132 | * @pa ram data t he object' s initiali zation dat a | |
133 | * @pa ram restar t if true, the objec t is resta rted (reac tivated) w hen | |
134 | * eit her the ac tivator is restarted or the ob ject's act ivation gr oup | |
135 | * is restarted after an u nexpected crash; if false, the object is only | |
136 | * act ivated on demand. S pecifying <code>rest art</code> to be | |
137 | * <co de>true</c ode> does not force an initial immediate activatio n of | |
138 | * a n ewly regis tered obje ct; initi al activat ion is laz y. | |
139 | * @pa ram port t he port on which the object is exported (an anonym ous | |
140 | * port is used if PORT ) | |
141 | * @pa ram csf th e client-s ide socket factory f or making calls to t he | |
142 | * rem ote object | |
143 | * @pa ram ssf th e server-s ide socket factory f or receivi ng remote calls | |
144 | * @ex ception Ac tivationEx ception if object re gistration fails. | |
145 | * @ex ception Re moteExcept ion if eit her of the following fails: | |
146 | * a) registerin g the obje ct with th e activati on system or b) expo rting | |
147 | * the object to the RMI r untime. | |
148 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
149 | * not supported by this i mplementat ion. | |
150 | * @si nce 1.2 | |
151 | **/ | |
152 | protec ted Activa table(Stri ng locatio n, | |
153 | Mars halledObje ct<?> data , | |
154 | bool ean restar t, | |
155 | int port, | |
156 | RMIC lientSocke tFactory c sf, | |
157 | RMIS erverSocke tFactory s sf) | |
158 | th rows Activ ationExcep tion, Remo teExceptio n | |
159 | { | |
160 | su per(); | |
161 | id = exportO bject(this , location , data, re start, por t, csf, ss f); | |
162 | } | |
163 | ||
164 | /** | |
165 | * Con structor u sed to act ivate/expo rt the obj ect on a s pecified | |
166 | * por t. An "act ivatable" remote obj ect must h ave a cons tructor th at | |
167 | * tak es two arg uments: <u l> | |
168 | * <li >the objec t's activa tion ident ifier (<co de>Activat ionID</cod e>), and | |
169 | * <li >the objec t's initia lization d ata (a <co de>Marshal ledObject< /code>). | |
170 | * </u l><p> | |
171 | * | |
172 | * A c oncrete su bclass of this class must call this cons tructor wh en it is | |
173 | * <i> activated< /i> via th e two para meter cons tructor de scribed ab ove. As | |
174 | * a s ide-effect of constr uction, th e remote o bject is " exported" | |
175 | * to the RMI ru ntime (on the specif ied <code> port</code >) and is | |
176 | * ava ilable to accept inc oming call s from cli ents. | |
177 | * | |
178 | * @pa ram id act ivation id entifier f or the obj ect | |
179 | * @pa ram port t he port nu mber on wh ich the ob ject is ex ported | |
180 | * @ex ception Re moteExcept ion if exp orting the object to the RMI | |
181 | * run time fails | |
182 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
183 | * not supported by this i mplementat ion | |
184 | * @si nce 1.2 | |
185 | */ | |
186 | protec ted Activa table(Acti vationID i d, int por t) | |
187 | th rows Remot eException | |
188 | { | |
189 | su per(); | |
190 | th is.id = id ; | |
191 | ex portObject (this, id, port); | |
192 | } | |
193 | ||
194 | /** | |
195 | * Con structor u sed to act ivate/expo rt the obj ect on a s pecified | |
196 | * por t. An "act ivatable" remote obj ect must h ave a cons tructor th at | |
197 | * tak es two arg uments: <u l> | |
198 | * <li >the objec t's activa tion ident ifier (<co de>Activat ionID</cod e>), and | |
199 | * <li >the objec t's initia lization d ata (a <co de>Marshal ledObject< /code>). | |
200 | * </u l><p> | |
201 | * | |
202 | * A c oncrete su bclass of this class must call this cons tructor wh en it is | |
203 | * <i> activated< /i> via th e two para meter cons tructor de scribed ab ove. As | |
204 | * a s ide-effect of constr uction, th e remote o bject is " exported" | |
205 | * to the RMI ru ntime (on the specif ied <code> port</code >) and is | |
206 | * ava ilable to accept inc oming call s from cli ents. | |
207 | * | |
208 | * @pa ram id act ivation id entifier f or the obj ect | |
209 | * @pa ram port t he port nu mber on wh ich the ob ject is ex ported | |
210 | * @pa ram csf th e client-s ide socket factory f or making calls to t he | |
211 | * rem ote object | |
212 | * @pa ram ssf th e server-s ide socket factory f or receivi ng remote calls | |
213 | * @ex ception Re moteExcept ion if exp orting the object to the RMI | |
214 | * run time fails | |
215 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
216 | * not supported by this i mplementat ion | |
217 | * @si nce 1.2 | |
218 | */ | |
219 | protec ted Activa table(Acti vationID i d, int por t, | |
220 | RMIC lientSocke tFactory c sf, | |
221 | RMIS erverSocke tFactory s sf) | |
222 | th rows Remot eException | |
223 | { | |
224 | su per(); | |
225 | th is.id = id ; | |
226 | ex portObject (this, id, port, csf , ssf); | |
227 | } | |
228 | ||
229 | /** | |
230 | * Ret urns the o bject's ac tivation i dentifier. The meth od is | |
231 | * pro tected so that only subclasses can obtai n an objec t's | |
232 | * ide ntifier. | |
233 | * @re turn the o bject's ac tivation i dentifier | |
234 | * @si nce 1.2 | |
235 | */ | |
236 | protec ted Activa tionID get ID() { | |
237 | re turn id; | |
238 | } | |
239 | ||
240 | /** | |
241 | * Reg ister an o bject desc riptor for an activa table remo te | |
242 | * obj ect so tha t is can b e activate d on deman d. | |
243 | * | |
244 | * @pa ram desc the object 's descrip tor | |
245 | * @re turn the s tub for th e activata ble remote object | |
246 | * @ex ception Un knownGroup Exception if group i d in <code >desc</cod e> | |
247 | * is not regist ered with the activa tion syste m | |
248 | * @ex ception Ac tivationEx ception if activatio n system i s not runn ing | |
249 | * @ex ception Re moteExcept ion if rem ote call f ails | |
250 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
251 | * not supported by this i mplementat ion | |
252 | * @si nce 1.2 | |
253 | */ | |
254 | public static Re mote regis ter(Activa tionDesc d esc) | |
255 | th rows Unkno wnGroupExc eption, Ac tivationEx ception, R emoteExcep tion | |
256 | { | |
257 | // register object wit h activato r. | |
258 | Ac tivationID id = | |
259 | Activati onGroup.ge tSystem(). registerOb ject(desc) ; | |
260 | re turn sun.r mi.server. Activatabl eRef.getSt ub(desc, i d); | |
261 | } | |
262 | ||
263 | /** | |
264 | * Inf orms the s ystem that the objec t with the correspon ding activ ation | |
265 | * <co de>id</cod e> is curr ently inac tive. If t he object is current ly | |
266 | * act ive, the o bject is " unexported " from the RMI runti me (only i f | |
267 | * the re are no pending or in-progre ss calls) | |
268 | * so the that i t can no l onger rece ive incomi ng calls. This call | |
269 | * inf orms this VM's Activ ationGroup that the object is inactive, | |
270 | * tha t, in turn , informs its Activa tionMonito r. If this call | |
271 | * com pletes suc cessfully, a subsequ ent activa te request to the ac tivator | |
272 | * wil l cause th e object t o reactiva te. The op eration ma y still | |
273 | * suc ceed if th e object i s consider ed active but has al ready | |
274 | * une xported it self. | |
275 | * | |
276 | * @pa ram id the object's activation identifie r | |
277 | * @re turn true if the ope ration suc ceeds (the operation will | |
278 | * suc ceed if th e object i n currentl y known to be active and is | |
279 | * eit her alread y unexport ed or is c urrently e xported an d has no | |
280 | * pen ding/execu ting calls ); false i s returned if the ob ject has | |
281 | * pen ding/execu ting calls in which case it ca nnot be de activated | |
282 | * @ex ception Un knownObjec tException if object is not kn own (it ma y | |
283 | * alr eady be in active) | |
284 | * @ex ception Ac tivationEx ception if group is not active | |
285 | * @ex ception Re moteExcept ion if cal l informin g monitor fails | |
286 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
287 | * not supported by this i mplementat ion | |
288 | * @si nce 1.2 | |
289 | */ | |
290 | public static bo olean inac tive(Activ ationID id ) | |
291 | th rows Unkno wnObjectEx ception, A ctivationE xception, RemoteExce ption | |
292 | { | |
293 | re turn Activ ationGroup .currentGr oup().inac tiveObject (id); | |
294 | } | |
295 | ||
296 | /** | |
297 | * Rev okes previ ous regist ration for the activ ation desc riptor | |
298 | * ass ociated wi th <code>i d</code>. An object can no lon ger be | |
299 | * act ivated via that <cod e>id</code >. | |
300 | * | |
301 | * @pa ram id the object's activation identifie r | |
302 | * @ex ception Un knownObjec tException if object (<code>id </code>) i s unknown | |
303 | * @ex ception Ac tivationEx ception if activatio n system i s not runn ing | |
304 | * @ex ception Re moteExcept ion if rem ote call t o activati on system fails | |
305 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
306 | * not supported by this i mplementat ion | |
307 | * @si nce 1.2 | |
308 | */ | |
309 | public static vo id unregis ter(Activa tionID id) | |
310 | th rows Unkno wnObjectEx ception, A ctivationE xception, RemoteExce ption | |
311 | { | |
312 | Ac tivationGr oup.getSys tem().unre gisterObje ct(id); | |
313 | } | |
314 | ||
315 | /** | |
316 | * Reg isters an activation descripto r (with th e specifie d location , | |
317 | * dat a, and res tart mode) for the s pecified o bject, and exports t hat | |
318 | * obj ect with t he specifi ed port. | |
319 | * | |
320 | * <p> <strong>No te:</stron g> Using t his method (as well as the | |
321 | * <co de>Activat able</code > construc tors that both regis ter and ex port | |
322 | * an activatabl e remote o bject) is strongly d iscouraged because t he | |
323 | * act ions of re gistering and export ing the re mote objec t are | |
324 | * <i> not</i> gu aranteed t o be atomi c. Instea d, an appl ication sh ould | |
325 | * reg ister an a ctivation descriptor and expor t a remote object | |
326 | * sep arately, s o that exc eptions ca n be handl ed properl y. | |
327 | * | |
328 | * <p> This metho d invokes the {@link | |
329 | * #ex portObject (Remote,St ring,Marsh alledObjec t,boolean, int,RMICli entSocketF actory,RMI ServerSock etFactory) | |
330 | * exp ortObject} method wi th the spe cified obj ect, locat ion, data, | |
331 | * res tart mode, and port, and <code >null</cod e> for bot h client a nd | |
332 | * ser ver socket factories , and then returns t he resulti ng activat ion | |
333 | * ide ntifier. | |
334 | * | |
335 | * @pa ram obj th e object b eing expor ted | |
336 | * @pa ram locati on the obj ect's code location | |
337 | * @pa ram data t he object' s bootstra pping data | |
338 | * @pa ram restar t if true, the objec t is resta rted (reac tivated) w hen | |
339 | * eit her the ac tivator is restarted or the ob ject's act ivation gr oup | |
340 | * is restarted after an u nexpected crash; if false, the object is only | |
341 | * act ivated on demand. S pecifying <code>rest art</code> to be | |
342 | * <co de>true</c ode> does not force an initial immediate activatio n of | |
343 | * a n ewly regis tered obje ct; initi al activat ion is laz y. | |
344 | * @pa ram port t he port on which the object is exported (an anonym ous | |
345 | * port is used if PORT ) | |
346 | * @re turn the a ctivation identifier obtained from regis tering the | |
347 | * des criptor, < code>desc< /code>, wi th the act ivation sy stem | |
348 | * the wrong gro up | |
349 | * @ex ception Ac tivationEx ception if activatio n group is not activ e | |
350 | * @ex ception Re moteExcept ion if obj ect regist ration or export fai ls | |
351 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
352 | * not supported by this i mplementat ion | |
353 | * @si nce 1.2 | |
354 | **/ | |
355 | public static Ac tivationID exportObj ect(Remote obj, | |
356 | String location, | |
357 | Marsha lledObject <?> data, | |
358 | boolea n restart, | |
359 | int po rt) | |
360 | th rows Activ ationExcep tion, Remo teExceptio n | |
361 | { | |
362 | re turn expor tObject(ob j, locatio n, data, r estart, po rt, null, null); | |
363 | } | |
364 | ||
365 | /** | |
366 | * Reg isters an activation descripto r (with th e specifie d location , | |
367 | * dat a, and res tart mode) for the s pecified o bject, and exports t hat | |
368 | * obj ect with t he specifi ed port, a nd the spe cified cli ent and se rver | |
369 | * soc ket factor ies. | |
370 | * | |
371 | * <p> <strong>No te:</stron g> Using t his method (as well as the | |
372 | * <co de>Activat able</code > construc tors that both regis ter and ex port | |
373 | * an activatabl e remote o bject) is strongly d iscouraged because t he | |
374 | * act ions of re gistering and export ing the re mote objec t are | |
375 | * <i> not</i> gu aranteed t o be atomi c. Instea d, an appl ication sh ould | |
376 | * reg ister an a ctivation descriptor and expor t a remote object | |
377 | * sep arately, s o that exc eptions ca n be handl ed properl y. | |
378 | * | |
379 | * <p> This metho d first re gisters an activatio n descript or for the | |
380 | * spe cified obj ect as fol lows. It o btains the activatio n system b y | |
381 | * inv oking the method {@l ink Activa tionGroup# getSystem | |
382 | * Act ivationGro up.getSyst em}. This method th en obtains an {@link | |
383 | * Act ivationID} for the o bject by i nvoking th e activati on system' s | |
384 | * {@l ink Activa tionSystem #registerO bject regi sterObject } method w ith | |
385 | * an {@link Act ivationDes c} constru cted with the specif ied object 's | |
386 | * cla ss name, a nd the spe cified loc ation, dat a, and res tart mode. If | |
387 | * an exception occurs obt aining the activatio n system o r register ing | |
388 | * the activatio n descript or, that e xception i s thrown t o the call er. | |
389 | * | |
390 | * <p> Next, this method ex ports the object by invoking t he {@link | |
391 | * #ex portObject (Remote,Ac tivationID ,int,RMICl ientSocket Factory,RM IServerSoc ketFactory ) | |
392 | * exp ortObject} method wi th the spe cified rem ote object , the | |
393 | * act ivation id entifier o btained fr om registr ation, the specified | |
394 | * por t, and the specified client an d server s ocket fact ories. If an | |
395 | * exc eption occ urs export ing the ob ject, this method at tempts to | |
396 | * unr egister th e activati on identif ier (obtai ned from r egistratio n) by | |
397 | * inv oking the activation system's {@link | |
398 | * Act ivationSys tem#unregi sterObject unregiste rObject} m ethod with the | |
399 | * act ivation id entifier. If an exc eption occ urs unregi stering th e | |
400 | * ide ntifier, t hat except ion is ign ored, and the origin al excepti on | |
401 | * tha t occurred exporting the objec t is throw n to the c aller. | |
402 | * | |
403 | * <p> Finally, t his method invokes t he {@link | |
404 | * Act ivationGro up#activeO bject acti veObject} method on the activa tion | |
405 | * gro up in this VM with t he activat ion identi fier and t he specifi ed | |
406 | * rem ote object , and retu rns the ac tivation i dentifier to the cal ler. | |
407 | * | |
408 | * @pa ram obj th e object b eing expor ted | |
409 | * @pa ram locati on the obj ect's code location | |
410 | * @pa ram data t he object' s bootstra pping data | |
411 | * @pa ram restar t if true, the objec t is resta rted (reac tivated) w hen | |
412 | * eit her the ac tivator is restarted or the ob ject's act ivation gr oup | |
413 | * is restarted after an u nexpected crash; if false, the object is only | |
414 | * act ivated on demand. S pecifying <code>rest art</code> to be | |
415 | * <co de>true</c ode> does not force an initial immediate activatio n of | |
416 | * a n ewly regis tered obje ct; initi al activat ion is laz y. | |
417 | * @pa ram port t he port on which the object is exported (an anonym ous | |
418 | * port is used if PORT ) | |
419 | * @pa ram csf th e client-s ide socket factory f or making calls to t he | |
420 | * rem ote object | |
421 | * @pa ram ssf th e server-s ide socket factory f or receivi ng remote calls | |
422 | * @re turn the a ctivation identifier obtained from regis tering the | |
423 | * des criptor wi th the act ivation sy stem | |
424 | * @ex ception Ac tivationEx ception if activatio n group is not activ e | |
425 | * @ex ception Re moteExcept ion if obj ect regist ration or export fai ls | |
426 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
427 | * not supported by this i mplementat ion | |
428 | * @si nce 1.2 | |
429 | **/ | |
430 | public static Ac tivationID exportObj ect(Remote obj, | |
431 | String location, | |
432 | Marsha lledObject <?> data, | |
433 | boolea n restart, | |
434 | int po rt, | |
435 | RMICli entSocketF actory csf , | |
436 | RMISer verSocketF actory ssf ) | |
437 | th rows Activ ationExcep tion, Remo teExceptio n | |
438 | { | |
439 | Ac tivationDe sc desc = new Activa tionDesc(o bj.getClas s().getNam e(), | |
440 | l ocation, d ata, resta rt); | |
441 | /* | |
442 | * Register descriptor . | |
443 | * / | |
444 | Ac tivationSy stem syste m = Activ ationGroup .getSystem (); | |
445 | Ac tivationID id = syst em.registe rObject(de sc); | |
446 | ||
447 | /* | |
448 | * Export ob ject. | |
449 | * / | |
450 | tr y { | |
451 | exportOb ject(obj, id, port, csf, ssf); | |
452 | } catch (Rem oteExcepti on e) { | |
453 | /* | |
454 | * Attem pt to unre gister act ivation de scriptor b ecause exp ort | |
455 | * faile d and regi ster/expor t should b e atomic ( see 432362 1). | |
456 | */ | |
457 | try { | |
458 | syst em.unregis terObject( id); | |
459 | } catch (Exception ex) { | |
460 | } | |
461 | /* | |
462 | * Repor t original exception . | |
463 | */ | |
464 | throw e; | |
465 | } | |
466 | ||
467 | /* | |
468 | * This call can't fai l (it is a local cal l, and the only poss ible | |
469 | * exception , thrown i f the grou p is inact ive, will not be thr own | |
470 | * because t he group i s not inac tive). | |
471 | * / | |
472 | Ac tivationGr oup.curren tGroup().a ctiveObjec t(id, obj) ; | |
473 | ||
474 | re turn id; | |
475 | } | |
476 | ||
477 | /** | |
478 | * Exp ort the ac tivatable remote obj ect to the RMI runti me to make | |
479 | * the object av ailable to receive i ncoming ca lls. The o bject is | |
480 | * exp orted on a n anonymou s port, if <code>por t</code> i s zero. <p > | |
481 | * | |
482 | * Dur ing activa tion, this <code>exp ortObject< /code> met hod should | |
483 | * be invoked ex plicitly b y an "acti vatable" o bject, tha t does not | |
484 | * ext end the <c ode>Activa table</cod e> class. There is n o need for objects | |
485 | * tha t do exten d the <cod e>Activata ble</code> class to invoke thi s | |
486 | * met hod direct ly because the objec t is expor ted during construct ion. | |
487 | * | |
488 | * @re turn the s tub for th e activata ble remote object | |
489 | * @pa ram obj th e remote o bject impl ementation | |
490 | * @pa ram id the object's activatio n identifi er | |
491 | * @pa ram port t he port on which the object is exported (an anonym ous | |
492 | * port is used if PORT ) | |
493 | * @ex ception Re moteExcept ion if obj ect export fails | |
494 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
495 | * not supported by this i mplementat ion | |
496 | * @si nce 1.2 | |
497 | */ | |
498 | public static Re mote expor tObject(Re mote obj, | |
499 | Ac tivationID id, | |
500 | in t port) | |
501 | th rows Remot eException | |
502 | { | |
503 | re turn expor tObject(ob j, new Act ivatableSe rverRef(id , port)); | |
504 | } | |
505 | ||
506 | /** | |
507 | * Exp ort the ac tivatable remote obj ect to the RMI runti me to make | |
508 | * the object av ailable to receive i ncoming ca lls. The o bject is | |
509 | * exp orted on a n anonymou s port, if <code>por t</code> i s zero. <p > | |
510 | * | |
511 | * Dur ing activa tion, this <code>exp ortObject< /code> met hod should | |
512 | * be invoked ex plicitly b y an "acti vatable" o bject, tha t does not | |
513 | * ext end the <c ode>Activa table</cod e> class. There is n o need for objects | |
514 | * tha t do exten d the <cod e>Activata ble</code> class to invoke thi s | |
515 | * met hod direct ly because the objec t is expor ted during construct ion. | |
516 | * | |
517 | * @re turn the s tub for th e activata ble remote object | |
518 | * @pa ram obj th e remote o bject impl ementation | |
519 | * @pa ram id the object's activatio n identifi er | |
520 | * @pa ram port t he port on which the object is exported (an anonym ous | |
521 | * port is used if PORT ) | |
522 | * @pa ram csf th e client-s ide socket factory f or making calls to t he | |
523 | * rem ote object | |
524 | * @pa ram ssf th e server-s ide socket factory f or receivi ng remote calls | |
525 | * @ex ception Re moteExcept ion if obj ect export fails | |
526 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
527 | * not supported by this i mplementat ion | |
528 | * @si nce 1.2 | |
529 | */ | |
530 | public static Re mote expor tObject(Re mote obj, | |
531 | Ac tivationID id, | |
532 | in t port, | |
533 | RM IClientSoc ketFactory csf, | |
534 | RM IServerSoc ketFactory ssf) | |
535 | th rows Remot eException | |
536 | { | |
537 | re turn expor tObject(ob j, new Act ivatableSe rverRef(id , port, cs f, ssf)); | |
538 | } | |
539 | ||
540 | /** | |
541 | * Rem ove the re mote objec t, obj, fr om the RMI runtime. If | |
542 | * suc cessful, t he object can no lon ger accept incoming RMI calls. | |
543 | * If the force parameter is true, t he object is forcibl y unexport ed | |
544 | * eve n if there are pendi ng calls t o the remo te object or the | |
545 | * rem ote object still has calls in progress. If the fo rce | |
546 | * par ameter is false, the object is only unex ported if there are | |
547 | * no pending or in progre ss calls t o the obje ct. | |
548 | * | |
549 | * @pa ram obj th e remote o bject to b e unexport ed | |
550 | * @pa ram force if true, u nexports t he object even if th ere are | |
551 | * pen ding or in -progress calls; if false, onl y unexport s the obje ct | |
552 | * if there are no pending or in-pro gress call s | |
553 | * @re turn true if operati on is succ essful, fa lse otherw ise | |
554 | * @ex ception No SuchObject Exception if the rem ote object is not | |
555 | * cur rently exp orted | |
556 | * @ex ception Un supportedO perationEx ception if and only if activat ion is | |
557 | * not supported by this i mplementat ion | |
558 | * @si nce 1.2 | |
559 | */ | |
560 | public static bo olean unex portObject (Remote ob j, boolean force) | |
561 | th rows NoSuc hObjectExc eption | |
562 | { | |
563 | re turn sun.r mi.transpo rt.ObjectT able.unexp ortObject( obj, force ); | |
564 | } | |
565 | ||
566 | /** | |
567 | * Exp orts the s pecified o bject usin g the spec ified serv er ref. | |
568 | */ | |
569 | privat e static R emote expo rtObject(R emote obj, Activatab leServerRe f sref) | |
570 | th rows Remot eException | |
571 | { | |
572 | // if obj ex tends Acti vatable, s et its ref . | |
573 | if (obj inst anceof Act ivatable) { | |
574 | ((Activa table) obj ).ref = sr ef; | |
575 | ||
576 | } | |
577 | re turn sref. exportObje ct(obj, nu ll, false) ; | |
578 | } | |
579 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.