electric.net.socket
Class SocketServer

java.lang.Object
  extended byelectric.net.socket.SocketServer
All Implemented Interfaces:
IChannelListener, IEXMLLoggingConstants, IGLUELoggingConstants, ILoggingConstants, java.lang.Runnable

public final class SocketServer
extends java.lang.Object
implements java.lang.Runnable, IGLUELoggingConstants, IChannelListener

SocketServer accepts socket connections and processing incoming socket messages. When a socket connection is accepted, it is wrapped in a SocketChannel and allocated a thread from the thread pool. When the thread is serviced, it passes the SocketChannel to the IChannelSink for processing. An IChannelSink typically reads data from the channel, writes back a response, and then returns. If the SocketChannel is keep-alive and the maximum number of open connections has not been reached, a new thread is allocated to the SocketChannel and the processed is repeated, otherwise the SocketChannel is closed.

Author:
webMethods

Field Summary
 
Fields inherited from interface electric.glue.IGLUELoggingConstants
CLUSTER_DEBUG_EVENT, CLUSTER_EVENT, CONSOLE_DEBUG_EVENT, DEPLOY_EVENT, DETECTORS_EVENT, HTTP_EVENT, JMS_EVENT, REBINDING_EVENT, SECURITY_DEBUG_EVENT, SECURITY_DETAIL_EVENT, SERVLET_EVENT, SOAP_EVENT
 
Fields inherited from interface electric.xml.IEXMLLoggingConstants
MAPPING_EVENT, SCHEMA_EVENT
 
Fields inherited from interface electric.util.log.ILoggingConstants
CLASSLOADER_EVENT, COMMAND_EVENT, COMMENT_EVENT, CONFIG_EVENT, DEBUG_EVENT, ELECTRIC_LOGGING_PROPERTY, ERROR_EVENT, EXCEPTION_EVENT, FILE_EVENT, LICENSE_EVENT, RESOURCES_EVENT, SECURITY_EVENT, SHUTDOWN_EVENT, SOURCE_EVENT, SQL_EVENT, STARTUP_EVENT, WARNING_EVENT
 
Constructor Summary
SocketServer(XURL xurl, int backlog, ThreadPool threadPool, IChannelSink sink, Context context)
           
 
Method Summary
 void channelShutdown(IChannel channel)
           
 long getBytesRead()
           
 long getBytesWritten()
           
 LinkedList getChannels()
          Return a linked list of all channels active at the time of the method call.
static int getDefaultBacklog()
           
static int getMaxKeepAlive()
           
 XURL getXURL()
           
 void run()
           
 void run(electric.net.socket.SocketRequest request)
           
static void setConnectionLimit(int limit)
           
static void setDefaultBacklog(int backlog)
           
static void setMaxKeepAlive(int max)
           
 void shutdown()
           
 void startup()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketServer

public SocketServer(XURL xurl,
                    int backlog,
                    ThreadPool threadPool,
                    IChannelSink sink,
                    Context context)
             throws java.io.IOException
Parameters:
xurl -
backlog -
threadPool -
sink -
Throws:
java.io.IOException
Method Detail

startup

public void startup()
             throws java.io.IOException
Throws:
java.io.IOException

shutdown

public void shutdown()

run

public void run()
Specified by:
run in interface java.lang.Runnable

run

public void run(electric.net.socket.SocketRequest request)
Parameters:
request -

getMaxKeepAlive

public static int getMaxKeepAlive()

setMaxKeepAlive

public static void setMaxKeepAlive(int max)
Parameters:
max -

setDefaultBacklog

public static void setDefaultBacklog(int backlog)
Parameters:
backlog -

getDefaultBacklog

public static int getDefaultBacklog()

getXURL

public XURL getXURL()

setConnectionLimit

public static void setConnectionLimit(int limit)
Parameters:
limit -

getChannels

public LinkedList getChannels()
Return a linked list of all channels active at the time of the method call.


channelShutdown

public void channelShutdown(IChannel channel)
Specified by:
channelShutdown in interface IChannelListener
Parameters:
channel -

getBytesRead

public long getBytesRead()

getBytesWritten

public long getBytesWritten()


copyright© 2001-2004 by webMethods All Rights Reserved.