Java Doc for SocketServerImpl.java in  » Web-Server » JicarillaHTTP » org » jicarilla » net » 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 » JicarillaHTTP » org.jicarilla.net 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jicarilla.lang.AbstractActive
      org.jicarilla.net.SocketServerImpl

SocketServerImpl
public class SocketServerImpl extends AbstractActive implements SocketServer(Code)
This is a basic New-I/O socket server. On startup, a configurable number of threads is created which listen for requests and delegate them to the handler once basic parsing has been done. All other processing is then delegated to a handler from the handler pool. In case of any unusual failure, a fallback error handler is used. This is a mostly type-3-compatible IoC component with two additional lifecycle methods: initialize() and releaseInstance(). The additional lifecycle is neccessary because we should not create threads in the constructor.
author:
   Leo Simons
version:
   $Id: SocketServerImpl.java,v 1.7 2004/03/23 13:37:50 lsimons Exp $

Inner Class :protected interface StoppableRunnable extends Runnable
Inner Class :protected static class RequestHandlingWorker implements StoppableRunnable
Inner Class :protected class PoolReturningSinkSink implements Sink
Inner Class :protected static class PoolReturningWorker implements Runnable

Field Summary
final public static  intMAXIMUM_PORT_NUMBER
    
final public static  intSLEEP_DURING_DISPOSE
    
protected  InetAddressm_address
    
protected  intm_backlog
    
protected  ServerSocketChannelm_channel
    
protected  Sinkm_errorHandler
    
protected  ObjectPoolm_eventPool
    
protected  ExceptionListenerm_exceptionListener
    
protected  ObjectPoolm_handlerPool
    
protected  intm_numThreads
    
protected  intm_port
    
protected  Stringm_rootDirectory
    
protected  StoppableRunnable[]m_runners
    
protected  PooledExecutorm_threadPool
    

Constructor Summary
public  SocketServerImpl(SocketServerConfig config, ExceptionListener exceptionListener, ObjectPool eventPool, ObjectPool handlerPool, Sink errorHandler, PooledExecutor threadPool)
    
protected  SocketServerImpl()
    

Method Summary
protected  ChannelborrowChannel()
    
protected  EventborrowEvent()
    
protected  StoppableRunnablecreateRunner(SocketServerImpl server)
    
protected  voiddoDispose()
    
protected  voiddoInitialize()
    
protected  voidexecuteRunner(Runnable r)
    
public  voidfinalize()
    
protected  InetAddressgetAddress()
    
protected  intgetBacklog()
    
protected  ServerSocketChannelgetChannel()
    
protected  SinkgetErrorHandler()
    
protected  ObjectPoolgetEventPool()
    
protected  ExceptionListenergetExceptionListener()
    
protected  ObjectPoolgetHandlerPool()
    
protected  intgetNumThreads()
    
protected  intgetPort()
    
protected  StringgetRootDirectory()
    
protected  StoppableRunnable[]getRunners()
    
protected  ServerSocketgetSocket()
    
protected  PooledExecutorgetThreadPool()
    
protected  voidhandleRequest()
     Called from worker threads to accept new socket connections.
protected  voidhandleRequest(SocketChannel channel)
     Called from SocketServerImpl.handleRequest() to do the actual work and may be called from elsewhere to continue communication on open sockets.
protected  voidhandleRequestException(SocketChannel channel, Exception ex)
    
protected  voidsetAddress(InetAddress address)
    
protected  voidsetBacklog(int backlog)
    
protected  voidsetChannel(ServerSocketChannel channel)
    
protected  voidsetErrorHandler(Sink errorHandler)
    
protected  voidsetEventPool(ObjectPool eventPool)
    
protected  voidsetExceptionListener(ExceptionListener exceptionListener)
    
protected  voidsetHandlerPool(ObjectPool handlerPool)
    
protected  voidsetNumThreads(int numThreads)
    
final protected  voidsetPoolReturningSink(Channel handler, Event event)
     Appends a handler to the end of an event handler chain that will return pooled objects back to from whence they came.
protected  voidsetPort(int port)
    
protected  voidsetRootDirectory(String rootDirectory)
    
protected  voidsetSocket(ServerSocket socket)
    
protected  voidsetThreadPool(PooledExecutor threadPool)
    

Field Detail
MAXIMUM_PORT_NUMBER
final public static int MAXIMUM_PORT_NUMBER(Code)



SLEEP_DURING_DISPOSE
final public static int SLEEP_DURING_DISPOSE(Code)



m_address
protected InetAddress m_address(Code)



m_backlog
protected int m_backlog(Code)



m_channel
protected ServerSocketChannel m_channel(Code)



m_errorHandler
protected Sink m_errorHandler(Code)



m_eventPool
protected ObjectPool m_eventPool(Code)



m_exceptionListener
protected ExceptionListener m_exceptionListener(Code)



m_handlerPool
protected ObjectPool m_handlerPool(Code)



m_numThreads
protected int m_numThreads(Code)



m_port
protected int m_port(Code)



m_rootDirectory
protected String m_rootDirectory(Code)



m_runners
protected StoppableRunnable[] m_runners(Code)



m_threadPool
protected PooledExecutor m_threadPool(Code)




Constructor Detail
SocketServerImpl
public SocketServerImpl(SocketServerConfig config, ExceptionListener exceptionListener, ObjectPool eventPool, ObjectPool handlerPool, Sink errorHandler, PooledExecutor threadPool) throws IOException(Code)



SocketServerImpl
protected SocketServerImpl()(Code)




Method Detail
borrowChannel
protected Channel borrowChannel() throws SocketServerException(Code)



borrowEvent
protected Event borrowEvent() throws SocketServerException(Code)



createRunner
protected StoppableRunnable createRunner(SocketServerImpl server)(Code)



doDispose
protected void doDispose() throws IOException, InterruptedException(Code)



doInitialize
protected void doInitialize() throws Throwable(Code)



executeRunner
protected void executeRunner(Runnable r) throws Throwable(Code)



finalize
public void finalize() throws Throwable(Code)



getAddress
protected InetAddress getAddress()(Code)



getBacklog
protected int getBacklog()(Code)



getChannel
protected ServerSocketChannel getChannel()(Code)



getErrorHandler
protected Sink getErrorHandler()(Code)



getEventPool
protected ObjectPool getEventPool()(Code)



getExceptionListener
protected ExceptionListener getExceptionListener()(Code)



getHandlerPool
protected ObjectPool getHandlerPool()(Code)



getNumThreads
protected int getNumThreads()(Code)



getPort
protected int getPort()(Code)



getRootDirectory
protected String getRootDirectory()(Code)



getRunners
protected StoppableRunnable[] getRunners()(Code)



getSocket
protected ServerSocket getSocket()(Code)



getThreadPool
protected PooledExecutor getThreadPool()(Code)



handleRequest
protected void handleRequest() throws InterruptedException(Code)
Called from worker threads to accept new socket connections.



handleRequest
protected void handleRequest(SocketChannel channel) throws InterruptedException, SocketServerException(Code)
Called from SocketServerImpl.handleRequest() to do the actual work and may be called from elsewhere to continue communication on open sockets.
Parameters:
  channel - the channel to get a request from



handleRequestException
protected void handleRequestException(SocketChannel channel, Exception ex)(Code)



setAddress
protected void setAddress(InetAddress address)(Code)



setBacklog
protected void setBacklog(int backlog)(Code)



setChannel
protected void setChannel(ServerSocketChannel channel)(Code)



setErrorHandler
protected void setErrorHandler(Sink errorHandler)(Code)



setEventPool
protected void setEventPool(ObjectPool eventPool)(Code)



setExceptionListener
protected void setExceptionListener(ExceptionListener exceptionListener)(Code)



setHandlerPool
protected void setHandlerPool(ObjectPool handlerPool)(Code)



setNumThreads
protected void setNumThreads(int numThreads)(Code)



setPoolReturningSink
final protected void setPoolReturningSink(Channel handler, Event event) throws InterruptedException(Code)
Appends a handler to the end of an event handler chain that will return pooled objects back to from whence they came.
Parameters:
  handler -
Parameters:
  event -



setPort
protected void setPort(int port)(Code)



setRootDirectory
protected void setRootDirectory(String rootDirectory)(Code)



setSocket
protected void setSocket(ServerSocket socket)(Code)



setThreadPool
protected void setThreadPool(PooledExecutor threadPool)(Code)



Fields inherited from org.jicarilla.lang.AbstractActive
protected boolean m_running(Code)(Java Doc)
protected boolean m_stopped(Code)(Java Doc)

Methods inherited from org.jicarilla.lang.AbstractActive
final protected synchronized void checkActive()(Code)(Java Doc)
final public synchronized void dispose() throws Throwable(Code)(Java Doc)
protected void doDispose() throws Throwable(Code)(Java Doc)
protected void doInitialize() throws Throwable(Code)(Java Doc)
final public synchronized void initialize() throws Throwable(Code)(Java Doc)
final protected synchronized boolean isActive()(Code)(Java Doc)
final protected synchronized boolean isDisposed()(Code)(Java Doc)
final protected synchronized boolean isInitialized()(Code)(Java Doc)
final protected synchronized void lazyInitialization() throws Throwable(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.