Produced by Araxis Merge on Mon Mar 6 16:03:36 2006 UTC. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. 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 | C:\Merge Test Files\4.0.6\catalina\src\share\org\apache\catalina\connector\http | HttpConnector.java | Tue Oct 8 15:15:34 2002 UTC |
| 2 | C:\Merge Test Files\4.1.18\catalina\src\share\org\apache\catalina\connector\http | HttpConnector.java | Thu Dec 19 13:49:44 2002 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 18 | 1194 |
| Changed | 8 | 72 |
| Inserted | 9 | 34 |
| Removed | 0 | 0 |
| Whitespace | All differences in whitespace within lines are ignored |
|---|---|
| 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 | /* | 1 | /* | |||
| 2 |
*
$Header:
/home/cvs/
jakarta-to
mcat-4.0/c
atalina/sr
c/share/or
g/apache/c
atalina/co
nnector/ht
tp/HttpCon
nector.jav
a,v
1.
2
4
.2.2
2002/0
1/
3
|
2 |
*
$Header:
/home/cvs/
jakarta-to
mcat-4.0/c
atalina/sr
c/share/or
g/apache/c
atalina/co
nnector/ht
tp/HttpCon
nector.jav
a,v
1.
3
4
|
|||
| 3 | * $Revision: 1. 2 4 .2.2 $ | 3 |
*
$Revision:
1.
3
4
|
|||
| 4 |
*
$Date:
2002/0
1/
3
|
4 |
*
$Date:
2002/0
|
|||
| 5 | * | 5 | * | |||
| 6 | * ======= ========== ========== ========== ========== ========== ========== = | 6 | * ======= ========== ========== ========== ========== ========== ========== = | |||
| 7 | * | 7 | * | |||
| 8 | * The Apa che Softwa re License , Version 1.1 | 8 | * The Apa che Softwa re License , Version 1.1 | |||
| 9 | * | 9 | * | |||
| 10 | * Copyrig ht (c) 199 9 The Apac he Softwar e Foundati on. All r ights | 10 | * Copyrig ht (c) 199 9 The Apac he Softwar e Foundati on. All r ights | |||
| 11 | * reserve d. | 11 | * reserve d. | |||
| 12 | * | 12 | * | |||
| 13 | * Redistr ibution an d use in s ource and binary for ms, with o r without | 13 | * Redistr ibution an d use in s ource and binary for ms, with o r without | |||
| 14 | * modific ation, are permitted provided that the f ollowing c onditions | 14 | * modific ation, are permitted provided that the f ollowing c onditions | |||
| 15 | * are met : | 15 | * are met : | |||
| 16 | * | 16 | * | |||
| 17 | * 1. Redi stribution s of sourc e code mus t retain t he above c opyright | 17 | * 1. Redi stribution s of sourc e code mus t retain t he above c opyright | |||
| 18 | * noti ce, this l ist of con ditions an d the foll owing disc laimer. | 18 | * noti ce, this l ist of con ditions an d the foll owing disc laimer. | |||
| 19 | * | 19 | * | |||
| 20 | * 2. Redi stribution s in binar y form mus t reproduc e the abov e copyrigh t | 20 | * 2. Redi stribution s in binar y form mus t reproduc e the abov e copyrigh t | |||
| 21 | * noti ce, this l ist of con ditions an d the foll owing disc laimer in | 21 | * noti ce, this l ist of con ditions an d the foll owing disc laimer in | |||
| 22 | * the documentat ion and/or other mat erials pro vided with the | 22 | * the documentat ion and/or other mat erials pro vided with the | |||
| 23 | * dist ribution. | 23 | * dist ribution. | |||
| 24 | * | 24 | * | |||
| 25 | * 3. The end-user d ocumentati on include d with the redistrib ution, if | 25 | * 3. The end-user d ocumentati on include d with the redistrib ution, if | |||
| 26 | * any, must incl ude the fo llowing ac knowlegeme nt: | 26 | * any, must incl ude the fo llowing ac knowlegeme nt: | |||
| 27 | * " This produ ct include s software developed by the | 27 | * " This produ ct include s software developed by the | |||
| 28 | * Apache Sof tware Foun dation (ht tp://www.a pache.org/ )." | 28 | * Apache Sof tware Foun dation (ht tp://www.a pache.org/ )." | |||
| 29 | * Alte rnately, t his acknow legement m ay appear in the sof tware itse lf, | 29 | * Alte rnately, t his acknow legement m ay appear in the sof tware itse lf, | |||
| 30 | * if a nd whereve r such thi rd-party a cknowlegem ents norma lly appear . | 30 | * if a nd whereve r such thi rd-party a cknowlegem ents norma lly appear . | |||
| 31 | * | 31 | * | |||
| 32 | * 4. The names "The Jakarta P roject", " Tomcat", a nd "Apache Software | 32 | * 4. The names "The Jakarta P roject", " Tomcat", a nd "Apache Software | |||
| 33 | * Foun dation" mu st not be used to en dorse or p romote pro ducts deri ved | 33 | * Foun dation" mu st not be used to en dorse or p romote pro ducts deri ved | |||
| 34 | * from this soft ware witho ut prior w ritten per mission. F or written | 34 | * from this soft ware witho ut prior w ritten per mission. F or written | |||
| 35 | * perm ission, pl ease conta ct apache@ apache.org . | 35 | * perm ission, pl ease conta ct apache@ apache.org . | |||
| 36 | * | 36 | * | |||
| 37 | * 5. Prod ucts deriv ed from th is softwar e may not be called "Apache" | 37 | * 5. Prod ucts deriv ed from th is softwar e may not be called "Apache" | |||
| 38 | * nor may "Apach e" appear in their n ames witho ut prior w ritten | 38 | * nor may "Apach e" appear in their n ames witho ut prior w ritten | |||
| 39 | * perm ission of the Apache Group. | 39 | * perm ission of the Apache Group. | |||
| 40 | * | 40 | * | |||
| 41 | * THIS SO FTWARE IS PROVIDED ` `AS IS'' A ND ANY EXP RESSED OR IMPLIED | 41 | * THIS SO FTWARE IS PROVIDED ` `AS IS'' A ND ANY EXP RESSED OR IMPLIED | |||
| 42 | * WARRANT IES, INCLU DING, BUT NOT LIMITE D TO, THE IMPLIED WA RRANTIES | 42 | * WARRANT IES, INCLU DING, BUT NOT LIMITE D TO, THE IMPLIED WA RRANTIES | |||
| 43 | * OF MERC HANTABILIT Y AND FITN ESS FOR A PARTICULAR PURPOSE A RE | 43 | * OF MERC HANTABILIT Y AND FITN ESS FOR A PARTICULAR PURPOSE A RE | |||
| 44 | * DISCLAI MED. IN N O EVENT SH ALL THE AP ACHE SOFTW ARE FOUNDA TION OR | 44 | * DISCLAI MED. IN N O EVENT SH ALL THE AP ACHE SOFTW ARE FOUNDA TION OR | |||
| 45 | * ITS CON TRIBUTORS BE LIABLE FOR ANY DI RECT, INDI RECT, INCI DENTAL, | 45 | * ITS CON TRIBUTORS BE LIABLE FOR ANY DI RECT, INDI RECT, INCI DENTAL, | |||
| 46 | * SPECIAL , EXEMPLAR Y, OR CONS EQUENTIAL DAMAGES (I NCLUDING, BUT NOT | 46 | * SPECIAL , EXEMPLAR Y, OR CONS EQUENTIAL DAMAGES (I NCLUDING, BUT NOT | |||
| 47 | * LIMITED TO, PROCU REMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | 47 | * LIMITED TO, PROCU REMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
| 48 | * USE, DA TA, OR PRO FITS; OR B USINESS IN TERRUPTION ) HOWEVER CAUSED AND | 48 | * USE, DA TA, OR PRO FITS; OR B USINESS IN TERRUPTION ) HOWEVER CAUSED AND | |||
| 49 | * ON ANY THEORY OF LIABILITY, WHETHER I N CONTRACT , STRICT L IABILITY, | 49 | * ON ANY THEORY OF LIABILITY, WHETHER I N CONTRACT , STRICT L IABILITY, | |||
| 50 | * OR TORT (INCLUDIN G NEGLIGEN CE OR OTHE RWISE) ARI SING IN AN Y WAY OUT | 50 | * OR TORT (INCLUDIN G NEGLIGEN CE OR OTHE RWISE) ARI SING IN AN Y WAY OUT | |||
| 51 | * OF THE USE OF THI S SOFTWARE , EVEN IF ADVISED OF THE POSSI BILITY OF | 51 | * OF THE USE OF THI S SOFTWARE , EVEN IF ADVISED OF THE POSSI BILITY OF | |||
| 52 | * SUCH DA MAGE. | 52 | * SUCH DA MAGE. | |||
| 53 | * ======= ========== ========== ========== ========== ========== ========== = | 53 | * ======= ========== ========== ========== ========== ========== ========== = | |||
| 54 | * | 54 | * | |||
| 55 | * This so ftware con sists of v oluntary c ontributio ns made by many | 55 | * This so ftware con sists of v oluntary c ontributio ns made by many | |||
| 56 | * individ uals on be half of th e Apache S oftware Fo undation. For more | 56 | * individ uals on be half of th e Apache S oftware Fo undation. For more | |||
| 57 | * informa tion on th e Apache S oftware Fo undation, please see | 57 | * informa tion on th e Apache S oftware Fo undation, please see | |||
| 58 | * <http:/ /www.apach e.org/>. | 58 | * <http:/ /www.apach e.org/>. | |||
| 59 | * | 59 | * | |||
| 60 | * [Additi onal notic es, if req uired by p rior licen sing condi tions] | 60 | * [Additi onal notic es, if req uired by p rior licen sing condi tions] | |||
| 61 | * | 61 | * | |||
| 62 | */ | 62 | */ | |||
| 63 | 63 | |||||
| 64 | 64 | |||||
| 65 | package or g.apache.c atalina.co nnector.ht tp; | 65 | package or g.apache.c atalina.co nnector.ht tp; | |||
| 66 | 66 | |||||
| 67 | 67 | |||||
| 68 | import jav a.io.IOExc eption; | 68 | import jav a.io.IOExc eption; | |||
| 69 | import jav a.net.Bind Exception; | 69 | import jav a.net.Bind Exception; | |||
| 70 | import jav a.net.Inet Address; | 70 | import jav a.net.Inet Address; | |||
| 71 | import jav a.net.Serv erSocket; | 71 | import jav a.net.Serv erSocket; | |||
| 72 | import jav a.net.Sock et; | 72 | import jav a.net.Sock et; | |||
| 73 | import jav a.net.Unkn ownHostExc eption; | |||||
| 73 | import jav a.security .AccessCon trolExcept ion; | 74 | import jav a.security .AccessCon trolExcept ion; | |||
| 74 | import jav a.util.Sta ck; | 75 | import jav a.util.Sta ck; | |||
| 75 | import jav a.util.Vec tor; | 76 | import jav a.util.Vec tor; | |||
| 76 | import jav a.util.Enu meration; | 77 | import jav a.util.Enu meration; | |||
| 78 | import jav a.security .KeyStoreE xception; | |||||
| 79 | import jav a.security .NoSuchAlg orithmExce ption; | |||||
| 80 | import jav a.security .cert.Cert ificateExc eption; | |||||
| 81 | import jav a.security .Unrecover ableKeyExc eption; | |||||
| 82 | import jav a.security .KeyManage mentExcept ion; | |||||
| 77 | import org .apache.ca talina.Con nector; | 83 | import org .apache.ca talina.Con nector; | |||
| 78 | import org .apache.ca talina.Con tainer; | 84 | import org .apache.ca talina.Con tainer; | |||
| 79 | import org .apache.ca talina.Htt pRequest; | 85 | import org .apache.ca talina.Htt pRequest; | |||
| 80 | import org .apache.ca talina.Htt pResponse; | 86 | import org .apache.ca talina.Htt pResponse; | |||
| 81 | import org .apache.ca talina.Lif ecycle; | 87 | import org .apache.ca talina.Lif ecycle; | |||
| 82 | import org .apache.ca talina.Lif ecycleEven t; | 88 | import org .apache.ca talina.Lif ecycleEven t; | |||
| 83 | import org .apache.ca talina.Lif ecycleExce ption; | 89 | import org .apache.ca talina.Lif ecycleExce ption; | |||
| 84 | import org .apache.ca talina.Lif ecycleList ener; | 90 | import org .apache.ca talina.Lif ecycleList ener; | |||
| 85 | import org .apache.ca talina.Log ger; | 91 | import org .apache.ca talina.Log ger; | |||
| 86 | import org .apache.ca talina.Req uest; | 92 | import org .apache.ca talina.Req uest; | |||
| 87 | import org .apache.ca talina.Res ponse; | 93 | import org .apache.ca talina.Res ponse; | |||
| 88 | import org .apache.ca talina.Ser vice; | 94 | import org .apache.ca talina.Ser vice; | |||
| 89 | import org .apache.ca talina.net .DefaultSe rverSocket Factory; | 95 | import org .apache.ca talina.net .DefaultSe rverSocket Factory; | |||
| 90 | import org .apache.ca talina.net .ServerSoc ketFactory ; | 96 | import org .apache.ca talina.net .ServerSoc ketFactory ; | |||
| 91 | import org .apache.ca talina.uti l.Lifecycl eSupport; | 97 | import org .apache.ca talina.uti l.Lifecycl eSupport; | |||
| 92 | import org .apache.ca talina.uti l.StringMa nager; | 98 | import org .apache.ca talina.uti l.StringMa nager; | |||
| 93 | 99 | |||||
| 94 | 100 | |||||
| 95 | /** | 101 | /** | |||
| 96 | * Impleme ntation of an HTTP/1 .1 connect or. | 102 | * Impleme ntation of an HTTP/1 .1 connect or. | |||
| 97 | * | 103 | * | |||
| 98 | * @author Craig R. McClanahan | 104 | * @author Craig R. McClanahan | |||
| 99 | * @author Remy Mauc herat | 105 | * @author Remy Mauc herat | |||
| 100 |
*
@version
$Revision:
1.
2
4
.2.2
$
$Date:
2002/0
1/
3
|
106 |
*
@version
$Revision:
1.
3
4
|
|||
| 107 | * @deprec ated | |||||
| 101 | */ | 108 | */ | |||
| 102 | 109 | |||||
| 103 | 110 | |||||
| 104 | public fin al class H ttpConnect or | 111 | public fin al class H ttpConnect or | |||
| 105 | implem ents Conne ctor, Life cycle, Run nable { | 112 | implem ents Conne ctor, Life cycle, Run nable { | |||
| 106 | 113 | |||||
| 107 | 114 | |||||
| 108 | // --- ---------- ---------- ---------- ---------- ---------- Instance Variables | 115 | // --- ---------- ---------- ---------- ---------- ---------- Instance Variables | |||
| 109 | 116 | |||||
| 110 | 117 | |||||
| 111 | /** | 118 | /** | |||
| 112 | * The <code>Ser vice</code > we are a ssociated with (if a ny). | 119 | * The <code>Ser vice</code > we are a ssociated with (if a ny). | |||
| 113 | */ | 120 | */ | |||
| 114 | privat e Service service = null; | 121 | privat e Service service = null; | |||
| 115 | 122 | |||||
| 116 | 123 | |||||
| 117 | /** | 124 | /** | |||
| 118 | * The accept co unt for th is Connect or. | 125 | * The accept co unt for th is Connect or. | |||
| 119 | */ | 126 | */ | |||
| 120 | privat e int acce ptCount = 10; | 127 | privat e int acce ptCount = 10; | |||
| 121 | 128 | |||||
| 122 | 129 | |||||
| 123 | /** | 130 | /** | |||
| 124 | * The IP addres s on which to bind, if any. I f <code>nu ll</code>, all | 131 | * The IP addres s on which to bind, if any. I f <code>nu ll</code>, all | |||
| 125 | * add resses on the server will be b ound. | 132 | * add resses on the server will be b ound. | |||
| 126 | */ | 133 | */ | |||
| 127 | privat e String a ddress = n ull; | 134 | privat e String a ddress = n ull; | |||
| 128 | 135 | |||||
| 129 | 136 | |||||
| 130 | /** | 137 | /** | |||
| 131 | * The input buf fer size w e should c reate on i nput strea ms. | 138 | * The input buf fer size w e should c reate on i nput strea ms. | |||
| 132 | */ | 139 | */ | |||
| 133 | privat e int buff erSize = 2 048; | 140 | privat e int buff erSize = 2 048; | |||
| 134 | 141 | |||||
| 135 | 142 | |||||
| 136 | /** | 143 | /** | |||
| 137 | * The Container used for processing requests received b y this Con nector. | 144 | * The Container used for processing requests received b y this Con nector. | |||
| 138 | */ | 145 | */ | |||
| 139 | protec ted Contai ner contai ner = null ; | 146 | protec ted Contai ner contai ner = null ; | |||
| 140 | 147 | |||||
| 141 | 148 | |||||
| 142 | /** | 149 | /** | |||
| 143 | * The set of pr ocessors t hat have e ver been c reated. | 150 | * The set of pr ocessors t hat have e ver been c reated. | |||
| 144 | */ | 151 | */ | |||
| 145 | privat e Vector c reated = n ew Vector( ); | 152 | privat e Vector c reated = n ew Vector( ); | |||
| 146 | 153 | |||||
| 147 | 154 | |||||
| 148 | /** | 155 | /** | |||
| (199 unchanged lines omitted) | ||||||
| 348 | } | 355 | } | |||
| 349 | 356 | |||||
| 350 | 357 | |||||
| 351 | /** | 358 | /** | |||
| 352 | * Set the conne ction time out for th is Connect or. | 359 | * Set the conne ction time out for th is Connect or. | |||
| 353 | * | 360 | * | |||
| 354 | * @pa ram count The new co nnection t imeout | 361 | * @pa ram count The new co nnection t imeout | |||
| 355 | */ | 362 | */ | |||
| 356 | public void setC onnectionT imeout(int connectio nTimeout) { | 363 | public void setC onnectionT imeout(int connectio nTimeout) { | |||
| 357 | 364 | |||||
| 358 | th is.connect ionTimeout = connect ionTimeout ; | 365 | th is.connect ionTimeout = connect ionTimeout ; | |||
| 359 | 366 | |||||
| 360 | } | 367 | } | |||
| 361 | 368 | |||||
| 362 | 369 | |||||
| 363 | /** | 370 | /** | |||
| 364 | * Ret urn the ac cept count for this Connector. | 371 | * Ret urn the ac cept count for this Connector. | |||
| 365 | */ | 372 | */ | |||
| 366 | public int getAc ceptCount( ) { | 373 | public int getAc ceptCount( ) { | |||
| 367 | 374 | |||||
| 368 | re turn (acce ptCount); | 375 | re turn (acce ptCount); | |||
| 369 | 376 | |||||
| 370 | } | 377 | } | |||
| 371 | 378 | |||||
| 372 | 379 | |||||
| 373 | /** | 380 | /** | |||
| 374 | * Set the accep t count fo r this Con nector. | 381 | * Set the accep t count fo r this Con nector. | |||
| 375 | * | 382 | * | |||
| 376 | * @pa ram count The new ac cept count | 383 | * @pa ram count The new ac cept count | |||
| 377 | */ | 384 | */ | |||
| 378 | public void setA cceptCount (int count ) { | 385 | public void setA cceptCount (int count ) { | |||
| 379 | 386 | |||||
| 380 | th is.acceptC ount = cou nt; | 387 | th is.acceptC ount = cou nt; | |||
| 381 | 388 | |||||
| 382 | } | 389 | } | |||
| 383 | 390 | |||||
| 384 | 391 | |||||
| 385 | /** | 392 | /** | |||
| 386 | * Get the allow chunking flag. | 393 | * Get the allow chunking flag. | |||
| 387 | */ | 394 | */ | |||
| 388 | public boolean i sChunkingA llowed() { | 395 | public boolean i sChunkingA llowed() { | |||
| 389 | 396 | |||||
| 390 | re turn (allo wChunking) ; | 397 | re turn (allo wChunking) ; | |||
| 391 | 398 | |||||
| 392 | } | 399 | } | |||
| 393 | 400 | |||||
| 394 | 401 | |||||
| 395 | /** | 402 | /** | |||
| 403 | * Get the allow chunking flag. | |||||
| 404 | */ | |||||
| 405 | public boolean g etAllowChu nking() { | |||||
| 406 | ||||||
| 407 | re turn isChu nkingAllow ed(); | |||||
| 408 | ||||||
| 409 | } | |||||
| 410 | ||||||
| 411 | ||||||
| 412 | /** | |||||
| 396 | * Set the allow chunking flag. | 413 | * Set the allow chunking flag. | |||
| 397 | * | 414 | * | |||
| 398 | * @pa ram allowC hunking Al low chunki ng flag | 415 | * @pa ram allowC hunking Al low chunki ng flag | |||
| 399 | */ | 416 | */ | |||
| 400 | public void setA llowChunki ng(boolean allowChun king) { | 417 | public void setA llowChunki ng(boolean allowChun king) { | |||
| 401 | 418 | |||||
| 402 | th is.allowCh unking = a llowChunki ng; | 419 | th is.allowCh unking = a llowChunki ng; | |||
| 403 | 420 | |||||
| 404 | } | 421 | } | |||
| 405 | 422 | |||||
| 406 | 423 | |||||
| 407 | /** | 424 | /** | |||
| 408 | * Ret urn the bi nd IP addr ess for th is Connect or. | 425 | * Ret urn the bi nd IP addr ess for th is Connect or. | |||
| 409 | */ | 426 | */ | |||
| 410 | public String ge tAddress() { | 427 | public String ge tAddress() { | |||
| 411 | 428 | |||||
| 412 | re turn (this .address); | 429 | re turn (this .address); | |||
| 413 | 430 | |||||
| 414 | } | 431 | } | |||
| 415 | 432 | |||||
| 416 | 433 | |||||
| 417 | /** | 434 | /** | |||
| 418 | * Set the bind IP address for this Connector. | 435 | * Set the bind IP address for this Connector. | |||
| 419 | * | 436 | * | |||
| 420 | * @pa ram addres s The bind IP addres s | 437 | * @pa ram addres s The bind IP addres s | |||
| 421 | */ | 438 | */ | |||
| 422 | public void setA ddress(Str ing addres s) { | 439 | public void setA ddress(Str ing addres s) { | |||
| 423 | 440 | |||||
| 424 | th is.address = address ; | 441 | th is.address = address ; | |||
| 425 | 442 | |||||
| 426 | } | 443 | } | |||
| 427 | 444 | |||||
| 428 | 445 | |||||
| 429 | /** | 446 | /** | |||
| 430 | * Is this conne ctor avail able for p rocessing requests? | 447 | * Is this conne ctor avail able for p rocessing requests? | |||
| 431 | */ | 448 | */ | |||
| 432 | public boolean i sAvailable () { | 449 | public boolean i sAvailable () { | |||
| 433 | 450 | |||||
| 434 | re turn (star ted); | 451 | re turn (star ted); | |||
| 435 | 452 | |||||
| 436 | } | 453 | } | |||
| 437 | 454 | |||||
| 438 | 455 | |||||
| 439 | /** | 456 | /** | |||
| 440 | * Ret urn the in put buffer size for this Conne ctor. | 457 | * Ret urn the in put buffer size for this Conne ctor. | |||
| 441 | */ | 458 | */ | |||
| 442 | public int getBu fferSize() { | 459 | public int getBu fferSize() { | |||
| 443 | 460 | |||||
| (445 unchanged lines omitted) | ||||||
| 889 | * | 906 | * | |||
| 890 | * @pa ram messag e Message to be logg ed | 907 | * @pa ram messag e Message to be logg ed | |||
| 891 | * @pa ram throwa ble Associ ated excep tion | 908 | * @pa ram throwa ble Associ ated excep tion | |||
| 892 | */ | 909 | */ | |||
| 893 | privat e void log (String me ssage, Thr owable thr owable) { | 910 | privat e void log (String me ssage, Thr owable thr owable) { | |||
| 894 | 911 | |||||
| 895 | Lo gger logge r = contai ner.getLog ger(); | 912 | Lo gger logge r = contai ner.getLog ger(); | |||
| 896 | St ring local Name = thr eadName; | 913 | St ring local Name = thr eadName; | |||
| 897 | if (localNam e == null) | 914 | if (localNam e == null) | |||
| 898 | localNam e = "HttpC onnector"; | 915 | localNam e = "HttpC onnector"; | |||
| 899 | if (logger ! = null) | 916 | if (logger ! = null) | |||
| 900 | logger.l og(localNa me + " " + message, throwable) ; | 917 | logger.l og(localNa me + " " + message, throwable) ; | |||
| 901 | el se { | 918 | el se { | |||
| 902 | System.o ut.println (localName + " " + m essage); | 919 | System.o ut.println (localName + " " + m essage); | |||
| 903 | throwabl e.printSta ckTrace(Sy stem.out); | 920 | throwabl e.printSta ckTrace(Sy stem.out); | |||
| 904 | } | 921 | } | |||
| 905 | 922 | |||||
| 906 | } | 923 | } | |||
| 907 | 924 | |||||
| 908 | 925 | |||||
| 909 | /** | 926 | /** | |||
| 910 | * Cre ate and re turn a new processor suitable for proces sing HTTP | 927 | * Cre ate and re turn a new processor suitable for proces sing HTTP | |||
| 911 | * req uests and returning the corres ponding re sponses. | 928 | * req uests and returning the corres ponding re sponses. | |||
| 912 | */ | 929 | */ | |||
| 913 | privat e HttpProc essor newP rocessor() { | 930 | privat e HttpProc essor newP rocessor() { | |||
| 914 | 931 | |||||
| 915 | // if (debug >= 2) | 932 | // if (debug >= 2) | |||
| 916 | // log("new Processor: Creating new proces sor"); | 933 | // log("new Processor: Creating new proces sor"); | |||
| 917 | Ht tpProcesso r processo r = new Ht tpProcesso r(this, cu rProcessor s++); | 934 | Ht tpProcesso r processo r = new Ht tpProcesso r(this, cu rProcessor s++); | |||
| 918 | if (processo r instance of Lifecyc le) { | 935 | if (processo r instance of Lifecyc le) { | |||
| 919 | try { | 936 | try { | |||
| 920 | ((Li fecycle) p rocessor). start(); | 937 | ((Li fecycle) p rocessor). start(); | |||
| 921 | } catch (Lifecycle Exception e) { | 938 | } catch (Lifecycle Exception e) { | |||
| 922 | log( "newProces sor", e); | 939 | log( "newProces sor", e); | |||
| 923 | retu rn (null); | 940 | retu rn (null); | |||
| 924 | } | 941 | } | |||
| 925 | } | 942 | } | |||
| 926 | cr eated.addE lement(pro cessor); | 943 | cr eated.addE lement(pro cessor); | |||
| 927 | re turn (proc essor); | 944 | re turn (proc essor); | |||
| 928 | 945 | |||||
| 929 | } | 946 | } | |||
| 930 | 947 | |||||
| 931 | 948 | |||||
| 932 | /** | 949 | /** | |||
| 933 | * Ope n and retu rn the ser ver socket for this Connector. If an IP | 950 | * Ope n and retu rn the ser ver socket for this Connector. If an IP | |||
| 934 | * add ress has b een specif ied, the s ocket will be opened only on t hat | 951 | * add ress has b een specif ied, the s ocket will be opened only on t hat | |||
| 935 | * add ress; othe rwise it w ill be ope ned on all addresses . | 952 | * add ress; othe rwise it w ill be ope ned on all addresses . | |||
| 936 | * | 953 | * | |||
| 937 |
*
@exception
IOExceptio
n
i
f
an
i
nput/outpu
t
|
954 |
*
@exception
IOExceptio
n
i
|
|||
| 955 | * @ex ception Ke yStoreExce ption error instantia ting the | |||||
| 956 | * KeySt ore from f ile (SSL o nly) | |||||
| 957 | * @ex ception No SuchAlgori thmExcepti on KeySt ore algori thm unsupp orted | |||||
| 958 | * by cu rrent prov ider (SSL only) | |||||
| 959 | * @ex ception Ce rtificateE xception gener al certifi cate error (SSL only ) | |||||
| 960 | * @ex ception Un recoverabl eKeyExcept ion inter nal KeySto re problem with | |||||
| 961 | * the c ertificate (SSL only ) | |||||
| 962 | * @ex ception Ke yManagemen tException probl em in the key manage ment | |||||
| 963 | * layer (SSL only ) | |||||
| 938 | */ | 964 | */ | |||
| 939 | private ServerSock et open() throws IOExceptio n { | 965 |
private
ServerSock
et
open()
|
|||
| 966 | throws IOExcepti on, KeySto reExceptio n, NoSuchA lgorithmEx ception, | |||||
| 967 | Certifica teExceptio n, Unrecov erableKeyE xception, | |||||
| 968 | KeyManage mentExcept ion | |||||
| 969 | { | |||||
| 940 | 970 | |||||
| 941 | // Acquire t he server socket fac tory for t his Connec tor | 971 | // Acquire t he server socket fac tory for t his Connec tor | |||
| 942 | Se rverSocket Factory fa ctory = ge tFactory() ; | 972 | Se rverSocket Factory fa ctory = ge tFactory() ; | |||
| 943 | 973 | |||||
| 944 | // If no add ress is sp ecified, o pen a conn ection on all addres ses | 974 | // If no add ress is sp ecified, o pen a conn ection on all addres ses | |||
| 945 | if (address == null) { | 975 | if (address == null) { | |||
| 946 | log(sm.g etString(" httpConnec tor.allAdd resses")); | 976 | log(sm.g etString(" httpConnec tor.allAdd resses")); | |||
| 947 | try { | 977 | try { | |||
| 948 | retu rn (factor y.createSo cket(port, acceptCou nt)); | 978 | retu rn (factor y.createSo cket(port, acceptCou nt)); | |||
| 949 | } catch (BindExcep tion be) { | 979 | } catch (BindExcep tion be) { | |||
| 950 | thro w new Bind Exception( be.getMess age() + ": " + port); | 980 | thro w new Bind Exception( be.getMess age() + ": " + port); | |||
| 951 | } | 981 | } | |||
| 952 | } | 982 | } | |||
| 953 | 983 | |||||
| 954 | // Open a se rver socke t on the s pecified a ddress | 984 | // Open a se rver socke t on the s pecified a ddress | |||
| 955 | tr y { | 985 | tr y { | |||
| 956 | InetAddr ess is = I netAddress .getByName (address); | 986 | InetAddr ess is = I netAddress .getByName (address); | |||
| 957 | log(sm.g etString(" httpConnec tor.anAddr ess", addr ess)); | 987 | log(sm.g etString(" httpConnec tor.anAddr ess", addr ess)); | |||
| 958 | try { | 988 | try { | |||
| 959 | retu rn (factor y.createSo cket(port, acceptCou nt, is)); | 989 | retu rn (factor y.createSo cket(port, acceptCou nt, is)); | |||
| 960 | } catch (BindExcep tion be) { | 990 | } catch (BindExcep tion be) { | |||
| 961 |
throw
new
BindExcept
ion(be.get
Message()
+
":"
+
address
|
991 | throw new BindExcept ion(be.get Message() + ":" + address + | |||
| 962 | + ":" + port); | 992 |
|
|||
| 963 | } | 993 | } | |||
| 964 | } catch (Exc eption e) { | 994 | } catch (Exc eption e) { | |||
| 965 | log(sm.g etString(" httpConnec tor.noAddr ess", addr ess)); | 995 | log(sm.g etString(" httpConnec tor.noAddr ess", addr ess)); | |||
| 966 | try { | 996 | try { | |||
| 967 | retu rn (factor y.createSo cket(port, acceptCou nt)); | 997 | retu rn (factor y.createSo cket(port, acceptCou nt)); | |||
| 968 | } catch (BindExcep tion be) { | 998 | } catch (BindExcep tion be) { | |||
| 969 | thro w new Bind Exception( be.getMess age() + ": " + port); | 999 | thro w new Bind Exception( be.getMess age() + ": " + port); | |||
| 970 | } | 1000 | } | |||
| 971 | } | 1001 | } | |||
| 972 | 1002 | |||||
| 973 | } | 1003 | } | |||
| 974 | 1004 | |||||
| 975 | 1005 | |||||
| 976 | // --- ---------- ---------- ---------- ---------- --- Backgr ound Threa d Methods | 1006 | // --- ---------- ---------- ---------- ---------- --- Backgr ound Threa d Methods | |||
| 977 | 1007 | |||||
| 978 | 1008 | |||||
| 979 | /** | 1009 | /** | |||
| 980 | * The backgroun d thread t hat listen s for inco ming TCP/I P connecti ons and | 1010 | * The backgroun d thread t hat listen s for inco ming TCP/I P connecti ons and | |||
| 981 | * han ds them of f to an ap propriate processor. | 1011 | * han ds them of f to an ap propriate processor. | |||
| 982 | */ | 1012 | */ | |||
| 983 | public void run( ) { | 1013 | public void run( ) { | |||
| 984 | 1014 | |||||
| 985 | // Loop unti l we recei ve a shutd own comman d | 1015 | // Loop unti l we recei ve a shutd own comman d | |||
| 986 | wh ile (!stop ped) { | 1016 | wh ile (!stop ped) { | |||
| 987 | 1017 | |||||
| 988 | // Accep t the next incoming connection from the server soc ket | 1018 | // Accep t the next incoming connection from the server soc ket | |||
| 989 | Socket s ocket = nu ll; | 1019 | Socket s ocket = nu ll; | |||
| 990 | try { | 1020 | try { | |||
| 991 | // if (de bug >= 3) | 1021 | // if (de bug >= 3) | |||
| 992 | // lo g("run: Wa iting on s erverSocke t.accept() "); | 1022 | // lo g("run: Wa iting on s erverSocke t.accept() "); | |||
| 993 | sock et = serve rSocket.ac cept(); | 1023 | sock et = serve rSocket.ac cept(); | |||
| 994 | // if (de bug >= 3) | 1024 | // if (de bug >= 3) | |||
| 995 | // lo g("run: Re turned fro m serverSo cket.accep t()"); | 1025 | // lo g("run: Re turned fro m serverSo cket.accep t()"); | |||
| 996 | if ( connection Timeout > 0) | 1026 | if ( connection Timeout > 0) | |||
| 997 | socket.set SoTimeout( connection Timeout); | 1027 | socket.set SoTimeout( connection Timeout); | |||
| 998 | sock et.setTcpN oDelay(tcp NoDelay); | 1028 | sock et.setTcpN oDelay(tcp NoDelay); | |||
| 999 | } catch (AccessCon trolExcept ion ace) { | 1029 | } catch (AccessCon trolExcept ion ace) { | |||
| 1000 | log( "socket ac cept secur ity except ion", ace) ; | 1030 | log( "socket ac cept secur ity except ion", ace) ; | |||
| 1001 | cont inue; | 1031 | cont inue; | |||
| 1002 | } catch (IOExcepti on e) { | 1032 | } catch (IOExcepti on e) { | |||
| 1003 | // if (de bug >= 3) | 1033 | // if (de bug >= 3) | |||
| 1004 | // lo g("run: Ac cept retur ned IOExce ption", e) ; | 1034 | // lo g("run: Ac cept retur ned IOExce ption", e) ; | |||
| 1005 | try { | 1035 | try { | |||
| 1036 | // If reop ening fail s, exit | |||||
| 1006 | synchroniz ed (thread Sync) { | 1037 | synchroniz ed (thread Sync) { | |||
| 1007 | if (st arted && ! stopped) | 1038 | if (st arted && ! stopped) | |||
| 1008 |
log("accep
t
|
1039 | log("accep t error : ", e); | |||
| 1009 | if (!s topped) { | 1040 | if (!s topped) { | |||
| 1010 | // if (debug >= 3) | 1041 | // if (debug >= 3) | |||
| 1011 | // log("r un: Closin g server s ocket"); | 1042 | // log("r un: Closin g server s ocket"); | |||
| 1012 | se rverSocket .close(); | 1043 | se rverSocket .close(); | |||
| 1013 | // if (de bug >= 3) | 1044 | // if (de bug >= 3) | |||
| 1014 | // lo g("run: Re opening se rver socke t"); | 1045 | // lo g("run: Re opening se rver socke t"); | |||
| 1015 | se rverSocket = open(); | 1046 | se rverSocket = open(); | |||
| 1016 | } | 1047 | } | |||
| 1017 | } | 1048 | } | |||
| 1018 | // if (debu g >= 3) | 1049 | // if (debu g >= 3) | |||
| 1019 | // log( "run: IOEx ception pr ocessing c ompleted") ; | 1050 | // log( "run: IOEx ception pr ocessing c ompleted") ; | |||
| 1020 |
}
catch
(IOExcepti
on
|
1051 |
}
catch
(IOExcepti
on
io
e
|
|||
| 1021 | // If reop ening fail s, exit | 1052 | log("socke t reopen, io problem : ", ioe); | |||
| 1022 |
log("socke
t
reopen
|
1053 | break; | |||
| 1054 | } ca tch (KeySt oreExcepti on kse) { | |||||
| 1055 | log("socke t reopen, keystore p roblem: ", kse); | |||||
| 1056 | break; | |||||
| 1057 | } ca tch (NoSuc hAlgorithm Exception nsae) { | |||||
| 1058 | log("socke t reopen, keystore a lgorithm p roblem: ", nsae); | |||||
| 1059 | break; | |||||
| 1060 | } ca tch (Certi ficateExce ption ce) { | |||||
| 1061 | log("socke t reopen, certificat e problem: ", ce); | |||||
| 1062 | break; | |||||
| 1063 | } ca tch (Unrec overableKe yException uke) { | |||||
| 1064 | log("socke t reopen, unrecovera ble key: " , uke); | |||||
| 1065 | break; | |||||
| 1066 | } ca tch (KeyMa nagementEx ception km e) { | |||||
| 1067 |
log("socke
t
reopen
,
key
management
problem
:
",
km
e
|
|||||
| 1023 | break; | 1068 | break; | |||
| 1024 | } | 1069 | } | |||
| 1070 | ||||||
| 1025 | cont inue; | 1071 | cont inue; | |||
| 1026 | } | 1072 | } | |||
| 1027 | 1073 | |||||
| 1028 | // Hand this socke t off to a n appropri ate proces sor | 1074 | // Hand this socke t off to a n appropri ate proces sor | |||
| 1029 | HttpProc essor proc essor = cr eateProces sor(); | 1075 | HttpProc essor proc essor = cr eateProces sor(); | |||
| 1030 | if (proc essor == n ull) { | 1076 | if (proc essor == n ull) { | |||
| 1031 | try { | 1077 | try { | |||
| 1032 | log(sm.get String("ht tpConnecto r.noProces sor")); | 1078 | log(sm.get String("ht tpConnecto r.noProces sor")); | |||
| 1033 | socket.clo se(); | 1079 | socket.clo se(); | |||
| 1034 | } ca tch (IOExc eption e) { | 1080 | } ca tch (IOExc eption e) { | |||
| 1035 | ; | 1081 | ; | |||
| 1036 | } | 1082 | } | |||
| 1037 | cont inue; | 1083 | cont inue; | |||
| 1038 | } | 1084 | } | |||
| 1039 | // if ( debug >= 3 ) | 1085 | // if ( debug >= 3 ) | |||
| 1040 | // log("run: Assigning socket to processor " + proces sor); | 1086 | // log("run: Assigning socket to processor " + proces sor); | |||
| 1041 | processo r.assign(s ocket); | 1087 | processo r.assign(s ocket); | |||
| 1042 | 1088 | |||||
| 1043 | // The p rocessor w ill recycl e itself w hen it fin ishes | 1089 | // The p rocessor w ill recycl e itself w hen it fin ishes | |||
| 1044 | 1090 | |||||
| 1045 | } | 1091 | } | |||
| 1046 | 1092 | |||||
| 1047 | // Notify th e threadSt op() metho d that we have shut ourselves down | 1093 | // Notify th e threadSt op() metho d that we have shut ourselves down | |||
| 1048 | // if (debug >= 3) | 1094 | // if (debug >= 3) | |||
| 1049 | // log("run : Notifyin g threadSt op() that we have sh ut down"); | 1095 | // log("run : Notifyin g threadSt op() that we have sh ut down"); | |||
| 1050 | sy nchronized (threadSy nc) { | 1096 | sy nchronized (threadSy nc) { | |||
| 1051 | threadSy nc.notifyA ll(); | 1097 | threadSy nc.notifyA ll(); | |||
| 1052 | } | 1098 | } | |||
| 1053 | 1099 | |||||
| 1054 | } | 1100 | } | |||
| 1055 | 1101 | |||||
| 1056 | 1102 | |||||
| 1057 | /** | 1103 | /** | |||
| 1058 | * Sta rt the bac kground pr ocessing t hread. | 1104 | * Sta rt the bac kground pr ocessing t hread. | |||
| 1059 | */ | 1105 | */ | |||
| 1060 | privat e void thr eadStart() { | 1106 | privat e void thr eadStart() { | |||
| 1061 | 1107 | |||||
| 1062 | lo g(sm.getSt ring("http Connector. starting") ); | 1108 | lo g(sm.getSt ring("http Connector. starting") ); | |||
| 1063 | 1109 | |||||
| 1064 | th read = new Thread(th is, thread Name); | 1110 | th read = new Thread(th is, thread Name); | |||
| 1065 | th read.setDa emon(true) ; | 1111 | th read.setDa emon(true) ; | |||
| 1066 | th read.start (); | 1112 | th read.start (); | |||
| 1067 | 1113 | |||||
| 1068 | } | 1114 | } | |||
| 1069 | 1115 | |||||
| 1070 | 1116 | |||||
| 1071 | /** | 1117 | /** | |||
| 1072 | * Sto p the back ground pro cessing th read. | 1118 | * Sto p the back ground pro cessing th read. | |||
| 1073 | */ | 1119 | */ | |||
| 1074 | privat e void thr eadStop() { | 1120 | privat e void thr eadStop() { | |||
| 1075 | 1121 | |||||
| 1076 | lo g(sm.getSt ring("http Connector. stopping") ); | 1122 | lo g(sm.getSt ring("http Connector. stopping") ); | |||
| 1077 | 1123 | |||||
| 1078 | st opped = tr ue; | 1124 | st opped = tr ue; | |||
| 1079 | tr y { | 1125 | tr y { | |||
| 1080 | threadSy nc.wait(50 00); | 1126 | threadSy nc.wait(50 00); | |||
| 1081 | } catch (Int erruptedEx ception e) { | 1127 | } catch (Int erruptedEx ception e) { | |||
| 1082 | ; | 1128 | ; | |||
| 1083 | } | 1129 | } | |||
| 1084 | th read = nul l; | 1130 | th read = nul l; | |||
| 1085 | 1131 | |||||
| 1086 | } | 1132 | } | |||
| 1087 | 1133 | |||||
| 1088 | 1134 | |||||
| 1089 | // --- ---------- ---------- ---------- ---------- ---------- - Lifecycl e Methods | 1135 | // --- ---------- ---------- ---------- ---------- ---------- - Lifecycl e Methods | |||
| 1090 | 1136 | |||||
| 1091 | 1137 | |||||
| 1092 | /** | 1138 | /** | |||
| 1093 | * Add a lifecyc le event l istener to this comp onent. | 1139 | * Add a lifecyc le event l istener to this comp onent. | |||
| 1094 | * | 1140 | * | |||
| 1095 | * @pa ram listen er The lis tener to a dd | 1141 | * @pa ram listen er The lis tener to a dd | |||
| 1096 | */ | 1142 | */ | |||
| 1097 | public void addL ifecycleLi stener(Lif ecycleList ener liste ner) { | 1143 | public void addL ifecycleLi stener(Lif ecycleList ener liste ner) { | |||
| 1098 | 1144 | |||||
| 1099 | li fecycle.ad dLifecycle Listener(l istener); | 1145 | li fecycle.ad dLifecycle Listener(l istener); | |||
| 1100 | 1146 | |||||
| 1101 | } | 1147 | } | |||
| 1102 | 1148 | |||||
| 1103 | 1149 | |||||
| 1104 | /** | 1150 | /** | |||
| 1151 | * Get the lifec ycle liste ners assoc iated with this life cycle. If this | |||||
| 1152 | * Lif ecycle has no listen ers regist ered, a ze ro-length array is r eturned. | |||||
| 1153 | */ | |||||
| 1154 | public Lifecycle Listener[] findLifec ycleListen ers() { | |||||
| 1155 | ||||||
| 1156 | re turn lifec ycle.findL ifecycleLi steners(); | |||||
| 1157 | ||||||
| 1158 | } | |||||
| 1159 | ||||||
| 1160 | ||||||
| 1161 | /** | |||||
| 1105 | * Rem ove a life cycle even t listener from this component . | 1162 | * Rem ove a life cycle even t listener from this component . | |||
| 1106 | * | 1163 | * | |||
| 1107 | * @pa ram listen er The lis tener to a dd | 1164 | * @pa ram listen er The lis tener to a dd | |||
| 1108 | */ | 1165 | */ | |||
| 1109 | public void remo veLifecycl eListener( LifecycleL istener li stener) { | 1166 | public void remo veLifecycl eListener( LifecycleL istener li stener) { | |||
| 1110 | 1167 | |||||
| 1111 | li fecycle.re moveLifecy cleListene r(listener ); | 1168 | li fecycle.re moveLifecy cleListene r(listener ); | |||
| 1112 | 1169 | |||||
| 1113 | } | 1170 | } | |||
| 1114 | 1171 | |||||
| 1115 | 1172 | |||||
| 1116 | /** | 1173 | /** | |||
| 1117 | * Ini tialize th is connect or (create ServerSoc ket here!) | 1174 | * Ini tialize th is connect or (create ServerSoc ket here!) | |||
| 1118 | */ | 1175 | */ | |||
| 1119 | public void init ialize() | 1176 | public void init ialize() | |||
| 1120 | throws Lifecycle Exception { | 1177 | throws Lifecycle Exception { | |||
| 1121 | if (initiali zed) | 1178 | if (initiali zed) | |||
| 1122 | throw ne w Lifecycl eException ( | 1179 | throw ne w Lifecycl eException ( | |||
| 1123 | sm.g etString(" httpConnec tor.alread yInitializ ed")); | 1180 | sm.g etString(" httpConnec tor.alread yInitializ ed")); | |||
| 1181 | ||||||
| 1124 | th is.initial ized=true; | 1182 | th is.initial ized=true; | |||
| 1183 | Ex ception eR ethrow = n ull; | |||||
| 1125 | 1184 | |||||
| 1126 | // Establish a server socket on the specif ied port | 1185 | // Establish a server socket on the specif ied port | |||
| 1127 | tr y { | 1186 | tr y { | |||
| 1128 | serverSo cket = ope n(); | 1187 | serverSo cket = ope n(); | |||
| 1129 |
}
catch
(IOExcepti
on
|
1188 | } catch (IOExcepti on io e) { | |||
| 1130 | throw ne w Lifecycl eException (threadNam e + ".open ", e); | 1189 | log("htt pConnector , io probl em: ", ioe ); | |||
| 1190 | eRethrow = ioe; | |||||
| 1191 | } catch (Key StoreExcep tion kse) { | |||||
| 1192 | log("htt pConnector , keystore problem: ", kse); | |||||
| 1193 | eRethrow = kse; | |||||
| 1194 | } catch (NoS uchAlgorit hmExceptio n nsae) { | |||||
| 1195 | log("htt pConnector , keystore algorithm problem: ", nsae); | |||||
| 1196 | eRethrow = nsae; | |||||
| 1197 | } catch (Cer tificateEx ception ce ) { | |||||
| 1198 | log("htt pConnector , certific ate proble m: ", ce); | |||||
| 1199 | eRethrow = ce; | |||||
| 1200 | } catch (Unr ecoverable KeyExcepti on uke) { | |||||
| 1201 | log("htt pConnector , unrecove rable key: ", uke); | |||||
| 1202 | eRethrow = uke; | |||||
| 1203 | } catch (Key Management Exception kme) { | |||||
| 1204 | log("htt pConnector , key mana gement pro blem: ", k me); | |||||
| 1205 | eRethrow = kme; | |||||
| 1131 | } | 1206 | } | |||
| 1132 | 1207 | |||||
| 1208 | if ( eRethro w != null ) | |||||
| 1209 | throw ne w Lifecycl eException (threadNam e + ".open ", eRethro w); | |||||
| 1210 | ||||||
| 1133 | } | 1211 | } | |||
| 1134 | 1212 | |||||
| 1135 | 1213 | |||||
| 1136 | /** | 1214 | /** | |||
| 1137 | * Beg in process ing reques ts via thi s Connecto r. | 1215 | * Beg in process ing reques ts via thi s Connecto r. | |||
| 1138 | * | 1216 | * | |||
| 1139 | * @ex ception Li fecycleExc eption if a fatal st artup erro r occurs | 1217 | * @ex ception Li fecycleExc eption if a fatal st artup erro r occurs | |||
| 1140 | */ | 1218 | */ | |||
| 1141 | public void star t() throws Lifecycle Exception { | 1219 | public void star t() throws Lifecycle Exception { | |||
| 1142 | 1220 | |||||
| 1143 | // Validate and update our curre nt state | 1221 | // Validate and update our curre nt state | |||
| 1144 | if (started) | 1222 | if (started) | |||
| 1145 | throw ne w Lifecycl eException | 1223 | throw ne w Lifecycl eException | |||
| 1146 | (sm. getString( "httpConne ctor.alrea dyStarted" )); | 1224 | (sm. getString( "httpConne ctor.alrea dyStarted" )); | |||
| 1147 | th readName = "HttpConn ector[" + port + "]" ; | 1225 | th readName = "HttpConn ector[" + port + "]" ; | |||
| 1148 | li fecycle.fi reLifecycl eEvent(STA RT_EVENT, null); | 1226 | li fecycle.fi reLifecycl eEvent(STA RT_EVENT, null); | |||
| 1149 | st arted = tr ue; | 1227 | st arted = tr ue; | |||
| 1150 | 1228 | |||||
| 1151 | // Start our backgroun d thread | 1229 | // Start our backgroun d thread | |||
| 1152 | th readStart( ); | 1230 | th readStart( ); | |||
| 1153 | 1231 | |||||
| 1154 | // Create th e specifie d minimum number of processors | 1232 | // Create th e specifie d minimum number of processors | |||
| 1155 | wh ile (curPr ocessors < minProces sors) { | 1233 | wh ile (curPr ocessors < minProces sors) { | |||
| 1156 | if ((max Processors > 0) && ( curProcess ors >= max Processors )) | 1234 | if ((max Processors > 0) && ( curProcess ors >= max Processors )) | |||
| 1157 | brea k; | 1235 | brea k; | |||
| 1158 | HttpProc essor proc essor = ne wProcessor (); | 1236 | HttpProc essor proc essor = ne wProcessor (); | |||
| 1159 | recycle( processor) ; | 1237 | recycle( processor) ; | |||
| 1160 | } | 1238 | } | |||
| 1161 | 1239 | |||||
| 1162 | } | 1240 | } | |||
| 1163 | 1241 | |||||
| 1164 | 1242 | |||||
| 1165 | /** | 1243 | /** | |||
| 1166 | * Ter minate pro cessing re quests via this Conn ector. | 1244 | * Ter minate pro cessing re quests via this Conn ector. | |||
| 1167 | * | 1245 | * | |||
| 1168 | * @ex ception Li fecycleExc eption if a fatal sh utdown err or occurs | 1246 | * @ex ception Li fecycleExc eption if a fatal sh utdown err or occurs | |||
| 1169 | */ | 1247 | */ | |||
| 1170 | public void stop () throws LifecycleE xception { | 1248 | public void stop () throws LifecycleE xception { | |||
| 1171 | 1249 | |||||
| 1172 | // Validate and update our curre nt state | 1250 | // Validate and update our curre nt state | |||
| 1173 | if (!started ) | 1251 | if (!started ) | |||
| 1174 | throw ne w Lifecycl eException | 1252 | throw ne w Lifecycl eException | |||
| 1175 | (sm. getString( "httpConne ctor.notSt arted")); | 1253 | (sm. getString( "httpConne ctor.notSt arted")); | |||
| 1176 | li fecycle.fi reLifecycl eEvent(STO P_EVENT, n ull); | 1254 | li fecycle.fi reLifecycl eEvent(STO P_EVENT, n ull); | |||
| 1177 | st arted = fa lse; | 1255 | st arted = fa lse; | |||
| 1178 | 1256 | |||||
| 1179 | // Gracefull y shut dow n all proc essors we have creat ed | 1257 | // Gracefull y shut dow n all proc essors we have creat ed | |||
| 1180 | fo r (int i = created.s ize() - 1; i >= 0; i --) { | 1258 | fo r (int i = created.s ize() - 1; i >= 0; i --) { | |||
| (28 unchanged lines omitted) | ||||||
Araxis Merge (but not this generated report) is Copyright © 1993-2005 Araxis Ltd (www.araxis.com). All rights reserved.