public class RequestHandler extends java.lang.Object implements RequestHandlerInterface
RequestHandlerInterface
,
TaskExecutor
,
TaskExecutorInterface
,
TaskQueue
,
TaskQueueInterface
,
Task
,
TaskInterface
Constructor and Description |
---|
RequestHandler(java.lang.String dockerImg,
double dockerExecTime,
java.lang.String dockerMemLimit,
int sessionCleanerTimeInMinutes,
int sessionMaxInactivityInMinutes,
int taskMaxInactivityInMinutes)
Constructs a RequestHandler object
|
Modifier and Type | Method and Description |
---|---|
ConnectRet |
connect()
connect a client on the server
connect |
InfoKey |
disconnect(java.lang.String sessionKey)
disconnect a client from the server
disconnect |
GetDetailsRet |
getDetails(java.lang.String sessionKey,
int taskReference)
retrieve details about a submitted task
getting details |
GetLanguagesRet |
getLanguages()
get supported languages
getting languages |
GetStatusRet |
getStatus(java.lang.String sessionKey,
int taskReference)
get status about a submitted task
getting status |
static void |
printLog(java.lang.String logInfo) |
InfoKey |
run(java.lang.String sessionKey,
int taskReference,
java.lang.String cmdArgs,
java.lang.String stdIn)
run a previously submitted task
running task |
SendRequestRet |
sendRequest(java.lang.String sessionKey,
int codeLang,
java.lang.String srcCode,
java.lang.String compilOpt,
java.lang.String cmdArgs,
java.lang.String stdIn,
boolean toRun)
post a request on the server
sending request . |
public RequestHandler(java.lang.String dockerImg, double dockerExecTime, java.lang.String dockerMemLimit, int sessionCleanerTimeInMinutes, int sessionMaxInactivityInMinutes, int taskMaxInactivityInMinutes)
dockerImg
- the docker image to usedockerExecTime
- execution time for docker containersdockerMemLimit
- memory limit for docker containerssessionCleanerTimeInMinutes
- time interval to clean sessionssessionMaxInactivityInMinutes
- maximum time of session inactivitytaskCleanerTimeInMinutes
- time interval to clean taskstaskMaxInactivityInMinutes
- maximum time of task inactivitypublic ConnectRet connect()
connect
connect
in interface RequestHandlerInterface
public InfoKey disconnect(java.lang.String sessionKey)
disconnect
disconnect
in interface RequestHandlerInterface
sessionKey
- the session key as returned by precedent call to
connect
public GetLanguagesRet getLanguages()
getting languages
getLanguages
in interface RequestHandlerInterface
public SendRequestRet sendRequest(java.lang.String sessionKey, int codeLang, java.lang.String srcCode, java.lang.String compilOpt, java.lang.String cmdArgs, java.lang.String stdIn, boolean toRun)
sending request
.
First checks that parameters are valid onesendRequest
in interface RequestHandlerInterface
sessionKey
- the key session for the client as returned by connect
codeLang
- the id of the language to use as returned by getLanguages
srcCode
- the source code to compile or interpret or compile and executecompilOpt
- compilation or interpretation optioncmdArgs
- command line arguments to feed the programstdIn
- standard input to give to the programtoRun
- indicate whether the program should be executed, meaningless for interpreted languagespublic InfoKey run(java.lang.String sessionKey, int taskReference, java.lang.String cmdArgs, java.lang.String stdIn)
running task
run
in interface RequestHandlerInterface
sessionKey
- the key session for the client as returned by connect
taskReference
- the task id as returned by
sendRequest
cmdArgs
- command line argument to feed the programstdIn
- standard input to give to the programpublic GetDetailsRet getDetails(java.lang.String sessionKey, int taskReference)
getting details
getDetails
in interface RequestHandlerInterface
sessionKey
- the key session for the client as returned by connect
taskReference
- taskReference the task id as returned by
sendRequest
public GetStatusRet getStatus(java.lang.String sessionKey, int taskReference)
getting status
getStatus
in interface RequestHandlerInterface
sessionKey
- the key session for the client as returned by connect
taskReference
- taskReference taskReference the task id as returned by
sendRequest
public static void printLog(java.lang.String logInfo)