The DfcService class implements the ServerListner interface, which allows a Java client application to start a TCP server and listen for remote function calls from e-Biz Impact. When the service receives a function call, it invokes the function implementation of the custom Java client application.
DfcService is a resource that can be shared across threads within the same process. Internally, the service makes use of a class factory. Also, the service has the capacity to adjust to the workload associated with incoming client requests.
Use setMaxWorkerThreadCount to limit the number of concurrent threads available to fulfill client requests.
Use addApplication or removeApplication to add or remove Java client applications.
When adding an application, the service looks into each application and registers all functions. The service uses the same flavor for all application functions.
DfcService creates an instance of DfcServer, then registers itself for notifications of DfcMessages.
Figure 1-3: DfcService application
DfcService starts the DfcServer. The DfcServer starts a server socket channel on a specified TcpPort. This channel receives requests from an instance of e-Biz Impact.
DfcService allows for the registration of applications. Upon registration, the DfcService registers each function into the DfcServer.
When the DfcServer receives a message from e-Biz Impact, it requests a worker from a WorkerPool. The size of the WorkerPool is dynamic and adjusts to the workload by the DfcServer. The maxWorkerThreadCount property defines the maximum number of worker threads.
The DfcServer delegates the work to the worker thread. This worker thread:
Drains the channel
Serializes the incoming raw data
Analyses the message type, function name, and flavor
Locates a registered ServerListner that provides an implementation for the received function
The worker then invokes the processMessage of the ServerListner. The DfcMessage is passed to the DfcService. The DfcService takes the first function that matches by name and looks for the function argument data type. If the type is ArgumentsInterface, the DfcService composes an argument wrapper. The DfcService invokes the function in the consumer application. After invocation, the DfcService sets the return argument of the incoming message, cleans up input-only arguments, and sends the response message back to e-Biz Impact. When a worker is finished fulfilling a request, it returns itself to the pool.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |