KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > coyote > http11 > Http11AprProtocol


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.coyote.http11;
19
20 import java.net.InetAddress JavaDoc;
21 import java.net.URLEncoder JavaDoc;
22 import java.util.Hashtable JavaDoc;
23 import java.util.Iterator JavaDoc;
24 import java.util.concurrent.ConcurrentHashMap JavaDoc;
25 import java.util.concurrent.Executor JavaDoc;
26
27 import javax.management.MBeanRegistration JavaDoc;
28 import javax.management.MBeanServer JavaDoc;
29 import javax.management.ObjectName JavaDoc;
30
31 import org.apache.coyote.ActionCode;
32 import org.apache.coyote.ActionHook;
33 import org.apache.coyote.Adapter;
34 import org.apache.coyote.ProtocolHandler;
35 import org.apache.coyote.RequestGroupInfo;
36 import org.apache.coyote.RequestInfo;
37 import org.apache.tomcat.util.modeler.Registry;
38 import org.apache.tomcat.util.net.AprEndpoint;
39 import org.apache.tomcat.util.net.SocketStatus;
40 import org.apache.tomcat.util.net.AprEndpoint.Handler;
41 import org.apache.tomcat.util.res.StringManager;
42
43
44 /**
45  * Abstract the protocol implementation, including threading, etc.
46  * Processor is single threaded and specific to stream-based protocols,
47  * will not fit Jk protocols like JNI.
48  *
49  * @author Remy Maucherat
50  * @author Costin Manolache
51  */

52 public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration JavaDoc
53 {
54     public Http11AprProtocol() {
55         cHandler = new Http11ConnectionHandler( this );
56         setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
57         setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
58         //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
59
setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
60     }
61
62     /**
63      * The string manager for this package.
64      */

65     protected static StringManager sm =
66         StringManager.getManager(Constants.Package);
67
68     /** Pass config info
69      */

70     public void setAttribute( String JavaDoc name, Object JavaDoc value ) {
71         if( log.isTraceEnabled())
72             log.trace(sm.getString("http11protocol.setattribute", name, value));
73
74         attributes.put(name, value);
75     }
76
77     public Object JavaDoc getAttribute( String JavaDoc key ) {
78         if( log.isTraceEnabled())
79             log.trace(sm.getString("http11protocol.getattribute", key));
80         return attributes.get(key);
81     }
82
83     public Iterator JavaDoc getAttributeNames() {
84         return attributes.keySet().iterator();
85     }
86
87     /**
88      * Set a property.
89      */

90     public void setProperty(String JavaDoc name, String JavaDoc value) {
91         setAttribute(name, value);
92     }
93
94     /**
95      * Get a property
96      */

97     public String JavaDoc getProperty(String JavaDoc name) {
98         return (String JavaDoc)getAttribute(name);
99     }
100
101     /** The adapter, used to call the connector
102      */

103     public void setAdapter(Adapter adapter) {
104         this.adapter=adapter;
105     }
106
107     public Adapter getAdapter() {
108         return adapter;
109     }
110
111
112     /** Start the protocol
113      */

114     public void init() throws Exception JavaDoc {
115         ep.setName(getName());
116         ep.setHandler(cHandler);
117
118         try {
119             ep.init();
120         } catch (Exception JavaDoc ex) {
121             log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
122             throw ex;
123         }
124         if(log.isInfoEnabled())
125             log.info(sm.getString("http11protocol.init", getName()));
126
127     }
128
129     ObjectName JavaDoc tpOname;
130     ObjectName JavaDoc rgOname;
131
132     public void start() throws Exception JavaDoc {
133         if( this.domain != null ) {
134             try {
135                 tpOname=new ObjectName JavaDoc
136                     (domain + ":" + "type=ThreadPool,name=" + getName());
137                 Registry.getRegistry(null, null)
138                 .registerComponent(ep, tpOname, null );
139             } catch (Exception JavaDoc e) {
140                 log.error("Can't register threadpool" );
141             }
142             rgOname=new ObjectName JavaDoc
143                 (domain + ":type=GlobalRequestProcessor,name=" + getName());
144             Registry.getRegistry(null, null).registerComponent
145                 ( cHandler.global, rgOname, null );
146         }
147
148         try {
149             ep.start();
150         } catch (Exception JavaDoc ex) {
151             log.error(sm.getString("http11protocol.endpoint.starterror"), ex);
152             throw ex;
153         }
154         if(log.isInfoEnabled())
155             log.info(sm.getString("http11protocol.start", getName()));
156     }
157
158     public void pause() throws Exception JavaDoc {
159         try {
160             ep.pause();
161         } catch (Exception JavaDoc ex) {
162             log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex);
163             throw ex;
164         }
165         if(log.isInfoEnabled())
166             log.info(sm.getString("http11protocol.pause", getName()));
167     }
168
169     public void resume() throws Exception JavaDoc {
170         try {
171             ep.resume();
172         } catch (Exception JavaDoc ex) {
173             log.error(sm.getString("http11protocol.endpoint.resumeerror"), ex);
174             throw ex;
175         }
176         if(log.isInfoEnabled())
177             log.info(sm.getString("http11protocol.resume", getName()));
178     }
179
180     public void destroy() throws Exception JavaDoc {
181         if(log.isInfoEnabled())
182             log.info(sm.getString("http11protocol.stop", getName()));
183         ep.destroy();
184         if( tpOname!=null )
185             Registry.getRegistry(null, null).unregisterComponent(tpOname);
186         if( rgOname != null )
187             Registry.getRegistry(null, null).unregisterComponent(rgOname);
188     }
189
190     // -------------------- Properties--------------------
191
protected AprEndpoint ep=new AprEndpoint();
192     protected boolean secure;
193
194     protected Hashtable JavaDoc attributes = new Hashtable JavaDoc();
195
196     private int maxKeepAliveRequests=100; // as in Apache HTTPD server
197
private int timeout = 300000; // 5 minutes as in Apache HTTPD server
198
private int maxSavePostSize = 4 * 1024;
199     private int maxHttpHeaderSize = 8 * 1024;
200     private int socketCloseDelay=-1;
201     private boolean disableUploadTimeout = true;
202     private int socketBuffer = 9000;
203     private Adapter adapter;
204     private Http11ConnectionHandler cHandler;
205
206     /**
207      * Compression value.
208      */

209     private String JavaDoc compression = "off";
210     private String JavaDoc noCompressionUserAgents = null;
211     private String JavaDoc restrictedUserAgents = null;
212     private String JavaDoc compressableMimeTypes = "text/html,text/xml,text/plain";
213     private int compressionMinSize = 2048;
214
215     private String JavaDoc server;
216
217     // -------------------- Pool setup --------------------
218

219     // *
220
public Executor JavaDoc getExecutor() {
221         return ep.getExecutor();
222     }
223     
224     // *
225
public void setExecutor(Executor JavaDoc executor) {
226         ep.setExecutor(executor);
227     }
228     
229     public int getMaxThreads() {
230         return ep.getMaxThreads();
231     }
232
233     public void setMaxThreads( int maxThreads ) {
234         ep.setMaxThreads(maxThreads);
235         setAttribute("maxThreads", "" + maxThreads);
236     }
237
238     public void setThreadPriority(int threadPriority) {
239       ep.setThreadPriority(threadPriority);
240       setAttribute("threadPriority", "" + threadPriority);
241     }
242
243     public int getThreadPriority() {
244       return ep.getThreadPriority();
245     }
246
247     // -------------------- Tcp setup --------------------
248

249     public int getBacklog() {
250         return ep.getBacklog();
251     }
252
253     public void setBacklog( int i ) {
254         ep.setBacklog(i);
255         setAttribute("backlog", "" + i);
256     }
257
258     public int getPort() {
259         return ep.getPort();
260     }
261
262     public void setPort( int port ) {
263         ep.setPort(port);
264         setAttribute("port", "" + port);
265     }
266
267     public int getFirstReadTimeout() {
268         return ep.getFirstReadTimeout();
269     }
270
271     public void setFirstReadTimeout( int i ) {
272         ep.setFirstReadTimeout(i);
273         setAttribute("firstReadTimeout", "" + i);
274     }
275
276     public int getPollTime() {
277         return ep.getPollTime();
278     }
279
280     public void setPollTime( int i ) {
281         ep.setPollTime(i);
282         setAttribute("pollTime", "" + i);
283     }
284
285     public void setPollerSize(int i) {
286         ep.setPollerSize(i);
287         setAttribute("pollerSize", "" + i);
288     }
289     
290     public int getPollerSize() {
291         return ep.getPollerSize();
292     }
293     
294     public void setSendfileSize(int i) {
295         ep.setSendfileSize(i);
296         setAttribute("sendfileSize", "" + i);
297     }
298     
299     public int getSendfileSize() {
300         return ep.getSendfileSize();
301     }
302     
303     public boolean getUseSendfile() {
304         return ep.getUseSendfile();
305     }
306
307     public void setUseSendfile(boolean useSendfile) {
308         ep.setUseSendfile(useSendfile);
309     }
310
311     public InetAddress JavaDoc getAddress() {
312         return ep.getAddress();
313     }
314
315     public void setAddress(InetAddress JavaDoc ia) {
316         ep.setAddress( ia );
317         setAttribute("address", "" + ia);
318     }
319
320     public String JavaDoc getName() {
321         String JavaDoc encodedAddr = "";
322         if (getAddress() != null) {
323             encodedAddr = "" + getAddress();
324             if (encodedAddr.startsWith("/"))
325                 encodedAddr = encodedAddr.substring(1);
326             encodedAddr = URLEncoder.encode(encodedAddr) + "-";
327         }
328         return ("http-" + encodedAddr + ep.getPort());
329     }
330
331     public boolean getTcpNoDelay() {
332         return ep.getTcpNoDelay();
333     }
334
335     public void setTcpNoDelay( boolean b ) {
336         ep.setTcpNoDelay( b );
337         setAttribute("tcpNoDelay", "" + b);
338     }
339
340     public boolean getDisableUploadTimeout() {
341         return disableUploadTimeout;
342     }
343
344     public void setDisableUploadTimeout(boolean isDisabled) {
345         disableUploadTimeout = isDisabled;
346     }
347
348     public int getSocketBuffer() {
349         return socketBuffer;
350     }
351
352     public void setSocketBuffer(int valueI) {
353         socketBuffer = valueI;
354     }
355
356     public String JavaDoc getCompression() {
357         return compression;
358     }
359
360     public void setCompression(String JavaDoc valueS) {
361         compression = valueS;
362         setAttribute("compression", valueS);
363     }
364
365     public int getMaxSavePostSize() {
366         return maxSavePostSize;
367     }
368
369     public void setMaxSavePostSize(int valueI) {
370         maxSavePostSize = valueI;
371         setAttribute("maxSavePostSize", "" + valueI);
372     }
373
374     public int getMaxHttpHeaderSize() {
375         return maxHttpHeaderSize;
376     }
377
378     public void setMaxHttpHeaderSize(int valueI) {
379         maxHttpHeaderSize = valueI;
380         setAttribute("maxHttpHeaderSize", "" + valueI);
381     }
382
383     public String JavaDoc getRestrictedUserAgents() {
384         return restrictedUserAgents;
385     }
386
387     public void setRestrictedUserAgents(String JavaDoc valueS) {
388         restrictedUserAgents = valueS;
389         setAttribute("restrictedUserAgents", valueS);
390     }
391
392     public String JavaDoc getNoCompressionUserAgents() {
393         return noCompressionUserAgents;
394     }
395
396     public void setNoCompressionUserAgents(String JavaDoc valueS) {
397         noCompressionUserAgents = valueS;
398         setAttribute("noCompressionUserAgents", valueS);
399     }
400
401     public String JavaDoc getCompressableMimeType() {
402         return compressableMimeTypes;
403     }
404
405     public void setCompressableMimeType(String JavaDoc valueS) {
406         compressableMimeTypes = valueS;
407         setAttribute("compressableMimeTypes", valueS);
408     }
409
410     public int getCompressionMinSize() {
411         return compressionMinSize;
412     }
413
414     public void setCompressionMinSize(int valueI) {
415         compressionMinSize = valueI;
416         setAttribute("compressionMinSize", "" + valueI);
417     }
418
419     public int getSoLinger() {
420         return ep.getSoLinger();
421     }
422
423     public void setSoLinger( int i ) {
424         ep.setSoLinger( i );
425         setAttribute("soLinger", "" + i);
426     }
427
428     public int getSoTimeout() {
429         return ep.getSoTimeout();
430     }
431
432     public void setSoTimeout( int i ) {
433         ep.setSoTimeout(i);
434         setAttribute("soTimeout", "" + i);
435     }
436
437     public String JavaDoc getProtocol() {
438         return getProperty("protocol");
439     }
440
441     public void setProtocol( String JavaDoc k ) {
442         setSecure(true);
443         setAttribute("protocol", k);
444     }
445
446     public boolean getSecure() {
447         return secure;
448     }
449
450     public void setSecure( boolean b ) {
451         secure=b;
452         setAttribute("secure", "" + b);
453     }
454
455     public int getMaxKeepAliveRequests() {
456         return maxKeepAliveRequests;
457     }
458
459     /** Set the maximum number of Keep-Alive requests that we will honor.
460      */

461     public void setMaxKeepAliveRequests(int mkar) {
462         maxKeepAliveRequests = mkar;
463         setAttribute("maxKeepAliveRequests", "" + mkar);
464     }
465
466     /**
467      * Return the Keep-Alive policy for the connection.
468      */

469     public boolean getKeepAlive() {
470         return ((maxKeepAliveRequests != 0) && (maxKeepAliveRequests != 1));
471     }
472
473     /**
474      * Set the keep-alive policy for this connection.
475      */

476     public void setKeepAlive(boolean keepAlive) {
477         if (!keepAlive) {
478             setMaxKeepAliveRequests(1);
479         }
480     }
481
482     public int getSocketCloseDelay() {
483         return socketCloseDelay;
484     }
485
486     public void setSocketCloseDelay( int d ) {
487         socketCloseDelay=d;
488         setAttribute("socketCloseDelay", "" + d);
489     }
490
491     public void setServer( String JavaDoc server ) {
492         this.server = server;
493     }
494
495     public String JavaDoc getServer() {
496         return server;
497     }
498
499     public int getTimeout() {
500         return timeout;
501     }
502
503     public void setTimeout( int timeouts ) {
504         timeout = timeouts;
505         setAttribute("timeout", "" + timeouts);
506     }
507
508     // -------------------- SSL related properties --------------------
509

510     /**
511      * SSL engine.
512      */

513     public boolean isSSLEnabled() { return ep.isSSLEnabled(); }
514     public void setSSLEnabled(boolean SSLEnabled) { ep.setSSLEnabled(SSLEnabled); }
515
516
517     /**
518      * SSL protocol.
519      */

520     public String JavaDoc getSSLProtocol() { return ep.getSSLProtocol(); }
521     public void setSSLProtocol(String JavaDoc SSLProtocol) { ep.setSSLProtocol(SSLProtocol); }
522
523
524     /**
525      * SSL password (if a cert is encrypted, and no password has been provided, a callback
526      * will ask for a password).
527      */

528     public String JavaDoc getSSLPassword() { return ep.getSSLPassword(); }
529     public void setSSLPassword(String JavaDoc SSLPassword) { ep.setSSLPassword(SSLPassword); }
530
531
532     /**
533      * SSL cipher suite.
534      */

535     public String JavaDoc getSSLCipherSuite() { return ep.getSSLCipherSuite(); }
536     public void setSSLCipherSuite(String JavaDoc SSLCipherSuite) { ep.setSSLCipherSuite(SSLCipherSuite); }
537
538
539     /**
540      * SSL certificate file.
541      */

542     public String JavaDoc getSSLCertificateFile() { return ep.getSSLCertificateFile(); }
543     public void setSSLCertificateFile(String JavaDoc SSLCertificateFile) { ep.setSSLCertificateFile(SSLCertificateFile); }
544
545
546     /**
547      * SSL certificate key file.
548      */

549     public String JavaDoc getSSLCertificateKeyFile() { return ep.getSSLCertificateKeyFile(); }
550     public void setSSLCertificateKeyFile(String JavaDoc SSLCertificateKeyFile) { ep.setSSLCertificateKeyFile(SSLCertificateKeyFile); }
551
552
553     /**
554      * SSL certificate chain file.
555      */

556     public String JavaDoc getSSLCertificateChainFile() { return ep.getSSLCertificateChainFile(); }
557     public void setSSLCertificateChainFile(String JavaDoc SSLCertificateChainFile) { ep.setSSLCertificateChainFile(SSLCertificateChainFile); }
558
559
560     /**
561      * SSL CA certificate path.
562      */

563     public String JavaDoc getSSLCACertificatePath() { return ep.getSSLCACertificatePath(); }
564     public void setSSLCACertificatePath(String JavaDoc SSLCACertificatePath) { ep.setSSLCACertificatePath(SSLCACertificatePath); }
565
566
567     /**
568      * SSL CA certificate file.
569      */

570     public String JavaDoc getSSLCACertificateFile() { return ep.getSSLCACertificateFile(); }
571     public void setSSLCACertificateFile(String JavaDoc SSLCACertificateFile) { ep.setSSLCACertificateFile(SSLCACertificateFile); }
572
573
574     /**
575      * SSL CA revocation path.
576      */

577     public String JavaDoc getSSLCARevocationPath() { return ep.getSSLCARevocationPath(); }
578     public void setSSLCARevocationPath(String JavaDoc SSLCARevocationPath) { ep.setSSLCARevocationPath(SSLCARevocationPath); }
579
580
581     /**
582      * SSL CA revocation file.
583      */

584     public String JavaDoc getSSLCARevocationFile() { return ep.getSSLCARevocationFile(); }
585     public void setSSLCARevocationFile(String JavaDoc SSLCARevocationFile) { ep.setSSLCARevocationFile(SSLCARevocationFile); }
586
587
588     /**
589      * SSL verify client.
590      */

591     public String JavaDoc getSSLVerifyClient() { return ep.getSSLVerifyClient(); }
592     public void setSSLVerifyClient(String JavaDoc SSLVerifyClient) { ep.setSSLVerifyClient(SSLVerifyClient); }
593
594
595     /**
596      * SSL verify depth.
597      */

598     public int getSSLVerifyDepth() { return ep.getSSLVerifyDepth(); }
599     public void setSSLVerifyDepth(int SSLVerifyDepth) { ep.setSSLVerifyDepth(SSLVerifyDepth); }
600
601     // -------------------- Connection handler --------------------
602

603     static class Http11ConnectionHandler implements Handler {
604         
605         protected Http11AprProtocol proto;
606         protected static int count = 0;
607         protected RequestGroupInfo global = new RequestGroupInfo();
608         
609         protected ThreadLocal JavaDoc<Http11AprProcessor> localProcessor =
610             new ThreadLocal JavaDoc<Http11AprProcessor>();
611         protected ConcurrentHashMap JavaDoc<Long JavaDoc, Http11AprProcessor> connections =
612             new ConcurrentHashMap JavaDoc<Long JavaDoc, Http11AprProcessor>();
613         protected java.util.Stack JavaDoc<Http11AprProcessor> recycledProcessors =
614             new java.util.Stack JavaDoc<Http11AprProcessor>();
615
616         Http11ConnectionHandler(Http11AprProtocol proto) {
617             this.proto = proto;
618         }
619
620         public SocketState event(long socket, SocketStatus status) {
621             Http11AprProcessor result = connections.get(socket);
622             
623             SocketState state = SocketState.CLOSED;
624             if (result != null) {
625                 // Call the appropriate event
626
try {
627                     state = result.event(status);
628                 } catch (java.net.SocketException JavaDoc e) {
629                     // SocketExceptions are normal
630
Http11AprProtocol.log.debug
631                         (sm.getString
632                             ("http11protocol.proto.socketexception.debug"), e);
633                 } catch (java.io.IOException JavaDoc e) {
634                     // IOExceptions are normal
635
Http11AprProtocol.log.debug
636                         (sm.getString
637                             ("http11protocol.proto.ioexception.debug"), e);
638                 }
639                 // Future developers: if you discover any other
640
// rare-but-nonfatal exceptions, catch them here, and log as
641
// above.
642
catch (Throwable JavaDoc e) {
643                     // any other exception or error is odd. Here we log it
644
// with "ERROR" level, so it will show up even on
645
// less-than-verbose logs.
646
Http11AprProtocol.log.error
647                         (sm.getString("http11protocol.proto.error"), e);
648                 } finally {
649                     if (state != SocketState.LONG) {
650                         connections.remove(socket);
651                         recycledProcessors.push(result);
652                     }
653                 }
654             }
655             return state;
656         }
657         
658         public SocketState process(long socket) {
659             Http11AprProcessor processor = null;
660             try {
661                 processor = (Http11AprProcessor) localProcessor.get();
662                 if (processor == null) {
663                     synchronized (recycledProcessors) {
664                         if (!recycledProcessors.isEmpty()) {
665                             processor = recycledProcessors.pop();
666                             localProcessor.set(processor);
667                         }
668                     }
669                 }
670                 if (processor == null) {
671                     processor =
672                         new Http11AprProcessor(proto.maxHttpHeaderSize, proto.ep);
673                     processor.setAdapter(proto.adapter);
674                     processor.setMaxKeepAliveRequests(proto.maxKeepAliveRequests);
675                     processor.setTimeout(proto.timeout);
676                     processor.setDisableUploadTimeout(proto.disableUploadTimeout);
677                     processor.setCompression(proto.compression);
678                     processor.setCompressionMinSize(proto.compressionMinSize);
679                     processor.setNoCompressionUserAgents(proto.noCompressionUserAgents);
680                     processor.setCompressableMimeTypes(proto.compressableMimeTypes);
681                     processor.setRestrictedUserAgents(proto.restrictedUserAgents);
682                     processor.setSocketBuffer(proto.socketBuffer);
683                     processor.setMaxSavePostSize(proto.maxSavePostSize);
684                     processor.setServer(proto.server);
685                     localProcessor.set(processor);
686                     if (proto.getDomain() != null) {
687                         synchronized (this) {
688                             try {
689                                 RequestInfo rp = processor.getRequest().getRequestProcessor();
690                                 rp.setGlobalProcessor(global);
691                                 ObjectName JavaDoc rpName = new ObjectName JavaDoc
692                                 (proto.getDomain() + ":type=RequestProcessor,worker="
693                                         + proto.getName() + ",name=HttpRequest" + count++);
694                                 Registry.getRegistry(null, null).registerComponent(rp, rpName, null);
695                             } catch (Exception JavaDoc e) {
696                                 log.warn("Error registering request");
697                             }
698                         }
699                     }
700                 }
701
702                 if (processor instanceof ActionHook) {
703                     ((ActionHook) processor).action(ActionCode.ACTION_START, null);
704                 }
705
706                 SocketState state = processor.process(socket);
707                 if (state == SocketState.LONG) {
708                     // Associate the connection with the processor. The next request
709
// processed by this thread will use either a new or a recycled
710
// processor.
711
connections.put(socket, processor);
712                     localProcessor.set(null);
713                     proto.ep.getCometPoller().add(socket);
714                 }
715                 return state;
716
717             } catch (java.net.SocketException JavaDoc e) {
718                 // SocketExceptions are normal
719
Http11AprProtocol.log.debug
720                     (sm.getString
721                      ("http11protocol.proto.socketexception.debug"), e);
722             } catch (java.io.IOException JavaDoc e) {
723                 // IOExceptions are normal
724
Http11AprProtocol.log.debug
725                     (sm.getString
726                      ("http11protocol.proto.ioexception.debug"), e);
727             }
728             // Future developers: if you discover any other
729
// rare-but-nonfatal exceptions, catch them here, and log as
730
// above.
731
catch (Throwable JavaDoc e) {
732                 // any other exception or error is odd. Here we log it
733
// with "ERROR" level, so it will show up even on
734
// less-than-verbose logs.
735
Http11AprProtocol.log.error
736                     (sm.getString("http11protocol.proto.error"), e);
737             }
738             return SocketState.CLOSED;
739         }
740     }
741
742     protected static org.apache.commons.logging.Log log
743         = org.apache.commons.logging.LogFactory.getLog(Http11AprProtocol.class);
744
745     // -------------------- Various implementation classes --------------------
746

747     protected String JavaDoc domain;
748     protected ObjectName JavaDoc oname;
749     protected MBeanServer JavaDoc mserver;
750
751     public ObjectName JavaDoc getObjectName() {
752         return oname;
753     }
754
755     public String JavaDoc getDomain() {
756         return domain;
757     }
758
759     public ObjectName JavaDoc preRegister(MBeanServer JavaDoc server,
760                                   ObjectName JavaDoc name) throws Exception JavaDoc {
761         oname=name;
762         mserver=server;
763         domain=name.getDomain();
764         return name;
765     }
766
767     public void postRegister(Boolean JavaDoc registrationDone) {
768     }
769
770     public void preDeregister() throws Exception JavaDoc {
771     }
772
773     public void postDeregister() {
774     }
775 }
776
Popular Tags