Add schema changes for job dispatcher

This commit is contained in:
Kelven Yang 2013-04-09 14:21:00 -07:00
parent 55935f9868
commit a410652795
3 changed files with 31 additions and 52 deletions

View File

@ -61,6 +61,8 @@ public interface AsyncJob extends Identity, InternalIdentity {
int getCmdVersion();
String getCmdInfo();
String getDispatcher();
int getCallbackType();
@ -90,10 +92,6 @@ public interface AsyncJob extends Identity, InternalIdentity {
Long getInstanceId();
String getSessionKey();
String getCmdOriginator();
boolean isFromPreviousSession();
SyncQueueItem getSyncSource();

View File

@ -50,21 +50,18 @@ public class AsyncJobVO implements AsyncJob {
@Column(name="account_id")
private long accountId;
@Column(name="session_key")
private String sessionKey;
@Column(name="job_cmd")
private String cmd;
@Column(name="job_cmd_originator")
private String cmdOriginator;
@Column(name="job_cmd_ver")
private int cmdVersion;
@Column(name="job_dispatcher")
private String jobDispatcher;
@Column(name="job_cmd_info", length=65535)
private String cmdInfo;
@Column(name="callback_type")
private int callbackType;
@ -124,22 +121,22 @@ public class AsyncJobVO implements AsyncJob {
}
public AsyncJobVO(long userId, long accountId, String cmd, String cmdInfo, Long instanceId, Type instanceType) {
this.userId = userId;
this.accountId = accountId;
this.cmd = cmd;
this.cmdInfo = cmdInfo;
this.callbackType = CALLBACK_POLLING;
this.uuid = UUID.randomUUID().toString();
this.instanceId = instanceId;
this.userId = userId;
this.accountId = accountId;
this.cmd = cmd;
this.cmdInfo = cmdInfo;
this.callbackType = CALLBACK_POLLING;
this.uuid = UUID.randomUUID().toString();
this.instanceId = instanceId;
}
public AsyncJobVO(long userId, long accountId, String cmd, String cmdInfo,
int callbackType, String callbackAddress, Long instanceId, Type instanceType) {
this(userId, accountId, cmd, cmdInfo, instanceId, instanceType);
this.callbackType = callbackType;
this.callbackAddress = callbackAddress;
this.uuid = UUID.randomUUID().toString();
int callbackType, String callbackAddress, Long instanceId, Type instanceType) {
this(userId, accountId, cmd, cmdInfo, instanceId, instanceType);
this.callbackType = callbackType;
this.callbackAddress = callbackAddress;
this.uuid = UUID.randomUUID().toString();
}
@ -196,6 +193,15 @@ public class AsyncJobVO implements AsyncJob {
public void setCmdInfo(String cmdInfo) {
this.cmdInfo = cmdInfo;
}
@Override
public String getDispatcher() {
return this.jobDispatcher;
}
public void setDispatcher(String dispatcher) {
this.jobDispatcher = dispatcher;
}
@Override
public int getCallbackType() {
@ -323,24 +329,6 @@ public class AsyncJobVO implements AsyncJob {
this.instanceId = instanceId;
}
@Override
public String getSessionKey() {
return sessionKey;
}
public void setSessionKey(String sessionKey) {
this.sessionKey = sessionKey;
}
@Override
public String getCmdOriginator() {
return cmdOriginator;
}
public void setCmdOriginator(String cmdOriginator) {
this.cmdOriginator = cmdOriginator;
}
@Override
public SyncQueueItemVO getSyncSource() {
return syncSource;
@ -374,11 +362,9 @@ public class AsyncJobVO implements AsyncJob {
sb.append("AsyncJobVO {id:").append(getId());
sb.append(", userId: ").append(getUserId());
sb.append(", accountId: ").append(getAccountId());
sb.append(", sessionKey: ").append(getSessionKey());
sb.append(", instanceType: ").append(getInstanceType());
sb.append(", instanceId: ").append(getInstanceId());
sb.append(", cmd: ").append(getCmd());
sb.append(", cmdOriginator: ").append(getCmdOriginator());
sb.append(", cmdInfo: ").append(getCmdInfo());
sb.append(", cmdVersion: ").append(getCmdVersion());
sb.append(", callbackType: ").append(getCallbackType());

View File

@ -17,7 +17,6 @@
package com.cloud.async;
public class AsyncJobExecutionContext {
private SyncQueueItemVO _syncSource;
private AsyncJobVO _job;
private static ThreadLocal<AsyncJobExecutionContext> s_currentExectionContext = new ThreadLocal<AsyncJobExecutionContext>();
@ -30,11 +29,7 @@ public class AsyncJobExecutionContext {
}
public SyncQueueItemVO getSyncSource() {
return _syncSource;
}
public void setSyncSource(SyncQueueItemVO syncSource) {
_syncSource = syncSource;
return _job.getSyncSource();
}
public AsyncJobVO getJob() {