|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.infoengine.au.SocketAccess
This class establishes a framework for listening on a TCP port for connection requests. When a connection request is received, it creates a thread to service the connection. The thread then reads Info*Engine request objects from the connection and passes them to a specified class for processing. The class that processes the requests can be defined as implementing the IeProcessor interface or the IeMultithreadedPrrocessor interface. If the class implements the IeProcessor interface, then a new instance is created and dispatched for each request received by the thread. If the class implements the IeMultithreadedProcessor interface, it is instantiated exactly once (when the thread receives the very first request), and reused thereafter.
Nested Class Summary | |
(package private) class |
SocketAccess.SocketThread
|
Constructor Summary | |
SocketAccess(Class webjectProcessorClass,
Class taskProcessorClass,
com.infoengine.log.LogWriter log,
String serviceName)
Constructs an instance that calls a specified classes to process each webject and task request received. |
|
SocketAccess(Class webjectProcessorClass,
com.infoengine.log.LogWriter log,
String serviceName)
Constructs an instance that calls a specified class to process each webject request received, and that calls the default task processor class to process each task request received. |
|
SocketAccess(Class webjectProcessorClass,
Properties props,
com.infoengine.log.LogWriter log,
String serviceName)
Deprecated. Add the configuration properties to the System properties and use a constructor that does not take a properties object as a parameter. |
Method Summary | |
private long |
avgResponseTime()
|
private void |
awaitNotification()
|
private ServerSocket |
createServerSocket(String serviceName,
int port)
|
private void |
decrActive()
|
private int |
getActive()
|
private long |
getLongestResponseTime()
|
int |
getPort()
|
private long |
getRequests()
|
static ObjectDestination[] |
getServiceAddresses(String serviceName)
Obtain the set of addresses and related attributes registered for a service. |
int |
getServiceType()
Returns the type of service to which this instance provides access. |
private long |
getShortestResponseTime()
|
Class |
getTaskProcessorClass()
Returns the class used to execute tasks. |
Class |
getWebjectProcessorClass()
Returns the class used to execute tasks. |
private void |
incrActive()
|
private void |
incrRequests()
|
private void |
incrResponseTime(long time)
|
private void |
initialize(Class webjectProcessorClass,
Class taskProcessorClass,
com.infoengine.log.LogWriter log,
String serviceName)
|
void |
run()
Begins listening for connection requests and creates a thread to accept and process each such request. |
private void |
sendNotification()
|
void |
setServiceType(int serviceType)
Establishes the type of service to which this instance provides access. |
void |
setTaskProcessorClass(Class taskProcessorClass)
Establishes the class used to execute tasks. |
void |
setWebjectProcessorClass(Class webjectProcessorClass)
Establishes the class used to execute webjects. |
static Throwable |
unwrap(Throwable t)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String DEFAULT_SERVER_SOCKET_FACTORY
private static final String RESOURCE
public static final int ADMINISTRATIVE_SERVICE
public static final int TASK_PROCESSOR
public static final int TEMPLATE_PROCESSOR
public static final int WEBJECT_PROCESSOR
public static final int ADAPTER
protected static int count
private com.infoengine.log.LogWriter logWriter
private int maxThreadCount
private int serverPort
private String serviceName
private int serviceType
private ServerSocket ss
private Class taskProcessorClass
private IeProcessor taskProcessorInstance
private Class webjectProcessorClass
private IeProcessor webjectProcessorInstance
private int activeThreads
private long handledRequests
private long longestResponseTime
private long shortestResponseTime
private long totalResponseTime
private static InetAddress localhostInetAddress
private static InetAddress[] myClusterAddresses
private static String myClusterName
private static String myHostName
private static InetAddress[] myInetAddresses
private static Hashtable socketFactories
private static Class defaultTaskProcessorClass
private static Class procunitWebjectProcessorClass
private static Method SAKTaskVerifyByCertificate
private static Method SAKTaskVerifyUsername
private static Method webjectProcessorProcessTask
Constructor Detail |
public SocketAccess(Class webjectProcessorClass, com.infoengine.log.LogWriter log, String serviceName) throws SocketAccessException
webjectProcessorClass
- The class that will be called to process
each webject request received. This class must implement
either the com.infoengine.procunit.IeProcessor interface or
the com.infoengine.procunit.IeMultithreadedProcessor
interface.log
- The LogWriter to which messages related to the requests
being processed will be written.serviceName
- The name of the service associated with this
SocketAccess instance. This name selects configuration
properties from the system properties.
SocketAccessException
- if a server socket can not be
created successfully for listening for requests.public SocketAccess(Class webjectProcessorClass, Class taskProcessorClass, com.infoengine.log.LogWriter log, String serviceName) throws SocketAccessException
webjectProcessorClass
- The class that will be called to process
each webject request received. This class must implement
either the com.infoengine.procunit.IeProcessor interface or
the com.infoengine.procunit.IeMultithreadedProcessor
interface.taskProcessorClass
- The class that will be called to process
each task request received. This class must implement
either the com.infoengine.procunit.IeProcessor interface or
the com.infoengine.procunit.IeMultithreadedProcessor
interface.log
- The LogWriter to which messages related to the requests
being processed will be written.serviceName
- The name of the service associated with this
SocketAccess instance. This name selects configuration
properties from the system properties.
SocketAccessException
- if a server socket can not be
created successfully for listening for requests.public SocketAccess(Class webjectProcessorClass, Properties props, com.infoengine.log.LogWriter log, String serviceName) throws SocketAccessException
webjectProcessorClass
- The class that will be called to process
each webject request received. This class must implement
either the com.infoengine.procunit.IeProcessor interface or
the com.infoengine.procunit.IeMultithreadedProcessor
interface.props
- An object containing configuration properties.log
- The LogWriter to which messages related to the requests
being processed will be written.serviceName
- The name of the service associated with this
SocketAccess instance. This name selects configuration
properties from the system properties.
SocketAccessException
- if a server socket can not be
created successfully for listening for requests.Method Detail |
private void initialize(Class webjectProcessorClass, Class taskProcessorClass, com.infoengine.log.LogWriter log, String serviceName) throws SocketAccessException
SocketAccessException
public static ObjectDestination[] getServiceAddresses(String serviceName) throws SocketAccessException
serviceName
- The name of the Info*Engine service for which
to obtain network addresses.
SocketAccessException
- if network addresses can not be
determined.public void setServiceType(int serviceType)
serviceType
- One of TEMPLATE_PROCESSOR, TASK_PROCESSOR, or
WEBJECT_PROCESSOR. The default is
WEBJECT_PROCESSOR.public int getServiceType()
public int getPort()
public void setWebjectProcessorClass(Class webjectProcessorClass) throws SocketAccessException
webjectProcessorClass
- The webject processor class.
SocketAccessException
- if the class can not be established as
the webject processor class.public Class getWebjectProcessorClass()
public void setTaskProcessorClass(Class taskProcessorClass) throws SocketAccessException
taskProcessorClass
- The task processor class.
SocketAccessException
- if the class can not be established as
the task processor class.public Class getTaskProcessorClass()
private void awaitNotification() throws InterruptedException
InterruptedException
private void sendNotification() throws IllegalMonitorStateException
IllegalMonitorStateException
private ServerSocket createServerSocket(String serviceName, int port) throws Exception
Exception
private void incrActive()
private int getActive()
private void decrActive()
private void incrRequests()
private long getRequests()
private void incrResponseTime(long time)
private long avgResponseTime()
private long getShortestResponseTime()
private long getLongestResponseTime()
public static Throwable unwrap(Throwable t)
public void run()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |