Class GlueServerHandler
java.lang.Object
org.apache.mina.core.service.IoHandlerAdapter
com.poscoict.glueframework.scheduling.server.GlueServerHandler
- All Implemented Interfaces:
org.apache.mina.core.service.IoHandler
public class GlueServerHandler
extends org.apache.mina.core.service.IoHandlerAdapter
GlueSchedulerHttpServer가 받은 Request 정보를 기반으로 Job을 처리하는 핸들러 클래스.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
디폴트 세션 Idle 시간 (단위, 초)protected static final String
Job Parameter Header -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected GlueJobDefinition
GlueHttpRequestMessage로부터 Job Definition을 생성한다. - JobName, RequestId, ClientIp - Job Parameters 정보 설정void
exceptionCaught
(org.apache.mina.core.session.IoSession session, Throwable cause) void
messageReceived
(org.apache.mina.core.session.IoSession session, Object message) GlueGlueSchedulerHttpServer가 메시지(HttpRequest)를 받을 때 호출되는 callback 메소드.void
sessionIdle
(org.apache.mina.core.session.IoSession session, org.apache.mina.core.session.IdleStatus status) void
sessionOpened
(org.apache.mina.core.session.IoSession session) 세션 오픈 시 callback 메소드.Methods inherited from class org.apache.mina.core.service.IoHandlerAdapter
event, inputClosed, messageSent, sessionClosed, sessionCreated
-
Field Details
-
DEFAULT_IDLE_TIME
public static final int DEFAULT_IDLE_TIME디폴트 세션 Idle 시간 (단위, 초)- See Also:
-
PARAM_HEADER
Job Parameter Header- See Also:
-
-
Constructor Details
-
GlueServerHandler
public GlueServerHandler() -
GlueServerHandler
-
-
Method Details
-
sessionOpened
public void sessionOpened(org.apache.mina.core.session.IoSession session) 세션 오픈 시 callback 메소드. 세션 IDLE 시간을 설정한다. (디폴트 1분)- Specified by:
sessionOpened
in interfaceorg.apache.mina.core.service.IoHandler
- Overrides:
sessionOpened
in classorg.apache.mina.core.service.IoHandlerAdapter
- Parameters:
session
- IoSession
-
createJobDefinition
GlueHttpRequestMessage로부터 Job Definition을 생성한다. - JobName, RequestId, ClientIp - Job Parameters 정보 설정- Parameters:
message
- GlueHttpRequestMessage- Returns:
- 생성된 JobDefinition
-
messageReceived
GlueGlueSchedulerHttpServer가 메시지(HttpRequest)를 받을 때 호출되는 callback 메소드. 메시지로부터 JobDefinition을 생성한 후 JobEventReicever를 이용하여 해당 Scheduled Job을 기동한다. Job 실행 등록이 정상적으로 이루어지면 Response에 "success"가 설정되고 StatusCode는 GlueHttpResponseMessage.STATUS_JOB_SUCCESS 값(700)이 설정된다. 반대로 등록에 실패하면 "failure"가 설정되고 StatusCode는 GlueHttpResponseMessage.STATUS_JOB_ERROR 값(800)이 설정된다. TODO: job state 확인 후 해당 리턴 코드 응답하는 로직 추가 - catch GlueAlreadyCompletedJobException, GlueAlreadyRunningJobException- Specified by:
messageReceived
in interfaceorg.apache.mina.core.service.IoHandler
- Overrides:
messageReceived
in classorg.apache.mina.core.service.IoHandlerAdapter
- Parameters:
session
- IoSessionmessage
- GlueHttpRequestMessage
-
sessionIdle
public void sessionIdle(org.apache.mina.core.session.IoSession session, org.apache.mina.core.session.IdleStatus status) - Specified by:
sessionIdle
in interfaceorg.apache.mina.core.service.IoHandler
- Overrides:
sessionIdle
in classorg.apache.mina.core.service.IoHandlerAdapter
-
exceptionCaught
- Specified by:
exceptionCaught
in interfaceorg.apache.mina.core.service.IoHandler
- Overrides:
exceptionCaught
in classorg.apache.mina.core.service.IoHandlerAdapter
-