Source Code Cross Referenced for PipelineHandlerFactory.java in  » Web-Server » simple » simple » http » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » simple » simple.http 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * PipelineHandlerFactory.java February 2001
003:         *
004:         * Copyright (C) 2001, Niall Gallagher <niallg@users.sf.net>
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
013:         * GNU Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General 
016:         * Public License along with this library; if not, write to the 
017:         * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
018:         * Boston, MA  02111-1307  USA
019:         */
020:
021:        package simple.http;
022:
023:        /**
024:         * The <code>PipelineHandlerFactory</code> is used to hide a specific 
025:         * implementation of the <code>PipelineHandler</code> used. This allows 
026:         * a user of this to get access to a <code>PipelineHandler</code> using 
027:         * an implementation of a <code>ProtocolHandler</code>. 
028:         * <p>
029:         * This will create an instance of a <code>PipelineHandler</code> to 
030:         * process any incomming <code>Pipeline</code>'s from a user. This will
031:         * will multiplex <code>Pipeline</code>'s and read requests from the 
032:         * <code>Pipeline</code>'s generating <code>Request</code> objects and
033:         * <code>Response</code> objects which will then be passed to the 
034:         * <code>ProtocolHandler</code> implementation provided.
035:         * 
036:         * @author Niall Gallagher
037:         */
038:        public final class PipelineHandlerFactory {
039:
040:            /**
041:             * The default number of polling threads for a handler object. 
042:             */
043:            private static final int DEFAULT_POLLERS = 20;
044:
045:            /**
046:             * The default maximum waiting time between polls of the input.
047:             */
048:            private static final int DEFAULT_WAIT = 1000;
049:
050:            /**
051:             * This will create an instance of a <code>PipelineHandler</code>
052:             * object for processing <code>Pipeline</code> objects using an
053:             * instance of the <code>ProtocolHandler</code>. This uses defaults
054:             * for the <code>PipelineHandler</code> created. Specifics can be 
055:             * specified by using the overloaded getinstance method. The job
056:             * of the <code>PipelineHandler</code> once it has been created is
057:             * to read HTTP requests from <code>Pipeline</code>'s passed to it.
058:             * These transactions will be used to generate <code>Request</code>
059:             * and <code>Resposne</code> objects.
060:             * <p>
061:             * This will create a <code>PipelineHandler</code> to handle any 
062:             * connected <code>Pipeline</code>'s. This handler will poll the 
063:             * <code>Pipeline</code>'s <code>InputStream</code> so that there
064:             * is no blocking, this will use an exponential backoff so that if
065:             * the socket is not producing data it is polled less frequently.
066:             *
067:             * @param handler this will recive the requests from the
068:             * <code>Pipeline</code>
069:             */
070:            public static PipelineHandler getInstance(ProtocolHandler handler) {
071:                return getInstance(handler, DEFAULT_POLLERS, DEFAULT_WAIT);
072:            }
073:
074:            /**
075:             * This will create an instance of a <code>PipelineHandler</code>
076:             * object for processing <code>Pipeline</code> objects using an
077:             * instance of the <code>ProtocolHandler</code>. This uses defaults
078:             * for the <code>PipelineHandler</code> created. Specifics can be 
079:             * specified by using the overloaded getinstance method. The job
080:             * of the <code>PipelineHandler</code> once it has been created is
081:             * to read HTTP requests from <code>Pipeline</code>'s passed to it.
082:             * These transactions will be used to generate <code>Request</code>
083:             * and <code>Resposne</code> objects.   
084:             * <p>
085:             * This will create a <code>PipelineHandler</code> to handle any 
086:             * connected <code>Pipeline</code>'s. This handler will poll the 
087:             * <code>Pipeline</code>'s <code>InputStream</code> so that there
088:             * is no blocking, this will use an exponential backoff so that if
089:             * the socket is not producing data it is polled less frequently.
090:             * The <code>wait</code> parameter identifies a maximum that the 
091:             * <code>Pipeline</code>'s <code>InputStream</code> will be queued
092:             * before the next poll.
093:             *
094:             * @param handler this will recive the requests from the
095:             * <code>Pipeline</code>
096:             *
097:             * @param pollers this is the number of threads used for polling 
098:             * the <code>Pipeline</code>'s, this will not effect the number
099:             * of <code>Pipeline</code>'s that can be polled
100:             *
101:             * @param wait this is the maximum waiting time for the polling
102:             * of the <code>Pipeline</code>, there is an exponential backoff
103:             * when polling the <code>Pipeline</code> this limits the wait 
104:             */
105:            public static PipelineHandler getInstance(ProtocolHandler handler,
106:                    int pollers, int wait) {
107:                return new PipelineProcessor(handler, pollers, wait);
108:            }
109:
110:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.