|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.digitalis.iss.ISSImpl
public class ISSImpl
This is an implementation of the ISS interface.
Objects of this class perform the process scheduling management duties.
It exposes methods to the client that allows process delegation, estimated
execution time inquiry and result fetching.
Internally it manages the synchronously or asynchronously process execution
and a number of parameters that control the mode assignment to the processes.
The initial values of these parameters can be set externally in a properties
file.
ISS is an acronym for Intelligent Scheduling System.
The asynchronicity threshold is reevaluated every time an asynchronous
request is served and every "N" received requests to do load balance. When
the ISS is serving requests asynchronously it is important to reevaluate
often the threshold to prevent further performance degrading.
Constructor Summary | |
---|---|
ISSImpl(String id,
Properties configurationParameters,
pt.digitalis.log.ILogWrapper logger)
Constructor. |
Method Summary | |
---|---|
boolean |
areTooManyWorkers()
Tests if the current number of workers is above the current limit |
boolean |
canExecuteMoreRequestsSynchronously()
Tests if we can serve more requests synchronously. |
boolean |
canHaveMoreWorkers()
Tests if we can launch more workers |
ServiceRequest |
delegate(IProcess process)
Overload of the delegate() method. |
ServiceRequest |
delegate(IProcess aProcess,
String id)
Delegates the process execution to the ISS. |
boolean |
existsRequest(String id)
This method informs if a request with a given id is already being served, was served or is waiting. |
ServiceRequest |
fetchResults(String requestID)
Returns the execution results to the Client. |
long |
getEstimatedTimeOfExecution(String requestID)
The method uses statistical information from the waitingQueueStats engine. |
ServiceRequest |
getWaitingRequest()
This method is part of the public interface exposed to the Worker. |
boolean |
isStatisticsDumpEnabled()
Returns the value of the statistics logging control flag. |
void |
notifyWorkerFinished()
Synchronized to guarantee the activeWorkers consistency. |
void |
returnRequest(ServiceRequest returnedRequest)
This method is part of the public interface exposed to the Worker. |
void |
setStatisticsDumpEnabled(boolean showStatistics)
Sets the value of the statistics logging control flag. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ISSImpl(String id, Properties configurationParameters, pt.digitalis.log.ILogWrapper logger)
id
- the ISS idconfigurationParameters
- the configuration parameterslogger
- the logger for ISS to useMethod Detail |
---|
public ServiceRequest delegate(IProcess aProcess, String id)
ISS
delegate
in interface ISS
aProcess
- the process to executeid
- an explicit id for the request
Internally the method decides if the request is executed synchronously or
asynchronously. If there's enough capacity to serve the request
synchronously, it is executed immediately. Otherwise the request is
queued for later execution.
In synchronous execution mode the method returns the service request
after the process execution has finished. In asynchronous mode it will
place the newly created service request on the queue and return it with
the queued state.
The method is also responsible for collecting statistical measures and
submit them to the statistics engine.
If an incoming request is already being served or has been served lately
the request is returned with an updated status.
Implementation Note: If this method is qualified with
synchronized
the client threads will not be able to call
it if another client is executing it. In such situation, these threads
will block waiting for the method's control and the ISS will operate in
SYNCHRONOUS mode.
public ServiceRequest delegate(IProcess process)
ISS
delegate()
method. The client uses this
variant if it does not wishes to pass an id of its own.
delegate
in interface ISS
process
- the process to execute
This form forces automatic id generation.
public boolean existsRequest(String id)
ISS
existsRequest
in interface ISS
id
- the id of the request
ISS.existsRequest(String)
public ServiceRequest getWaitingRequest()
waitingProcesses
.
The method is synchronized to ensure queue consistency.
getWaitingRequest
in interface ISSRequestManagement
ISSRequestManagement.getWaitingRequest()
public void returnRequest(ServiceRequest returnedRequest)
asynchronicityThreshold
must be reevaluated.
The method is synchronized to ensure queue consistency.
returnRequest
in interface ISSRequestManagement
returnedRequest
- the serviced requestISSRequestManagement.returnRequest(pt.digitalis.iss.ServiceRequest)
public ServiceRequest fetchResults(String requestID)
fetchResults
in interface ISS
requestID
- the request id
public long getEstimatedTimeOfExecution(String requestID)
getEstimatedTimeOfExecution
in interface ISS
requestID
- the id of the process
public boolean isStatisticsDumpEnabled()
ISS
isStatisticsDumpEnabled
in interface ISS
ISS.isStatisticsDumpEnabled()
public void setStatisticsDumpEnabled(boolean showStatistics)
ISS
setStatisticsDumpEnabled
in interface ISS
showStatistics
- the statisticsDumpEnabled new valueISS.setStatisticsDumpEnabled(boolean)
public void notifyWorkerFinished()
activeWorkers
consistency.
notifyWorkerFinished
in interface ISSRequestManagement
ISSRequestManagement.notifyWorkerFinished()
public boolean canHaveMoreWorkers()
public boolean canExecuteMoreRequestsSynchronously()
public boolean areTooManyWorkers()
ISSRequestManagement
areTooManyWorkers
in interface ISSRequestManagement
ISSRequestManagement.areTooManyWorkers()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |