Produced by Araxis Merge on 9/25/2018 2:13:01 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\com\sun\corba\se\impl\transport | SocketOrChannelAcceptorImpl.java | Mon Jan 22 14:46:40 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\corba\se\impl\transport | SocketOrChannelAcceptorImpl.java | Wed Sep 12 16:20:21 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 1326 |
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) 200 1, 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 co m.sun.corb a.se.impl. transport; | |
27 | ||
28 | import jav a.io.IOExc eption; | |
29 | import jav a.net.Inet SocketAddr ess; | |
30 | import jav a.net.Serv erSocket; | |
31 | import jav a.net.Sock et; | |
32 | import jav a.nio.chan nels.Selec tableChann el; | |
33 | import jav a.nio.chan nels.Selec tionKey; | |
34 | import jav a.nio.chan nels.Serve rSocketCha nnel; | |
35 | import jav a.nio.chan nels.Socke tChannel; | |
36 | import jav a.util.Ite rator; | |
37 | ||
38 | import com .sun.corba .se.pept.b roker.Brok er; | |
39 | import com .sun.corba .se.pept.e ncoding.In putObject; | |
40 | import com .sun.corba .se.pept.e ncoding.Ou tputObject ; | |
41 | import com .sun.corba .se.pept.p rotocol.Me ssageMedia tor; | |
42 | import com .sun.corba .se.pept.t ransport.A cceptor; | |
43 | import com .sun.corba .se.pept.t ransport.C onnection; | |
44 | import com .sun.corba .se.pept.t ransport.C ontactInfo ; | |
45 | import com .sun.corba .se.pept.t ransport.E ventHandle r; | |
46 | import com .sun.corba .se.pept.t ransport.I nboundConn ectionCach e; | |
47 | import com .sun.corba .se.pept.t ransport.S elector; | |
48 | ||
49 | import com .sun.corba .se.spi.ex tension.Re questParti tioningPol icy; | |
50 | import com .sun.corba .se.spi.io r.IORTempl ate; | |
51 | import com .sun.corba .se.spi.io r.TaggedPr ofileTempl ate; | |
52 | import com .sun.corba .se.spi.io r.iiop.IIO PAddress ; | |
53 | import com .sun.corba .se.spi.io r.iiop.IIO PFactories ; | |
54 | import com .sun.corba .se.spi.io r.iiop.IIO PProfileTe mplate ; | |
55 | import com .sun.corba .se.spi.io r.iiop.GIO PVersion ; | |
56 | import com .sun.corba .se.spi.io r.iiop.Alt ernateIIOP AddressCom ponent; | |
57 | import com .sun.corba .se.spi.lo gging.CORB ALogDomain s; | |
58 | import com .sun.corba .se.spi.or b.ORB; | |
59 | import com .sun.corba .se.spi.or butil.thre adpool.Wor k; | |
60 | import com .sun.corba .se.spi.pr otocol.Cor baMessageM ediator; | |
61 | import com .sun.corba .se.spi.tr ansport.Co rbaAccepto r; | |
62 | import com .sun.corba .se.spi.tr ansport.Co rbaConnect ion; | |
63 | import com .sun.corba .se.spi.tr ansport.So cketInfo; | |
64 | import com .sun.corba .se.spi.tr ansport.So cketOrChan nelAccepto r; | |
65 | ||
66 | import com .sun.corba .se.impl.e ncoding.CD RInputObje ct; | |
67 | import com .sun.corba .se.impl.e ncoding.CD ROutputObj ect; | |
68 | import com .sun.corba .se.impl.l ogging.ORB UtilSystem Exception; | |
69 | import com .sun.corba .se.impl.o a.poa.Poli cies; // R EVISIT imp l/poa spec ific | |
70 | import com .sun.corba .se.impl.o rbutil.ORB Constants; | |
71 | import com .sun.corba .se.impl.o rbutil.ORB Utility; | |
72 | ||
73 | // BEGIN L egacy supp ort. | |
74 | import com .sun.corba .se.spi.le gacy.conne ction.Lega cyServerSo cketEndPoi ntInfo; | |
75 | // END Leg acy suppor t. | |
76 | ||
77 | /** | |
78 | * @author Harold Ca rr | |
79 | */ | |
80 | public cla ss SocketO rChannelAc ceptorImpl | |
81 | extend s | |
82 | Ev entHandler Base | |
83 | implem ents | |
84 | Co rbaAccepto r, | |
85 | So cketOrChan nelAccepto r, | |
86 | Wo rk, | |
87 | // BEGIN Leg acy | |
88 | So cketInfo, | |
89 | Le gacyServer SocketEndP ointInfo | |
90 | // END Legac y | |
91 | { | |
92 | protec ted Server SocketChan nel server SocketChan nel; | |
93 | protec ted Server Socket ser verSocket; | |
94 | protec ted int po rt; | |
95 | protec ted long e nqueueTime ; | |
96 | protec ted boolea n initiali zed; | |
97 | protec ted ORBUti lSystemExc eption wra pper ; | |
98 | protec ted Inboun dConnectio nCache con nectionCac he; | |
99 | ||
100 | // BEG IN Legacy | |
101 | protec ted String type = "" ; | |
102 | protec ted String name = "" ; | |
103 | protec ted String hostname; | |
104 | protec ted int lo catorPort; | |
105 | // END Legacy | |
106 | ||
107 | public SocketOrC hannelAcce ptorImpl(O RB orb) | |
108 | { | |
109 | th is.orb = o rb; | |
110 | wr apper = OR BUtilSyste mException .get( orb, | |
111 | CORBALog Domains.RP C_TRANSPOR T ) ; | |
112 | ||
113 | se tWork(this ); | |
114 | in itialized = false; | |
115 | ||
116 | // BEGIN Leg acy suppor t. | |
117 | th is.hostnam e = orb.ge tORBData() .getORBSer verHost(); | |
118 | th is.name = LegacyServ erSocketEn dPointInfo .NO_NAME; | |
119 | th is.locator Port = -1; | |
120 | // END Legac y support. | |
121 | } | |
122 | ||
123 | public SocketOrC hannelAcce ptorImpl(O RB orb, in t port) | |
124 | { | |
125 | th is(orb); | |
126 | th is.port = port; | |
127 | } | |
128 | ||
129 | // BEG IN Legacy support. | |
130 | public SocketOrC hannelAcce ptorImpl(O RB orb, in t port, | |
131 | S tring name , String t ype) | |
132 | { | |
133 | th is(orb, po rt); | |
134 | th is.name = name; | |
135 | th is.type = type; | |
136 | } | |
137 | // END Legacy su pport. | |
138 | ||
139 | ////// ////////// ////////// ////////// ////////// ////// | |
140 | // | |
141 | // pep t.transpor t.Acceptor | |
142 | // | |
143 | ||
144 | public boolean i nitialize( ) | |
145 | { | |
146 | if (initiali zed) { | |
147 | return f alse; | |
148 | } | |
149 | if (orb.tran sportDebug Flag) { | |
150 | dprint(" .initializ e: " + thi s); | |
151 | } | |
152 | In etSocketAd dress inet SocketAddr ess = null ; | |
153 | tr y { | |
154 | if (orb. getORBData ().getList enOnAllInt erfaces(). equals(ORB Constants. LISTEN_ON_ ALL_INTERF ACES)) { | |
155 | inet SocketAddr ess = new InetSocket Address(po rt); | |
156 | } else { | |
157 | Stri ng host = orb.getORB Data().get ORBServerH ost(); | |
158 | inet SocketAddr ess = new InetSocket Address(ho st, port); | |
159 | } | |
160 | serverSo cket = orb .getORBDat a().getSoc ketFactory () | |
161 | .cre ateServerS ocket(type , inetSock etAddress) ; | |
162 | internal Initialize (); | |
163 | } catch (Thr owable t) { | |
164 | throw wr apper.crea teListener Failed( t, Integer.t oString(po rt) ) ; | |
165 | } | |
166 | in itialized = true; | |
167 | re turn true; | |
168 | } | |
169 | ||
170 | protec ted void i nternalIni tialize() | |
171 | th rows Excep tion | |
172 | { | |
173 | // Determine the liste ning port (for the I OR). | |
174 | // This is i mportant w hen using emphemeral ports (i. e., | |
175 | // when the port value to the co nstructor is 0). | |
176 | ||
177 | po rt = serve rSocket.ge tLocalPort (); | |
178 | ||
179 | // Register with trans port (also sets up m onitoring) . | |
180 | ||
181 | or b.getCorba TransportM anager().g etInboundC onnectionC ache(this) ; | |
182 | ||
183 | // Finish co nfiguation . | |
184 | ||
185 | se rverSocket Channel = serverSock et.getChan nel(); | |
186 | ||
187 | if (serverSo cketChanne l != null) { | |
188 | setUseSe lectThread ToWait( | |
189 | orb. getORBData ().accepto rSocketUse SelectThre adToWait() ); | |
190 | serverSo cketChanne l.configur eBlocking( | |
191 | ! or b.getORBDa ta().accep torSocketU seSelectTh readToWait ()); | |
192 | } else { | |
193 | // Confi gure to us e listener and reade r threads. | |
194 | setUseSe lectThread ToWait(fal se); | |
195 | } | |
196 | se tUseWorker ThreadForE vent( | |
197 | orb.getO RBData().a cceptorSoc ketUseWork erThreadFo rEvent()); | |
198 | ||
199 | } | |
200 | ||
201 | public boolean i nitialized () | |
202 | { | |
203 | re turn initi alized; | |
204 | } | |
205 | ||
206 | public String ge tConnectio nCacheType () | |
207 | { | |
208 | re turn this. getClass() .toString( ); | |
209 | } | |
210 | ||
211 | public void setC onnectionC ache(Inbou ndConnecti onCache co nnectionCa che) | |
212 | { | |
213 | th is.connect ionCache = connectio nCache; | |
214 | } | |
215 | ||
216 | public InboundCo nnectionCa che getCon nectionCac he() | |
217 | { | |
218 | re turn conne ctionCache ; | |
219 | } | |
220 | ||
221 | public boolean s houldRegis terAcceptE vent() | |
222 | { | |
223 | re turn true; | |
224 | } | |
225 | ||
226 | public void acce pt() | |
227 | { | |
228 | tr y { | |
229 | SocketCh annel sock etChannel = null; | |
230 | Socket s ocket = nu ll; | |
231 | if (serv erSocketCh annel == n ull) { | |
232 | sock et = serve rSocket.ac cept(); | |
233 | } else { | |
234 | sock etChannel = serverSo cketChanne l.accept() ; | |
235 | sock et = socke tChannel.s ocket(); | |
236 | } | |
237 | orb.getO RBData().g etSocketFa ctory() | |
238 | .set AcceptedSo cketOption s(this, se rverSocket , socket); | |
239 | if (orb. transportD ebugFlag) { | |
240 | dpri nt(".accep t: " + | |
241 | (server SocketChan nel == nul l | |
242 | ? serv erSocket.t oString() | |
243 | : serv erSocketCh annel.toSt ring())); | |
244 | } | |
245 | ||
246 | CorbaCon nection co nnection = | |
247 | new SocketOrCh annelConne ctionImpl( orb, this, socket); | |
248 | if (orb. transportD ebugFlag) { | |
249 | dpri nt(".accep t: new: " + connecti on); | |
250 | } | |
251 | ||
252 | // NOTE: The conne ction MUST be put in the cache BEFORE be ing | |
253 | // regis tered with the selec tor. Othe rwise if t he bytes | |
254 | // are r ead on the connectio n it will attempt a time stamp | |
255 | // but t he cache w ill be nul l, resulti ng in NPE. | |
256 | ||
257 | // A con nection ne eds to be timestampe d before p utting to the cache. | |
258 | // Other wise the n ewly creat ed connect ion (with 0 timestam p) could b e | |
259 | // incor rectly rec laimed by concurrent reclaim() call OR i f there | |
260 | // will be no even ts on this connectio n then it could be r eclaimed | |
261 | // by up coming rec laim() cal l. | |
262 | getConne ctionCache ().stampTi me(connect ion); | |
263 | getConne ctionCache ().put(thi s, connect ion); | |
264 | ||
265 | if (conn ection.sho uldRegiste rServerRea dEvent()) { | |
266 | Sele ctor selec tor = orb. getTranspo rtManager( ).getSelec tor(0); | |
267 | if ( selector ! = null) { | |
268 | if (orb.tr ansportDeb ugFlag) { | |
269 | dprint (".accept: registerF orEvent: " + connect ion); | |
270 | } | |
271 | selector.r egisterFor Event(conn ection.get EventHandl er()); | |
272 | } | |
273 | } | |
274 | ||
275 | getConne ctionCache ().reclaim (); | |
276 | ||
277 | } catch (IOE xception e ) { | |
278 | if (orb. transportD ebugFlag) { | |
279 | dpri nt(".accep t:", e); | |
280 | } | |
281 | Selector selector = orb.getT ransportMa nager().ge tSelector( 0); | |
282 | if (sele ctor != nu ll) { | |
283 | sele ctor.unreg isterForEv ent(this); | |
284 | // R EVISIT - n eed to clo se - recre ate - then register new one. | |
285 | sele ctor.regis terForEven t(this); | |
286 | // N OTE: if re gister cyc ling we do not want to shut do wn ORB | |
287 | // s ince local beans wil l still wo rk. Inste ad one wil l see | |
288 | // a growing l og file to alert adm in of prob lem. | |
289 | } | |
290 | } | |
291 | } | |
292 | ||
293 | public void clos e () | |
294 | { | |
295 | tr y { | |
296 | if (orb. transportD ebugFlag) { | |
297 | dpri nt(".close ->:"); | |
298 | } | |
299 | Selector selector = orb.getT ransportMa nager().ge tSelector( 0); | |
300 | if (sele ctor != nu ll) { | |
301 | sele ctor.unreg isterForEv ent(this); | |
302 | } | |
303 | if (serv erSocketCh annel != n ull) { | |
304 | serv erSocketCh annel.clos e(); | |
305 | } | |
306 | if (serv erSocket ! = null) { | |
307 | serv erSocket.c lose(); | |
308 | } | |
309 | } catch (IOE xception e ) { | |
310 | if (orb. transportD ebugFlag) { | |
311 | dpri nt(".close :", e); | |
312 | } | |
313 | } finally { | |
314 | if (orb. transportD ebugFlag) { | |
315 | dpri nt(".close <-:"); | |
316 | } | |
317 | } | |
318 | } | |
319 | ||
320 | public EventHand ler getEve ntHandler( ) | |
321 | { | |
322 | re turn this; | |
323 | } | |
324 | ||
325 | ////// ////////// ////////// ////////// ////////// ////// | |
326 | // | |
327 | // Cor baAcceptor | |
328 | // | |
329 | ||
330 | public String ge tObjectAda pterId() | |
331 | { | |
332 | re turn null; | |
333 | } | |
334 | ||
335 | public String ge tObjectAda pterManage rId() | |
336 | { | |
337 | re turn null; | |
338 | } | |
339 | ||
340 | public void addT oIORTempla te(IORTemp late iorTe mplate, | |
341 | Policie s policies , | |
342 | String codebase) | |
343 | { | |
344 | It erator ite rator = io rTemplate. iteratorBy Id( | |
345 | org.omg. IOP.TAG_IN TERNET_IOP .value); | |
346 | ||
347 | St ring hostn ame = orb. getORBData ().getORBS erverHost( ); | |
348 | ||
349 | if (iterator .hasNext() ) { | |
350 | // REVIS IT - how d oes this p lay with l egacy ORBD port exch ange? | |
351 | IIOPAddr ess iiopAd dress = | |
352 | IIOP Factories. makeIIOPAd dress(orb, hostname, port); | |
353 | Alternat eIIOPAddre ssComponen t iiopAddr essCompone nt = | |
354 | IIOP Factories. makeAltern ateIIOPAdd ressCompon ent(iiopAd dress); | |
355 | ||
356 | while (i terator.ha sNext()) { | |
357 | Tagg edProfileT emplate ta ggedProfil eTemplate = | |
358 | (TaggedPro fileTempla te) iterat or.next(); | |
359 | tagg edProfileT emplate.ad d(iiopAddr essCompone nt); | |
360 | } | |
361 | } else { | |
362 | GIOPVers ion versio n = orb.ge tORBData() .getGIOPVe rsion(); | |
363 | int temp latePort; | |
364 | if (poli cies.force ZeroPort() ) { | |
365 | templateP ORT
|
|
366 | } else i f (policie s.isTransi ent()) { | |
367 | temp latePort = port; | |
368 | } else { | |
369 | temp latePort = orb.getLe gacyServer SocketMana ger() | |
370 | . legacyGetP ersistentS erverPort( SocketInfo .IIOP_CLEA R_TEXT); | |
371 | } | |
372 | IIOPAddr ess addr = | |
373 | IIOP Factories. makeIIOPAd dress(orb, hostname, templateP ort); | |
374 | IIOPProf ileTemplat e iiopProf ile = | |
375 | IIOP Factories. makeIIOPPr ofileTempl ate(orb, v ersion, ad dr); | |
376 | if (vers ion.suppor tsIORIIOPP rofileComp onents()) { | |
377 | iiop Profile.ad d(IIOPFact ories.make CodeSetsCo mponent(or b)); | |
378 | iiop Profile.ad d(IIOPFact ories.make MaxStreamF ormatVersi onComponen t()); | |
379 | Requ estPartiti oningPolic y rpPolicy = (Reques tPartition ingPolicy) | |
380 | policies.g et_effecti ve_policy( | |
381 | OR BConstants .REQUEST_P ARTITIONIN G_POLICY); | |
382 | if ( rpPolicy ! = null) { | |
383 | iiopProfil e.add( | |
384 | IIOPF actories.m akeRequest Partitioni ngComponen t( | |
385 | r pPolicy.ge tValue())) ; | |
386 | } | |
387 | if ( codebase ! = null && codebase ! = "") { | |
388 | iiopProfil e.add(IIOP Factories. makeJavaC odebaseCom ponent(cod ebase)); | |
389 | } | |
390 | if ( orb.getORB Data().isJ avaSeriali zationEnab led()) { | |
391 | iiopProfil e.add( | |
392 | IIO PFactories .makeJavaS erializati onComponen t()); | |
393 | } | |
394 | } | |
395 | iorTempl ate.add(ii opProfile) ; | |
396 | } | |
397 | } | |
398 | ||
399 | public String ge tMonitorin gName() | |
400 | { | |
401 | re turn "Acce ptedConnec tions"; | |
402 | } | |
403 | ||
404 | ////// ////////// ////////// ////////// ////////// ////// | |
405 | // | |
406 | // Eve ntHandler methods | |
407 | // | |
408 | ||
409 | public Selectabl eChannel g etChannel( ) | |
410 | { | |
411 | re turn serve rSocketCha nnel; | |
412 | } | |
413 | ||
414 | public int getIn terestOps( ) | |
415 | { | |
416 | re turn Selec tionKey.OP _ACCEPT; | |
417 | } | |
418 | ||
419 | public Acceptor getAccepto r() | |
420 | { | |
421 | re turn this; | |
422 | } | |
423 | ||
424 | public Connectio n getConne ction() | |
425 | { | |
426 | th row new Ru ntimeExcep tion("Shou ld not hap pen."); | |
427 | } | |
428 | ||
429 | ////// ////////// ////////// ////////// ////////// ////// | |
430 | // | |
431 | // Wor k methods. | |
432 | // | |
433 | ||
434 | /* CON FLICT: wit h legacy b elow. | |
435 | public String ge tName() | |
436 | { | |
437 | re turn this. toString() ; | |
438 | } | |
439 | */ | |
440 | ||
441 | public void doWo rk() | |
442 | { | |
443 | tr y { | |
444 | if (orb. transportD ebugFlag) { | |
445 | dpri nt(".doWor k->: " + t his); | |
446 | } | |
447 | if (sele ctionKey.i sAcceptabl e()) { | |
448 | accept (); | |
449 | } else { | |
450 | if ( orb.transp ortDebugFl ag) { | |
451 | dprint(".d oWork: ! s electionKe y.isAccept able: " + this); | |
452 | } | |
453 | } | |
454 | } catch (Sec urityExcep tion se) { | |
455 | if (orb. transportD ebugFlag) { | |
456 | dpri nt(".doWor k: ignorin g Security Exception: " | |
457 | + se | |
458 | + " " + this); | |
459 | } | |
460 | String p ermissionS tr = ORBUt ility.getC lassSecuri tyInfo(get Class()); | |
461 | wrapper. securityEx ceptionInA ccept(se, permission Str); | |
462 | } catch (Exc eption ex) { | |
463 | if (orb. transportD ebugFlag) { | |
464 | dpri nt(".doWor k: ignorin g Exceptio n: " | |
465 | + ex | |
466 | + " " + this); | |
467 | } | |
468 | wrapper. exceptionI nAccept(ex ); | |
469 | } catch (Thr owable t) { | |
470 | if (orb. transportD ebugFlag) { | |
471 | dpri nt(".doWor k: ignorin g Throwabl e: " | |
472 | + t | |
473 | + " " + this); | |
474 | } | |
475 | } finally { | |
476 | ||
477 | // IMPOR TANT: To a void bug ( 4953599), we force t he | |
478 | // Threa d that doe s the NIO select to also do th e | |
479 | // enabl e/disable of Ops usi ng Selecti onKey.inte restOps(). | |
480 | // Other wise, the SelectionK ey.interes tOps() may block | |
481 | // indef initely. | |
482 | // NOTE: If "accep torSocketU seWorkerTh readForEve nt" is | |
483 | // set t o to false in Parser Table.java , then thi s method, | |
484 | // doWor k(), will get execut ed by the same threa d | |
485 | // (Sele ctorThread ) that doe s the NIO select. | |
486 | // If "a cceptorSoc ketUseWork erThreadFo rEvent" is set | |
487 | // to tr ue, a Work erThread w ill execut e this met hod, | |
488 | // doWor k(). Hence , the regi stering of the enabl ing of | |
489 | // the S electionKe y's intere stOps is d one here i nstead | |
490 | // of ca lling Sele ctionKey.i nterestOps (<interest op>). | |
491 | ||
492 | Selector selector = orb.getT ransportMa nager().ge tSelector( 0); | |
493 | if (sele ctor != nu ll) { | |
494 | sele ctor.regis terInteres tOps(this) ; | |
495 | } | |
496 | ||
497 | if (orb. transportD ebugFlag) { | |
498 | dpri nt(".doWor k<-:" + th is); | |
499 | } | |
500 | } | |
501 | } | |
502 | ||
503 | public void setE nqueueTime (long time InMillis) | |
504 | { | |
505 | en queueTime = timeInMi llis; | |
506 | } | |
507 | ||
508 | public long getE nqueueTime () | |
509 | { | |
510 | re turn enque ueTime; | |
511 | } | |
512 | ||
513 | ||
514 | // | |
515 | // Fac tory metho ds. | |
516 | // | |
517 | ||
518 | // REV ISIT: refa ctor into common bas e or deleg ate. | |
519 | public MessageMe diator cre ateMessage Mediator(B roker brok er, | |
520 | C onnection connection ) | |
521 | { | |
522 | // REVISIT - no factor ing so che at to avoi d code dup right now . | |
523 | // REVISIT * *** COUPLI NG !!!! | |
524 | Co ntactInfo contactInf o = new So cketOrChan nelContact InfoImpl() ; | |
525 | re turn conta ctInfo.cre ateMessage Mediator(b roker, con nection); | |
526 | } | |
527 | ||
528 | // REV ISIT: refa ctor into common bas e or deleg ate. | |
529 | public MessageMe diator fin ishCreatin gMessageMe diator(Bro ker broker , | |
530 | Con nection co nnection, | |
531 | Mes sageMediat or message Mediator) | |
532 | { | |
533 | // REVISIT - no factor ing so che at to avoi d code dup right now . | |
534 | // REVISIT * *** COUPLI NG !!!! | |
535 | Co ntactInfo contactInf o = new So cketOrChan nelContact InfoImpl() ; | |
536 | re turn conta ctInfo.fin ishCreatin gMessageMe diator(bro ker, | |
537 | connecti on, messag eMediator) ; | |
538 | } | |
539 | ||
540 | public InputObje ct createI nputObject (Broker br oker, | |
541 | MessageMe diator mes sageMediat or) | |
542 | { | |
543 | Co rbaMessage Mediator c orbaMessag eMediator = (CorbaMe ssageMedia tor) | |
544 | messageM ediator; | |
545 | re turn new C DRInputObj ect((ORB)b roker, | |
546 | (Corba Connection )messageMe diator.get Connection (), | |
547 | corbaM essageMedi ator.getDi spatchBuff er(), | |
548 | corbaM essageMedi ator.getDi spatchHead er()); | |
549 | } | |
550 | ||
551 | public OutputObj ect create OutputObje ct(Broker broker, | |
552 | Message Mediator m essageMedi ator) | |
553 | { | |
554 | Co rbaMessage Mediator c orbaMessag eMediator = (CorbaMe ssageMedia tor) | |
555 | messageM ediator; | |
556 | re turn sun.c orba.Outpu tStreamFac tory.newCD ROutputObj ect((ORB) broker, | |
557 | corbaMe ssageMedia tor, corba MessageMed iator.getR eplyHeader (), | |
558 | corbaMe ssageMedia tor.getStr eamFormatV ersion()); | |
559 | } | |
560 | ||
561 | ////// ////////// ////////// ////////// ////////// ////// | |
562 | // | |
563 | // Soc ketOrChann elAcceptor | |
564 | // | |
565 | ||
566 | public ServerSoc ket getSer verSocket( ) | |
567 | { | |
568 | re turn serve rSocket; | |
569 | } | |
570 | ||
571 | ////// ////////// ////////// ////////// ////////// ////// | |
572 | // | |
573 | // Imp lementatio n. | |
574 | // | |
575 | ||
576 | public String to String() | |
577 | { | |
578 | St ring sock; | |
579 | if (serverSo cketChanne l == null) { | |
580 | if (serv erSocket = = null) { | |
581 | sock = "(not i nitialized )"; | |
582 | } else { | |
583 | sock = serverS ocket.toSt ring(); | |
584 | } | |
585 | } else { | |
586 | sock = s erverSocke tChannel.t oString(); | |
587 | } | |
588 | ||
589 | re turn | |
590 | toString Name() + | |
591 | "[" | |
592 | + sock + " " | |
593 | + type + " " | |
594 | + should UseSelectT hreadToWai t() + " " | |
595 | + should UseWorkerT hreadForEv ent() | |
596 | + "]" ; | |
597 | } | |
598 | ||
599 | protec ted String toStringN ame() | |
600 | { | |
601 | re turn "Sock etOrChanne lAcceptorI mpl"; | |
602 | } | |
603 | ||
604 | protec ted void d print(Stri ng msg) | |
605 | { | |
606 | OR BUtility.d print(toSt ringName() , msg); | |
607 | } | |
608 | ||
609 | protec ted void d print(Stri ng msg, Th rowable t) | |
610 | { | |
611 | dp rint(msg); | |
612 | t. printStack Trace(Syst em.out); | |
613 | } | |
614 | ||
615 | // BEG IN Legacy support | |
616 | ////// ////////// ////////// ////////// ////////// ////// | |
617 | // | |
618 | // Leg acyServerS ocketEndPo intInfo an d EndPoint Info | |
619 | // | |
620 | ||
621 | public String ge tType() | |
622 | { | |
623 | re turn type; | |
624 | } | |
625 | ||
626 | public String ge tHostName( ) | |
627 | { | |
628 | re turn hostn ame; | |
629 | } | |
630 | ||
631 | public String ge tHost() | |
632 | { | |
633 | re turn hostn ame; | |
634 | } | |
635 | ||
636 | public int getPo rt() | |
637 | { | |
638 | re turn port; | |
639 | } | |
640 | ||
641 | public int getLo catorPort( ) | |
642 | { | |
643 | re turn locat orPort; | |
644 | } | |
645 | ||
646 | public void setL ocatorPort (int port ) | |
647 | { | |
648 | lo catorPort = port; | |
649 | } | |
650 | ||
651 | public String ge tName() | |
652 | { | |
653 | // Kluge ale rt: | |
654 | // Work and Legacy bot h define g etName. | |
655 | // Try to ma ke this be have best for most c ases. | |
656 | St ring resul t = | |
657 | name.equ als(Legacy ServerSock etEndPoint Info.NO_NA ME) ? | |
658 | this.toS tring() : name; | |
659 | re turn resul t; | |
660 | } | |
661 | // END Legacy su pport | |
662 | } | |
663 | ||
664 | // End of file. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.