diff --git a/jqm-all/jqm-admin/src/main/java/com/enioka/admin/MetaService.java b/jqm-all/jqm-admin/src/main/java/com/enioka/admin/MetaService.java index 0dc6d52d7..09b2bb682 100644 --- a/jqm-all/jqm-admin/src/main/java/com/enioka/admin/MetaService.java +++ b/jqm-all/jqm-admin/src/main/java/com/enioka/admin/MetaService.java @@ -1443,7 +1443,7 @@ public static void upsertUser(DbConn cnx, RUserDto dto) { QueryResult r = cnx.runUpdate("user_insert", dto.getEmail(), dto.getExpirationDate(), dto.getFreeText(), null, dto.getInternal(), false, dto.getLogin(), null); - int newId = r.getGeneratedId(); + int newId = r.getGeneratedId().intValue(); if (dto.getNewPassword() != null && !dto.getNewPassword().isEmpty()) { diff --git a/jqm-all/jqm-admin/src/main/java/com/enioka/api/admin/ScheduledJob.java b/jqm-all/jqm-admin/src/main/java/com/enioka/api/admin/ScheduledJob.java index 60b04d0e4..f4a0e3b35 100644 --- a/jqm-all/jqm-admin/src/main/java/com/enioka/api/admin/ScheduledJob.java +++ b/jqm-all/jqm-admin/src/main/java/com/enioka/api/admin/ScheduledJob.java @@ -16,7 +16,7 @@ public class ScheduledJob implements Serializable { private static final long serialVersionUID = 7928212054684657247L; - private Integer id = null; + private Long id = null; private String cronExpression; @@ -48,7 +48,7 @@ public static ScheduledJob create(String cronExpression) * * @return the ID. */ - public Integer getId() + public Long getId() { return this.id; } @@ -58,7 +58,7 @@ public Integer getId() * * @param id */ - public ScheduledJob setId(Integer id) + public ScheduledJob setId(Long id) { this.id = id; return this; diff --git a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JobInstance.java b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JobInstance.java index 5d791bcc5..af2d07a03 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JobInstance.java +++ b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JobInstance.java @@ -38,9 +38,9 @@ @XmlAccessorType(XmlAccessType.FIELD) public class JobInstance { - private Integer id; + private Long id; private String applicationName; - private Integer parent; + private Long parent; private String user; private String sessionID; private State state; @@ -62,12 +62,12 @@ public class JobInstance /** * The Job Instance ID, i.e. the unique identifier of the execution request. This is a key for numerous {@link JqmClient} functions. */ - public Integer getId() + public Long getId() { return id; } - public void setId(Integer id) + public void setId(Long id) { this.id = id; } @@ -75,12 +75,12 @@ public void setId(Integer id) /** * The ID of the parent job that has enqueued this job instance. Null if the execution request was not done by a running job. */ - public Integer getParent() + public Long getParent() { return parent; } - public void setParent(Integer parent) + public void setParent(Long parent) { this.parent = parent; } @@ -126,7 +126,7 @@ public void setState(State state) /** * Position in the queue. 0 if running.
- * This is the value retrieved during the latest {@link JqmClient#getJob(int)} call and may not be up to date! + * This is the value retrieved during the latest {@link JqmClient#getJob(Long)} call and may not be up to date! */ public Long getPosition() { @@ -184,7 +184,7 @@ public void setParameters(Map parameters) /** * An optional integer that running user code may update from time to time. Used to give an idea of the progress of the job instance. *
- * This is the value retrieved during the latest {@link JqmClient#getJob(int)} call and may not be up to date! + * This is the value retrieved during the latest {@link JqmClient#getJob(Long)} call and may not be up to date! */ public Integer getProgress() { @@ -199,7 +199,7 @@ public void setProgress(Integer progress) /** * An optional list of strings that running user code may emit from time to time. Used to give an idea of the progress of the job * instance.
- * This is the value retrieved during the latest {@link JqmClient#getJob(int)} call and may not be up to date! + * This is the value retrieved during the latest {@link JqmClient#getJob(Long)} call and may not be up to date! */ public List getMessages() { diff --git a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JobRequest.java b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JobRequest.java index 086f8c21e..5d2b85b45 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JobRequest.java +++ b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JobRequest.java @@ -40,7 +40,7 @@ public interface JobRequest extends Serializable * when an internal API implementation occurs. Usually linked to a configuration issue. * @return the ID of the job instance. */ - public Integer enqueue(); + public Long enqueue(); /** * Parameters are pairs that are passed at runtime to the job. The amount of required parameters depends on the requested @@ -173,7 +173,7 @@ public interface JobRequest extends Serializable * A job instance can be the child of another job instance. This allows you to set the ID of that parent. It should be left null if * there is no parent. */ - public JobRequest setParentID(Integer parentJobId); + public JobRequest setParentID(Long parentJobId); /** * Optional
@@ -190,7 +190,7 @@ public interface JobRequest extends Serializable * This request is actually to create an occurrence of the specified recurrence. If specified, the {@link #getApplicationName()} is * ignored. */ - public JobRequest setScheduleId(Integer id); + public JobRequest setScheduleId(Long id); /** * Optional
@@ -214,7 +214,7 @@ public interface JobRequest extends Serializable * Optional
* The default behaviour for a newly submitted JobRequest is to run as soon as possible (i.e. as soon as there is a free slot inside a * JQM node). This method allows to change this, and to put the request inside the queue but not run it until the - * {@link JqmClient#resumeJob(int)} method is called on the newly created job instance. + * {@link JqmClient#resumeJob(Long)} method is called on the newly created job instance. */ public JobRequest startHeld(); diff --git a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JqmClient.java b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JqmClient.java index 9523f92a8..ac0c894bc 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JqmClient.java +++ b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/JqmClient.java @@ -44,7 +44,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - int enqueue(String applicationName, String userName); + Long enqueue(String applicationName, String userName); /** * Create a new job instance from another job instance that has successfully ended. This does not change the copied instance. Everything @@ -58,7 +58,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - int enqueueFromHistory(int jobIdToCopy); + Long enqueueFromHistory(Long jobIdToCopy); /** * Entry point of the enqueue API. Creates a new empty JobRequest object, ready to run on this client. The returned JobRequest can @@ -86,7 +86,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void cancelJob(int jobId); + void cancelJob(Long jobId); /** * Remove an enqueued job from the queue, leaving no trace of it. This is an exceptional event - usually cancelJob would be used
@@ -95,18 +95,18 @@ public interface JqmClient * * @param jobId * the id of the job to delete - * @see #cancelJob(int) the more conventional way of removing job requests. + * @see #cancelJob(Long) the more conventional way of removing job requests. * @throws JqmInvalidRequestException * when input data is invalid (job already done, job does not exist) * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void deleteJob(int jobId); + void deleteJob(Long jobId); /** * Kill a running job. Kill of a running job is not immediate, and is only possible when a job payload calls some JQM APIs. If none are * called, the job cannot be killed.
- * If the job is still waiting in queue, this is equivalent to calling {@link JqmClient#cancelJob(int)}. + * If the job is still waiting in queue, this is equivalent to calling {@link JqmClient#cancelJob(Long)}. * * @param jobId * the id of the job to kill @@ -115,7 +115,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void killJob(int jobId); + void killJob(Long jobId); /** * Remove a schedule. Effect is immediate. @@ -127,7 +127,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void removeRecurrence(int scheduleId); + void removeRecurrence(Long scheduleId); // ///////////////////////////////////////////////////////////////////// // Job Pause/restart @@ -138,32 +138,32 @@ public interface JqmClient * * @param jobId * id of the job instance to pause - * @see #resumeJob(int) resuming the paused request. + * @see #resumeJob(Long) resuming the paused request. * @throws JqmInvalidRequestException * when input data is invalid (job already running or run, job does not exist) * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void pauseQueuedJob(int jobId); + void pauseQueuedJob(Long jobId); /** * Resume a paused request and allow it to progress in queue once again. * * @param jobId * id of the job instance to resume - * @see #pauseQueuedJob(int) pause a job instance. + * @see #pauseQueuedJob(Long) pause a job instance. * @throws JqmInvalidRequestException * when input data is invalid (job already run, job does not exist...) * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void resumeQueuedJob(int jobId); + void resumeQueuedJob(Long jobId); /** - * @deprecated use {@link #resumeQueuedJob(int)} instead. + * @deprecated use {@link #resumeQueuedJob(Long)} instead. * @param jobId */ - void resumeJob(int jobId); + void resumeJob(Long jobId); /** * Signal a running job instance that it should pause. The job instance may ignore this signal if it does not call any JobManager APIs. @@ -176,11 +176,11 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void pauseRunningJob(int jobId); + void pauseRunningJob(Long jobId); /** - * Signal a job instance which was paused during its run with {@link #pauseRunningJob(int)} that it is allowed to resume. This works - * even if the pause signal was ignored by the job instance. Can be used only on job instance on which {@link #pauseRunningJob(int)} was + * Signal a job instance which was paused during its run with {@link #pauseRunningJob(Long)} that it is allowed to resume. This works + * even if the pause signal was ignored by the job instance. Can be used only on job instance on which {@link #pauseRunningJob(Long)} was * used. * * @param jobId @@ -189,7 +189,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void resumeRunningJob(int jobId); + void resumeRunningJob(Long jobId); /** * Will restart a crashed job. This will remove all trace of the failed execution. @@ -203,7 +203,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - int restartCrashedJob(int jobId); + Long restartCrashedJob(Long jobId); // ///////////////////////////////////////////////////////////////////// // Misc. @@ -221,7 +221,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void setJobQueue(int jobId, int queueId); + void setJobQueue(Long jobId, int queueId); /** * Move a job instance from a queue to another queue @@ -235,7 +235,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void setJobQueue(int jobId, Queue queue); + void setJobQueue(Long jobId, Queue queue); /** * Change the position of a waiting job instance inside a queue. @@ -249,7 +249,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - void setJobQueuePosition(int jobId, int newPosition); + void setJobQueuePosition(Long jobId, int newPosition); /** * Change the priority of a queued (waiting) or running job instance. @@ -260,7 +260,7 @@ public interface JqmClient * must be between {@link Thread#MIN_PRIORITY} and {@link Thread#MAX_PRIORITY}. Higher priority is better (runs before the * others, has more CPU share). */ - void setJobPriority(int jobId, int priority); + void setJobPriority(Long jobId, int priority); /** * Change the "do not run before" date of a waiting job. Only works on job instances already having a "do not run before" date or @@ -271,7 +271,7 @@ public interface JqmClient * @param whenToRun * the new date */ - void setJobRunAfter(int jobId, Calendar whenToRun); + void setJobRunAfter(Long jobId, Calendar whenToRun); /** * Change the cron pattern used by a schedule. It is used on next schedule evaluation. @@ -281,7 +281,7 @@ public interface JqmClient * @param cronExpression * the new expression. Validity is not tested. */ - void setScheduleRecurrence(int scheduleId, String cronExpression); + void setScheduleRecurrence(Long scheduleId, String cronExpression); /** * Change the default queue of a scheduled job. @@ -291,7 +291,7 @@ public interface JqmClient * @param queueId * the new queue to use (see {@link #getQueues()}. */ - void setScheduleQueue(int scheduleId, int queueId); + void setScheduleQueue(Long scheduleId, int queueId); /** * Change the default priority for job instances created by this schedule. @@ -302,7 +302,7 @@ public interface JqmClient * must be between {@link Thread#MIN_PRIORITY} and {@link Thread#MAX_PRIORITY}. Higher priority is better (runs before the * others, has more CPU share). */ - void setSchedulePriority(int scheduleId, int priority); + void setSchedulePriority(Long scheduleId, int priority); // ///////////////////////////////////////////////////////////////////// // Job queries @@ -320,7 +320,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - JobInstance getJob(int jobId); + JobInstance getJob(Long jobId); /** * Administrative method. List all currently running or waiting or finished job instances. @@ -372,7 +372,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - List getJobMessages(int jobId); + List getJobMessages(Long jobId); /** * Get the progress indication that may have been given by a job instance (running or done). @@ -384,7 +384,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - int getJobProgress(int jobId); + int getJobProgress(Long jobId); // ///////////////////////////////////////////////////////////////////// // Deliverables retrieval @@ -399,7 +399,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - List getJobDeliverables(int jobId); + List getJobDeliverables(Long jobId); /** * Return all files created by a job instance if any. The stream is not open: opening and closing it is the caller's responsibility.
@@ -414,7 +414,7 @@ public interface JqmClient * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - List getJobDeliverablesContent(int jobId); + List getJobDeliverablesContent(Long jobId); /** * Return one file created by a job instance. The stream is not open: opening and closing it is the caller's responsibility.
@@ -423,7 +423,7 @@ public interface JqmClient * all implementations, the engine that has run the instance must be up. * * @param file - * the file to retrieve (usually obtained through {@link #getJobDeliverables(int)}) + * the file to retrieve (usually obtained through {@link #getJobDeliverables(Long)}) * @return a stream * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. @@ -437,7 +437,7 @@ public interface JqmClient * all implementations, the engine that has run the instance must be up. * * @param fileId - * the id of the file to retrieve (usually obtained through {@link #getJobDeliverables(int)}) + * the id of the file to retrieve (usually obtained through {@link #getJobDeliverables(Long)}) * @return a stream * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. @@ -453,9 +453,9 @@ public interface JqmClient * when input data is invalid (job instance does not exist) * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. - * @see #getJobLogStdErr(int) + * @see #getJobLogStdErr(Long) */ - InputStream getJobLogStdOut(int jobId); + InputStream getJobLogStdOut(Long jobId); /** * Returns the standard error flow of of an ended job instance
@@ -466,9 +466,9 @@ public interface JqmClient * when input data is invalid (job does not exist) * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. - * @see #getJobLogStdOut(int) + * @see #getJobLogStdOut(Long) */ - InputStream getJobLogStdErr(int jobId); + InputStream getJobLogStdErr(Long jobId); // ///////////////////////////////////////////////////////////////////// // Queue API diff --git a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/Query.java b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/Query.java index 6b7ea3e1f..d082ffbb2 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/Query.java +++ b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/Query.java @@ -174,12 +174,12 @@ public SortSpec(SortOrder order, Sort column) * To QueryInterface a specific job instance. This ID is returned, for example, by the {@link JqmClient#enqueue(JobRequest)} method. *
* It is pretty useless to give any other QueryInterface parameters if you know the ID. Also note that there is a shortcut method named - * {@link JqmClient#getJob(int)} to make a QueryInterface by ID. + * {@link JqmClient#getJob(Long)} to make a QueryInterface by ID. * * @param jobInstanceId * the job instance ID */ - public Query setJobInstanceId(Integer jobInstanceId); + public Query setJobInstanceId(Long jobInstanceId); /** * Some job instances are launched by other job instances (linked jobs which launch one another). This allows to QueryInterface all job @@ -188,7 +188,7 @@ public SortSpec(SortOrder order, Sort column) * @param parentId * the ID of the parent job instance. */ - public Query setParentId(Integer parentId); + public Query setParentId(Long parentId); /** * The application name is the name of the job definition - the same name that is given in the Job Definition XML. This allows to query diff --git a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/Schedule.java b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/Schedule.java index 334c6a4b8..baef1d506 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/Schedule.java +++ b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/api/Schedule.java @@ -18,7 +18,7 @@ public class Schedule implements Serializable { private static final long serialVersionUID = -8520223502712009225L; - private int id; + private Long id; private String cronExpression; private Integer priority; private Queue queue; @@ -27,12 +27,12 @@ public class Schedule implements Serializable /** * The schedule ID. This is the same ID returned by {@link JqmClient#enqueue(JobRequest)}. */ - public int getId() + public Long getId() { return id; } - public void setId(int id) + public void setId(Long id) { this.id = id; } diff --git a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/JobRequestBaseImpl.java b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/JobRequestBaseImpl.java index e6a7d18a5..6cbec8002 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/JobRequestBaseImpl.java +++ b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/JobRequestBaseImpl.java @@ -54,8 +54,8 @@ public class JobRequestBaseImpl implements JobRequest private String keyword3; private String email = null; private String queueName = null; - private Integer parentJobId = null; - private Integer scheduleId = null; + private Long parentJobId = null; + private Long scheduleId = null; private State startState = null; private Integer priority = 0; private Map parameters = new HashMap<>(); @@ -76,7 +76,7 @@ public JobRequestBaseImpl(JqmClientEnqueueCallback enqueueCallback) } @Override - public Integer enqueue() + public Long enqueue() { return enqueueCallback.enqueue(this); } @@ -372,7 +372,7 @@ public String getParentJobId() */ public JobRequest setParentJobId(String parentJobId) { - this.parentJobId = Integer.parseInt(parentJobId); + this.parentJobId = Long.parseLong(parentJobId); return this; } @@ -381,7 +381,7 @@ public JobRequest setParentJobId(String parentJobId) * A job instance can be the child of another job instance. This allows you to retrieve the ID of that parent. It is null if there is no * parent. */ - public Integer getParentID() + public Long getParentID() { return parentJobId; } @@ -391,7 +391,7 @@ public Integer getParentID() * A job instance can be the child of another job instance. This allows you to set the ID of that parent. It should be left null if * there is no parent. */ - public JobRequest setParentID(Integer parentJobId) + public JobRequest setParentID(Long parentJobId) { this.parentJobId = parentJobId; return this; @@ -429,7 +429,7 @@ public JobRequest setQueueName(String queueName) * This request is actually to create an occurrence of the specified recurrence. If specified, the {@link #getApplicationName()} is * ignored. */ - public Integer getScheduleId() + public Long getScheduleId() { return this.scheduleId; } @@ -439,7 +439,7 @@ public Integer getScheduleId() * This request is actually to create an occurrence of the specified recurrence. If specified, the {@link #getApplicationName()} is * ignored. */ - public JobRequest setScheduleId(Integer id) + public JobRequest setScheduleId(Long id) { this.scheduleId = id; return this; @@ -493,7 +493,7 @@ public String getRecurrence() * Optional
* The default behaviour for a newly submitted JobRequest is to run as soon as possible (i.e. as soon as there is a free slot inside a * JQM node). This method allows to change this, and to put the request inside the queue but not run it until the - * {@link JqmClient#resumeJob(int)} method is called on the newly created job instance. + * {@link JqmClient#resumeJob(Long)} method is called on the newly created job instance. */ public JobRequest startHeld() { diff --git a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/JqmClientEnqueueCallback.java b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/JqmClientEnqueueCallback.java index 6d5d3d40b..9f7990428 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/JqmClientEnqueueCallback.java +++ b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/JqmClientEnqueueCallback.java @@ -22,5 +22,5 @@ public interface JqmClientEnqueueCallback * @throws JqmClientException * when an internal API implementation occurs. Usually linked to a configuration issue. */ - public int enqueue(JobRequestBaseImpl runRequest); + public Long enqueue(JobRequestBaseImpl runRequest); } diff --git a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/QueryBaseImpl.java b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/QueryBaseImpl.java index b32b69b6a..131dcad08 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/QueryBaseImpl.java +++ b/jqm-all/jqm-api-client/jqm-api-client-core/src/main/java/com/enioka/jqm/client/shared/QueryBaseImpl.java @@ -40,7 +40,7 @@ @XmlAccessorType(XmlAccessType.FIELD) public class QueryBaseImpl implements Query { - protected Integer jobInstanceId, parentId; + protected Long jobInstanceId, parentId; protected List applicationName = new ArrayList<>(); protected String user, sessionId; protected String jobDefKeyword1, jobDefKeyword2, jobDefKeyword3, jobDefModule, jobDefApplication; @@ -175,25 +175,25 @@ public void setResults(List results) // Stupid get/set // ////////////////////////////////////////// - public Integer getJobInstanceId() + public Long getJobInstanceId() { return jobInstanceId; } @Override - public Query setJobInstanceId(Integer jobInstanceId) + public Query setJobInstanceId(Long jobInstanceId) { this.jobInstanceId = jobInstanceId; return this; } - public Integer getParentId() + public Long getParentId() { return parentId; } @Override - public Query setParentId(Integer parentId) + public Query setParentId(Long parentId) { this.parentId = parentId; return this; diff --git a/jqm-all/jqm-api-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/client/jdbc/api/JdbcClient.java b/jqm-all/jqm-api-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/client/jdbc/api/JdbcClient.java index b9b9043b0..dcac6bbd8 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/client/jdbc/api/JdbcClient.java +++ b/jqm-all/jqm-api-client/jqm-api-client-jdbc/src/main/java/com/enioka/jqm/client/jdbc/api/JdbcClient.java @@ -160,7 +160,7 @@ public JobRequest newJobRequest(String applicationName, String user) } @Override - public int enqueue(JobRequestBaseImpl runRequest) + public Long enqueue(JobRequestBaseImpl runRequest) { jqmlogger.trace("BEGINING ENQUEUE - request is for application name " + runRequest.getApplicationName()); @@ -178,14 +178,14 @@ public int enqueue(JobRequestBaseImpl runRequest) } } - private int enqueueWithCnx(JobRequestBaseImpl runRequest, DbConn cnx) + private Long enqueueWithCnx(JobRequestBaseImpl runRequest, DbConn cnx) { // New schedule? if (runRequest.getRecurrence() != null && !runRequest.getRecurrence().trim().isEmpty()) { int res = createSchedule(runRequest, cnx); cnx.commit(); - return res; + return (long) res; } // Run existing schedule? @@ -249,10 +249,10 @@ private int enqueueWithCnx(JobRequestBaseImpl runRequest, DbConn cnx) Object highlanderResult = highlanderMode(jobDef, cnx); // Returns Integer if already exists, a resultset otherwise. The RS thing is // to allow to explicitely close it as required by some pools (against the // spec). - if (highlanderResult != null && highlanderResult instanceof Integer) + if (highlanderResult != null && highlanderResult instanceof Long) { jqmlogger.trace("JI won't actually be enqueued because a job in highlander mode is currently submitted: " + highlanderResult); - return (Integer) highlanderResult; + return (Long) highlanderResult; } ResultSet highlanderRs = (ResultSet) highlanderResult; @@ -321,7 +321,7 @@ else if (runRequest.getStartState() != null) // Now create the JI try { - int id = JobInstance.enqueue(cnx, startingState, queue_id, jobDef.getId(), runRequest.getApplication(), + Long id = JobInstance.enqueue(cnx, startingState, queue_id, jobDef.getId(), runRequest.getApplication(), runRequest.getParentID(), runRequest.getModule(), runRequest.getKeyword1(), runRequest.getKeyword2(), runRequest.getKeyword3(), runRequest.getSessionID(), runRequest.getUser(), runRequest.getEmail(), jobDef.isHighlander(), sj != null || runRequest.getRunAfter() != null, runRequest.getRunAfter(), priority, Instruction.RUN, prms); @@ -341,13 +341,13 @@ else if (runRequest.getStartState() != null) } @Override - public int enqueue(String applicationName, String userName) + public Long enqueue(String applicationName, String userName) { return this.newJobRequest(applicationName, userName).enqueue(); } @Override - public int enqueueFromHistory(int jobIdToCopy) + public Long enqueueFromHistory(Long jobIdToCopy) { try (DbConn cnx = getDbSession()) { @@ -369,7 +369,7 @@ private Object highlanderMode(JobDef jd, DbConn cnx) try { - Integer existing = cnx.runSelectSingle("ji_select_existing_highlander", Integer.class, jd.getId()); + Long existing = cnx.runSelectSingle("ji_select_existing_highlander", Long.class, jd.getId()); return existing; } catch (NoResultException ex) @@ -384,7 +384,7 @@ private Object highlanderMode(JobDef jd, DbConn cnx) // Now we have a lock, just retry - some other client may have created a job instance recently. try { - Integer existing = cnx.runSelectSingle("ji_select_existing_highlander", Integer.class, jd.getId()); + Long existing = cnx.runSelectSingle("ji_select_existing_highlander", Long.class, jd.getId()); rs.close(); cnx.commit(); // Do not keep the lock! return existing; @@ -414,7 +414,7 @@ private Object highlanderMode(JobDef jd, DbConn cnx) * an open DB session * @return a new execution request */ - private JobRequestBaseImpl getJobRequest(int launchId, DbConn cnx) + private JobRequestBaseImpl getJobRequest(Long launchId, DbConn cnx) { Map prms = RuntimeParameter.select_map(cnx, "jiprm_select_by_ji", launchId); ResultSet rs = cnx.runSelect("history_select_reenqueue_by_id", launchId); @@ -441,7 +441,7 @@ private JobRequestBaseImpl getJobRequest(int launchId, DbConn cnx) jd.setKeyword2(rs.getString(5)); jd.setKeyword3(rs.getString(6)); jd.setModule(rs.getString(7)); - jd.setParentID(rs.getInt(8)); + jd.setParentID(rs.getLong(8)); jd.setSessionID(rs.getString(9)); jd.setUser(rs.getString(10)); @@ -500,7 +500,7 @@ private int createSchedule(JobRequestBaseImpl jr, DbConn cnx) // ///////////////////////////////////////////////////////////////////// @Override - public void cancelJob(int idJob) + public void cancelJob(Long idJob) { jqmlogger.trace("Job instance number " + idJob + " will be cancelled"); try (DbConn cnx = getDbSession()) @@ -526,7 +526,7 @@ public void cancelJob(int idJob) } @Override - public void deleteJob(int idJob) + public void deleteJob(Long idJob) { jqmlogger.trace("Job instance number " + idJob + " will be deleted"); @@ -557,7 +557,7 @@ public void deleteJob(int idJob) } @Override - public void killJob(int idJob) + public void killJob(Long idJob) { jqmlogger.trace("Job instance number " + idJob + " will be killed (if possible)o"); @@ -594,7 +594,7 @@ public void killJob(int idJob) } @Override - public void removeRecurrence(int scheduleId) + public void removeRecurrence(Long scheduleId) { try (DbConn cnx = getDbSession()) { @@ -621,7 +621,7 @@ public void removeRecurrence(int scheduleId) // ///////////////////////////////////////////////////////////////////// @Override - public void pauseQueuedJob(int idJob) + public void pauseQueuedJob(Long idJob) { jqmlogger.trace("Job instance number " + idJob + " status will be set to HOLDED"); @@ -642,13 +642,13 @@ public void pauseQueuedJob(int idJob) } @Override - public void resumeJob(int jobId) + public void resumeJob(Long jobId) { resumeQueuedJob(jobId); } @Override - public void resumeQueuedJob(int idJob) + public void resumeQueuedJob(Long idJob) { jqmlogger.trace("Job status number " + idJob + " will be resumed"); @@ -667,7 +667,7 @@ public void resumeQueuedJob(int idJob) } } - public int restartCrashedJob(int idJob) + public Long restartCrashedJob(Long idJob) { // History and Job ID have the same ID. try (DbConn cnx = getDbSession(); ResultSet rs = cnx.runSelect("history_select_reenqueue_by_id", idJob);) @@ -685,7 +685,7 @@ public int restartCrashedJob(int idJob) jr.setKeyword2(rs.getString(5)); jr.setKeyword3(rs.getString(6)); jr.setModule(rs.getString(7)); - jr.setParentID(rs.getInt(8)); + jr.setParentID(rs.getLong(8)); jr.setSessionID(rs.getString(9)); jr.setUser(rs.getString(10)); @@ -695,7 +695,7 @@ public int restartCrashedJob(int idJob) throw new JqmClientException("You cannot restart a job that has not crashed"); } - int res = enqueue(jr); + Long res = enqueue(jr); cnx.runUpdate("history_delete_by_id", idJob); cnx.commit(); return res; @@ -711,7 +711,7 @@ public int restartCrashedJob(int idJob) } @Override - public void pauseRunningJob(int jobId) + public void pauseRunningJob(Long jobId) { jqmlogger.trace("Job instance number " + jobId + " will receive a PAUSE instruction"); @@ -731,7 +731,7 @@ public void pauseRunningJob(int jobId) } @Override - public void resumeRunningJob(int jobId) + public void resumeRunningJob(Long jobId) { jqmlogger.trace("Job instance number {}, supposed to be paused, will receive a RUN instruction", jobId); @@ -755,7 +755,7 @@ public void resumeRunningJob(int jobId) // ///////////////////////////////////////////////////////////////////// @Override - public void setJobQueue(int idJob, int idQueue) + public void setJobQueue(Long idJob, int idQueue) { try (DbConn cnx = getDbSession()) { @@ -781,13 +781,13 @@ public void setJobQueue(int idJob, int idQueue) } @Override - public void setJobQueue(int idJob, com.enioka.jqm.client.api.Queue queue) + public void setJobQueue(Long idJob, com.enioka.jqm.client.api.Queue queue) { setJobQueue(idJob, queue.getId()); } @Override - public void setJobQueuePosition(int idJob, int position) + public void setJobQueuePosition(Long idJob, int position) { try (DbConn cnx = getDbSession()) { @@ -854,7 +854,7 @@ else if (currentJobs.size() < betweenUp) } @Override - public void setJobPriority(int jobId, int priority) + public void setJobPriority(Long jobId, int priority) { try (DbConn cnx = getDbSession()) { @@ -877,7 +877,7 @@ public void setJobPriority(int jobId, int priority) } @Override - public void setJobRunAfter(int jobId, Calendar whenToRun) + public void setJobRunAfter(Long jobId, Calendar whenToRun) { try (DbConn cnx = getDbSession()) { @@ -900,7 +900,7 @@ public void setJobRunAfter(int jobId, Calendar whenToRun) } @Override - public void setScheduleRecurrence(int scheduleId, String cronExpression) + public void setScheduleRecurrence(Long scheduleId, String cronExpression) { try (DbConn cnx = getDbSession()) { @@ -923,7 +923,7 @@ public void setScheduleRecurrence(int scheduleId, String cronExpression) } @Override - public void setScheduleQueue(int scheduleId, int queueId) + public void setScheduleQueue(Long scheduleId, int queueId) { try (DbConn cnx = getDbSession()) { @@ -946,7 +946,7 @@ public void setScheduleQueue(int scheduleId, int queueId) } @Override - public void setSchedulePriority(int scheduleId, int priority) + public void setSchedulePriority(Long scheduleId, int priority) { try (DbConn cnx = getDbSession()) { @@ -1021,6 +1021,14 @@ private String getStringPredicate(String fieldName, List filterValues, L private String getIntPredicate(String fieldName, Integer filterValue, List prms) { + if (filterValue == null) { + return ""; + } + return getLongPredicate(fieldName, filterValue.longValue(), prms); + } + + + private String getLongPredicate(String fieldName, Long filterValue, List prms) { if (filterValue != null) { if (filterValue != -1) @@ -1086,7 +1094,7 @@ public List getJobs(QueryBaseImpl query) try (DbConn cnx = getDbSession()) { - Map res = new LinkedHashMap<>(); + Map res = new LinkedHashMap<>(); String wh = ""; List prms = new ArrayList<>(); @@ -1099,8 +1107,8 @@ public List getJobs(QueryBaseImpl query) if (query.isQueryLiveInstances()) { // WHERE - wh += getIntPredicate("ji.ID", query.getJobInstanceId(), prms); - wh += getIntPredicate("ji.PARENT", query.getParentId(), prms); + wh += getLongPredicate("ji.ID", query.getJobInstanceId(), prms); + wh += getLongPredicate("ji.PARENT", query.getParentId(), prms); wh += getStringPredicate("ji.APPLICATION", query.getInstanceApplication(), prms); wh += getStringPredicate("ji.MODULE", query.getInstanceModule(), prms); wh += getStringPredicate("ji.KEYWORD1", query.getInstanceKeyword1(), prms); @@ -1156,8 +1164,8 @@ public List getJobs(QueryBaseImpl query) { wh = ""; - wh += getIntPredicate("ID", query.getJobInstanceId(), prms); - wh += getIntPredicate("PARENT", query.getParentId(), prms); + wh += getLongPredicate("ID", query.getJobInstanceId(), prms); + wh += getLongPredicate("PARENT", query.getParentId(), prms); wh += getStringPredicate("INSTANCE_APPLICATION", query.getInstanceApplication(), prms); wh += getStringPredicate("INSTANCE_MODULE", query.getInstanceModule(), prms); wh += getStringPredicate("INSTANCE_KEYWORD1", query.getInstanceKeyword1(), prms); @@ -1279,8 +1287,8 @@ else if (q2.isEmpty()) // Fetch messages and parameters in batch // Optimization: fetch messages and parameters in batches of 50 (limit accepted by most databases for IN clauses). - List> ids = new ArrayList<>(); - List currentList = null; + List> ids = new ArrayList<>(); + List currentList = null; int i = 0; for (com.enioka.jqm.client.api.JobInstance ji : res.values()) { @@ -1294,19 +1302,19 @@ else if (q2.isEmpty()) } if (currentList != null && !currentList.isEmpty()) { - for (List idsBatch : ids) + for (List idsBatch : ids) { ResultSet run = cnx.runSelect("jiprm_select_by_ji_list", idsBatch); while (run.next()) { - res.get(run.getInt(2)).getParameters().put(run.getString(3), run.getString(4)); + res.get(run.getLong(2)).getParameters().put(run.getString(3), run.getString(4)); } run.close(); ResultSet msg = cnx.runSelect("message_select_by_ji_list", idsBatch); while (msg.next()) { - res.get(msg.getInt(2)).getMessages().add(msg.getString(3)); + res.get(msg.getLong(2)).getMessages().add(msg.getString(3)); } msg.close(); } @@ -1327,7 +1335,7 @@ private com.enioka.jqm.client.api.JobInstance getJob(ResultSet rs, DbConn cnx) t { com.enioka.jqm.client.api.JobInstance res = new com.enioka.jqm.client.api.JobInstance(); - res.setId(rs.getInt(1)); + res.setId(rs.getLong(1)); // res.setApplication(rs.getString(2)); res.setApplicationName(rs.getString(3)); res.setEmail(rs.getString(5)); @@ -1344,7 +1352,7 @@ private com.enioka.jqm.client.api.JobInstance getJob(ResultSet rs, DbConn cnx) t res.setDefinitionKeyword2(rs.getString(16)); res.setDefinitionKeyword3(rs.getString(17)); res.setNodeName(rs.getString(19)); - res.setParent(rs.getInt(20)); + res.setParent(rs.getLong(20)); res.setProgress(rs.getInt(21)); res.setQueueName(rs.getString(22)); res.setSessionID(rs.getString(24)); @@ -1366,7 +1374,7 @@ private com.enioka.jqm.client.api.JobInstance getJob(ResultSet rs, DbConn cnx) t } @Override - public com.enioka.jqm.client.api.JobInstance getJob(int idJob) + public com.enioka.jqm.client.api.JobInstance getJob(Long idJob) { // TODO: direct queries following previous logic, but after we have common table structures. return this.newQuery().setJobInstanceId(idJob).setQueryHistoryInstances(true).setQueryLiveInstances(true).invoke().get(0); @@ -1452,13 +1460,13 @@ public List getUserActiveJobs(String user // ///////////////////////////////////////////////////////////////////// @Override - public List getJobMessages(int idJob) + public List getJobMessages(Long idJob) { return getJob(idJob).getMessages(); } @Override - public int getJobProgress(int idJob) + public int getJobProgress(Long idJob) { return getJob(idJob).getProgress(); } @@ -1468,7 +1476,7 @@ public int getJobProgress(int idJob) // ///////////////////////////////////////////////////////////////////// @Override - public List getJobDeliverables(int idJob) + public List getJobDeliverables(Long idJob) { try (DbConn cnx = getDbSession()) { @@ -1490,7 +1498,7 @@ public List getJobDeliverables(int idJob) } @Override - public List getJobDeliverablesContent(int idJob) + public List getJobDeliverablesContent(Long idJob) { ArrayList streams = new ArrayList<>(); try (DbConn cnx = getDbSession()) @@ -1578,7 +1586,7 @@ private InputStream getDeliverableContent(Deliverable deliverable) URL url = null; try { - String uriStart = getHostForLaunch(deliverable.getJobId()); + String uriStart = getHostForLaunch(deliverable.getJobId().longValue()); url = new URL(uriStart + "/ws/simple/file?id=" + deliverable.getRandomId()); jqmlogger.trace("URL: " + url.toString()); } @@ -1599,18 +1607,18 @@ private InputStream getFile(String url) } @Override - public InputStream getJobLogStdOut(int jobId) + public InputStream getJobLogStdOut(Long jobId) { return getJobLog(jobId, ".stdout", "stdout"); } @Override - public InputStream getJobLogStdErr(int jobId) + public InputStream getJobLogStdErr(Long jobId) { return getJobLog(jobId, ".stderr", "stderr"); } - private String getHostForLaunch(int launchId) + private String getHostForLaunch(Long launchId) { String host; try (DbConn cnx = getDbSession()) @@ -1648,7 +1656,7 @@ private String getHostForLaunch(int launchId) } } - private InputStream getJobLog(int jobId, String extension, String param) + private InputStream getJobLog(Long jobId, String extension, String param) { // 1: retrieve node to address String uriStart = getHostForLaunch(jobId); diff --git a/jqm-all/jqm-api-client/jqm-api-client-jdbc/src/test/java/com/enioka/jqm/client/jdbc/api/test/BasicTest.java b/jqm-all/jqm-api-client/jqm-api-client-jdbc/src/test/java/com/enioka/jqm/client/jdbc/api/test/BasicTest.java index c0c4d5202..a32bbe791 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-jdbc/src/test/java/com/enioka/jqm/client/jdbc/api/test/BasicTest.java +++ b/jqm-all/jqm-api-client/jqm-api-client-jdbc/src/test/java/com/enioka/jqm/client/jdbc/api/test/BasicTest.java @@ -82,8 +82,8 @@ public void testQuery() q.setInstanceApplication("marsu"); q.setInstanceKeyword2("pouet"); q.setInstanceModule("module"); - q.setParentId(12); - q.setJobInstanceId(132); + q.setParentId(12L); + q.setJobInstanceId(132L); q.setQueryLiveInstances(true); q.setJobDefKeyword2("pouet2"); @@ -98,8 +98,8 @@ public void testQueryDate() q.setInstanceApplication("marsu"); q.setInstanceKeyword2("pouet"); q.setInstanceModule("module"); - q.setParentId(12); - q.setJobInstanceId(132); + q.setParentId(12L); + q.setJobInstanceId(132L); q.setQueryLiveInstances(true); q.setEnqueuedBefore(Calendar.getInstance()); @@ -206,7 +206,7 @@ public void testOnlyQueue() @Test public void testBug159() { - JqmClientFactory.getClient().newQuery().setJobInstanceId(1234).setQueryLiveInstances(true).setQueryHistoryInstances(false) + JqmClientFactory.getClient().newQuery().setJobInstanceId(1234L).setQueryLiveInstances(true).setQueryHistoryInstances(false) .setPageSize(15).setFirstRow(0).invoke(); } diff --git a/jqm-all/jqm-api-client/jqm-api-client-jersey/src/main/java/com/enioka/jqm/client/jersey/api/JerseyClient.java b/jqm-all/jqm-api-client/jqm-api-client-jersey/src/main/java/com/enioka/jqm/client/jersey/api/JerseyClient.java index 770be887f..0c88aeccd 100644 --- a/jqm-all/jqm-api-client/jqm-api-client-jersey/src/main/java/com/enioka/jqm/client/jersey/api/JerseyClient.java +++ b/jqm-all/jqm-api-client/jqm-api-client-jersey/src/main/java/com/enioka/jqm/client/jersey/api/JerseyClient.java @@ -280,7 +280,7 @@ public JobRequest newJobRequest(String applicationName, String user) } @Override - public int enqueue(JobRequestBaseImpl jd) + public Long enqueue(JobRequestBaseImpl jd) { try { @@ -298,13 +298,13 @@ public int enqueue(JobRequestBaseImpl jd) } @Override - public int enqueue(String applicationName, String userName) + public Long enqueue(String applicationName, String userName) { return newJobRequest(applicationName, userName).enqueue(); } @Override - public int enqueueFromHistory(int jobIdToCopy) + public Long enqueueFromHistory(Long jobIdToCopy) { JobInstance h = getJob(jobIdToCopy); JobRequest jd = newJobRequest(h.getApplicationName(), h.getUser()); @@ -332,7 +332,7 @@ public int enqueueFromHistory(int jobIdToCopy) /////////////////////////////////////////////////////////////////////// @Override - public void cancelJob(int idJob) + public void cancelJob(Long idJob) { try { @@ -349,7 +349,7 @@ public void cancelJob(int idJob) } @Override - public void deleteJob(int idJob) + public void deleteJob(Long idJob) { try { @@ -366,7 +366,7 @@ public void deleteJob(int idJob) } @Override - public void killJob(int idJob) + public void killJob(Long idJob) { try { @@ -383,7 +383,7 @@ public void killJob(int idJob) } @Override - public void removeRecurrence(int scheduleId) + public void removeRecurrence(Long scheduleId) { try { @@ -405,7 +405,7 @@ public void removeRecurrence(int scheduleId) /////////////////////////////////////////////////////////////////////// @Override - public void pauseQueuedJob(int idJob) + public void pauseQueuedJob(Long idJob) { try { @@ -422,7 +422,7 @@ public void pauseQueuedJob(int idJob) } @Override - public void resumeQueuedJob(int idJob) + public void resumeQueuedJob(Long idJob) { try { @@ -439,12 +439,12 @@ public void resumeQueuedJob(int idJob) } @Override - public void resumeJob(int jobId) + public void resumeJob(Long jobId) { resumeQueuedJob(jobId); } - public int restartCrashedJob(int idJob) + public Long restartCrashedJob(Long idJob) { try { @@ -461,7 +461,7 @@ public int restartCrashedJob(int idJob) } @Override - public void pauseRunningJob(int jobId) + public void pauseRunningJob(Long jobId) { try { @@ -478,7 +478,7 @@ public void pauseRunningJob(int jobId) } @Override - public void resumeRunningJob(int jobId) + public void resumeRunningJob(Long jobId) { try { @@ -499,7 +499,7 @@ public void resumeRunningJob(int jobId) /////////////////////////////////////////////////////////////////////// @Override - public void setJobQueue(int idJob, int idQueue) + public void setJobQueue(Long idJob, int idQueue) { try { @@ -516,13 +516,13 @@ public void setJobQueue(int idJob, int idQueue) } @Override - public void setJobQueue(int idJob, com.enioka.jqm.client.api.Queue queue) + public void setJobQueue(Long idJob, com.enioka.jqm.client.api.Queue queue) { setJobQueue(idJob, queue.getId()); } @Override - public void setJobQueuePosition(int idJob, int position) + public void setJobQueuePosition(Long idJob, int position) { try { @@ -539,7 +539,7 @@ public void setJobQueuePosition(int idJob, int position) } @Override - public void setJobPriority(int jobId, int priority) + public void setJobPriority(Long jobId, int priority) { try { @@ -556,7 +556,7 @@ public void setJobPriority(int jobId, int priority) } @Override - public void setJobRunAfter(int jobId, Calendar whenToRun) + public void setJobRunAfter(Long jobId, Calendar whenToRun) { try { @@ -573,7 +573,7 @@ public void setJobRunAfter(int jobId, Calendar whenToRun) } @Override - public void setScheduleQueue(int scheduleId, int queueId) + public void setScheduleQueue(Long scheduleId, int queueId) { try { @@ -590,7 +590,7 @@ public void setScheduleQueue(int scheduleId, int queueId) } @Override - public void setScheduleRecurrence(int scheduleId, String cronExpression) + public void setScheduleRecurrence(Long scheduleId, String cronExpression) { try { @@ -607,7 +607,7 @@ public void setScheduleRecurrence(int scheduleId, String cronExpression) } @Override - public void setSchedulePriority(int scheduleId, int priority) + public void setSchedulePriority(Long scheduleId, int priority) { try { @@ -628,7 +628,7 @@ public void setSchedulePriority(int scheduleId, int priority) /////////////////////////////////////////////////////////////////////// @Override - public com.enioka.jqm.client.api.JobInstance getJob(int idJob) + public com.enioka.jqm.client.api.JobInstance getJob(Long idJob) { try { @@ -725,7 +725,7 @@ public List getJobs(QueryBaseImpl query) /////////////////////////////////////////////////////////////////////// @Override - public List getJobMessages(int idJob) + public List getJobMessages(Long idJob) { try { @@ -742,7 +742,7 @@ public List getJobMessages(int idJob) } @Override - public int getJobProgress(int idJob) + public int getJobProgress(Long idJob) { try { @@ -763,7 +763,7 @@ public int getJobProgress(int idJob) /////////////////////////////////////////////////////////////////////// @Override - public List getJobDeliverables(int idJob) + public List getJobDeliverables(Long idJob) { try { @@ -782,7 +782,7 @@ public List getJobDeliverables(int idJob) } @Override - public List getJobDeliverablesContent(int idJob) + public List getJobDeliverablesContent(Long idJob) { List res = new ArrayList<>(); for (Deliverable d : getJobDeliverables(idJob)) @@ -827,7 +827,7 @@ public InputStream getDeliverableContent(int d) } @Override - public InputStream getJobLogStdErr(int jobId) + public InputStream getJobLogStdErr(Long jobId) { try { @@ -844,7 +844,7 @@ public InputStream getJobLogStdErr(int jobId) } @Override - public InputStream getJobLogStdOut(int jobId) + public InputStream getJobLogStdOut(Long jobId) { try { diff --git a/jqm-all/jqm-api/src/main/java/com/enioka/jqm/api/JobBase.java b/jqm-all/jqm-api/src/main/java/com/enioka/jqm/api/JobBase.java index 00983df33..b1f683dfa 100644 --- a/jqm-all/jqm-api/src/main/java/com/enioka/jqm/api/JobBase.java +++ b/jqm-all/jqm-api/src/main/java/com/enioka/jqm/api/JobBase.java @@ -61,13 +61,13 @@ public void sendProgress(Integer progress) jm.sendProgress(progress); } - public int enQueue(String applicationName, String user, String mail, String sessionID, String application, String module, + public long enQueue(String applicationName, String user, String mail, String sessionID, String application, String module, String keyword1, String keyword2, String keyword3, Map parameters) { return jm.enqueue(applicationName, user, mail, sessionID, application, module, keyword1, keyword2, keyword3, parameters); } - public int enQueueSynchronously(String applicationName, String user, String mail, String sessionID, String application, String module, + public long enQueueSynchronously(String applicationName, String user, String mail, String sessionID, String application, String module, String keyword1, String keyword2, String keyword3, Map parameters) { return jm.enqueueSync(applicationName, user, mail, sessionID, application, module, keyword1, keyword2, keyword3, parameters); @@ -75,7 +75,7 @@ public int enQueueSynchronously(String applicationName, String user, String mail // --------- - public Integer getParentID() + public Long getParentID() { return jm.parentID(); } @@ -145,7 +145,7 @@ public String getDefaultConnect() return jm.defaultConnect(); } - public Integer getJobInstanceId() + public Long getJobInstanceId() { return jm.jobInstanceID(); } diff --git a/jqm-all/jqm-api/src/main/java/com/enioka/jqm/api/JobManager.java b/jqm-all/jqm-api/src/main/java/com/enioka/jqm/api/JobManager.java index 9d2de7c9a..09a3b7a3b 100644 --- a/jqm-all/jqm-api/src/main/java/com/enioka/jqm/api/JobManager.java +++ b/jqm-all/jqm-api/src/main/java/com/enioka/jqm/api/JobManager.java @@ -28,7 +28,7 @@ *
* It should never be instantiated but injected by the JQM engine. For the injection to take place, the payload main class should have a * field of type JobManager (directly or through inheritance, as well as public or private). - * + * */ public interface JobManager { @@ -37,7 +37,7 @@ public interface JobManager *
* This is not the instance ID but the definition ID. See {@link #jobInstanceID()} for the instance (and not the * definition) ID - * + * * @return The unique ID of the application/Job definition (a JobInstance is one run of a JobDefinition) */ Integer jobApplicationId(); @@ -45,17 +45,17 @@ public interface JobManager /** * @return The instance ID of the JobInstance that launched this JobInstance (if any, null otherwise) */ - Integer parentID(); + Long parentID(); /** * The unique ID of the currently running job instance.
*
* This is the instance, not the application/jobdefinition ID. Use {@link #jobApplicationId()} for the job definition * (and not instance) ID. - * + * * @return The unique ID of the currently running job instance. */ - Integer jobInstanceID(); + Long jobInstanceID(); /** * @return true if this type of jobs (the JobDefinition is allowed to restart after a failure. @@ -69,70 +69,70 @@ public interface JobManager /** * Optional arbitrary user classification - * + * * @return the sessionID that was given at enqueue time, null if none. */ String sessionID(); /** * Optional arbitrary user classification - * + * * @return the application name that was given at enqueue time, null if none. */ String application(); /** * Optional arbitrary user classification - * + * * @return the applicative module name that was given at enqueue time, null if none. */ String module(); /** * Optional arbitrary user classification - * + * * @return the first keyword that was given at enqueue time, null if none. */ String keyword1(); /** * Optional arbitrary user classification - * + * * @return the second keyword that was given at enqueue time, null if none. */ String keyword2(); /** * Optional arbitrary user classification - * + * * @return the third keyword that was given at enqueue time, null if none. */ String keyword3(); - + /** * Optional arbitrary user classification - * + * * @return the first keyword that was given inside the job definition, null if none. */ String definitionKeyword1(); /** * Optional arbitrary user classification - * + * * @return the second keyword that was given inside the job definition, null if none. */ String definitionKeyword2(); /** * Optional arbitrary user classification - * + * * @return the third keyword that was given inside the job definition, null if none. */ String definitionKeyword3(); /** * Optional arbitrary user classification - * + * * @return the user name that was given at enqueue time, null if none. */ String userName(); @@ -140,7 +140,7 @@ public interface JobManager /** * Parameters are from the Job Definition (i.e. default parameters) as well as values given at enqueue time. This is the privileged way * of giving parameters to a job instance. - * + * * @return a Map of all parameters (random order) with the Map key being the name of the parameter and the * Map value the value of the parameter. */ @@ -159,7 +159,7 @@ public interface JobManager /** * Enqueues a new execution request and returns as soon as the request is posted.
* All parameters are nullable but applicationName - * + * * @param applicationName * @param user * Arbitrary user classification (not used by the JQM engine, only in reporting queries and potentially in jobs themselves) @@ -182,25 +182,25 @@ public interface JobManager * @return the ID of the new request * @see #enqueueSync sync enqueue for a synchronous variant */ - Integer enqueue(String applicationName, String user, String mail, String sessionId, String application, String module, String keyword1, + Long enqueue(String applicationName, String user, String mail, String sessionId, String application, String module, String keyword1, String keyword2, String keyword3, Map parameters); /** * Enqueues a new execution request and waits for the execution to end. - * + * * @return the ID of the new request * @see #enqueue the synchronous variant for the description of parameters */ - Integer enqueueSync(String applicationName, String user, String mail, String sessionId, String application, String module, + Long enqueueSync(String applicationName, String user, String mail, String sessionId, String application, String module, String keyword1, String keyword2, String keyword3, Map parameters); /** * Messages are strings that can be retrieved during run by other applications, so that interactive human users may have a measure of * job progress. (typical messages highlight the job's internal steps) - * + * * @param message * the message to send. At most 1000 characters. - * + * * @see #sendProgress sendProgress for sending a progress percentage (or other numeric advancement) instead of a string */ void sendMsg(String message); @@ -208,17 +208,17 @@ Integer enqueueSync(String applicationName, String user, String mail, String ses /** * Progress is an integer that can be retrieved during run by other applications, so that interactive human users may have a measure of * job progress. (typically used for percents of completion) - * + * * @param progress * the advancement - * + * * @see #sendProgress sendProgressfor sending a progress percentage (or other numeric advancement) instead of a string */ void sendProgress(Integer progress); /** * Helper. One JDBC connection is set as the default one. This function does the JNDI request to retrieve it. - * + * * @return the DataSource to the default database. * @throws NamingException */ @@ -228,12 +228,12 @@ Integer enqueueSync(String applicationName, String user, String mail, String ses * When a file is created and should be retrievable from the client API, the file must be referenced with this function.
* The file is moved by this function! Only call when you don't need the file any more.
* It is strongly advised to use {@link #getWorkDir()} to get a directory where to create your files. - * + * * @param path * absolute path to the file to make available to clients * @param fileLabel * an optional classification (only used for user queries, not the engine itself) - * + * * @return the deliverable unique ID */ Integer addDeliverable(String path, String fileLabel) throws IOException; @@ -241,7 +241,7 @@ Integer enqueueSync(String applicationName, String user, String mail, String ses /** * If temp files are necessary, use this directory. The directory already exists. It is used by a single instance. It is purged at the * end of the run. - * + * * @return a File object describing a temp directory. */ File getWorkDir(); @@ -256,11 +256,11 @@ Integer enqueueSync(String applicationName, String user, String mail, String ses /** * This method will only return after the job request of given ID is completed (be it in error or correctly). It is not guaranteed to * return as soon as the request is over - simply sometimes after it is over. - * + * * @param requestId * the ID as returned by {@link #enqueue(String, String, String, String, String, String, String, String, String, Map)} */ - void waitChild(int requestId); + void waitChild(Long requestId); /** * This method will only return after all job requests that were explicitly designated as children of the current one are completed (be @@ -274,29 +274,29 @@ Integer enqueueSync(String applicationName, String user, String mail, String ses * This methods checks if a job request was processed by an engine. It returns true if it has (be it with a gracious exit or a failure)
* Also see {@link #hasSucceeded} and {@link #hasFailed}: these methods also allow to check for end with the added value of getting the * status. - * + * * @param requestId * the ID as returned by {@link #enqueue} and variants. * @return true if ended, false otherwise */ - boolean hasEnded(int requestId); + boolean hasEnded(Long requestId); /** * This method checks if a job request was processed by an engine and ended in success. If the job is still running, null is returned. - * + * * @param requestId * the ID as returned by {@link #enqueue} and variants. * @return true if ended correctly, false if crashed, null if still waiting in queue or running. */ - Boolean hasSucceeded(int requestId); + Boolean hasSucceeded(Long requestId); /** * This method checks if a job request was processed by an engine and ended in failure. If the job is still running, null is returned. - * + * * @param requestId * the ID as returned by {@link #enqueue} and variants. * @return true if ended with an exception being raised (CRASHED status) or if was killed, false if ended correctly, null if still * waiting in queue or running. */ - Boolean hasFailed(int requestId); + Boolean hasFailed(Long requestId); } diff --git a/jqm-all/jqm-cli/src/main/java/com/enioka/jqm/cli/CommandGetJiStatus.java b/jqm-all/jqm-cli/src/main/java/com/enioka/jqm/cli/CommandGetJiStatus.java index b885a9e25..b3dd775dc 100644 --- a/jqm-all/jqm-cli/src/main/java/com/enioka/jqm/cli/CommandGetJiStatus.java +++ b/jqm-all/jqm-cli/src/main/java/com/enioka/jqm/cli/CommandGetJiStatus.java @@ -9,7 +9,7 @@ class CommandGetJiStatus extends CommandBase { @Parameter(names = { "-i", "--id" }, description = "ID of the job instance to query.", required = true) - private Integer id; + private Long id; @Override public int doWork() diff --git a/jqm-all/jqm-cli/src/main/java/com/enioka/jqm/cli/CommandStartSingle.java b/jqm-all/jqm-cli/src/main/java/com/enioka/jqm/cli/CommandStartSingle.java index f92573825..269370c6a 100644 --- a/jqm-all/jqm-cli/src/main/java/com/enioka/jqm/cli/CommandStartSingle.java +++ b/jqm-all/jqm-cli/src/main/java/com/enioka/jqm/cli/CommandStartSingle.java @@ -16,7 +16,7 @@ class CommandStartSingle extends CommandBase { @Parameter(names = { "-i", "--id" }, description = "ID of the job instance to launch.", required = true) - private int id; + private long id; @Override public int doWork() diff --git a/jqm-all/jqm-dbadapter/jqm-dbadapter-mysql/src/main/java/com/enioka/jqm/jdbc/impl/mysql/DbImplMySql.java b/jqm-all/jqm-dbadapter/jqm-dbadapter-mysql/src/main/java/com/enioka/jqm/jdbc/impl/mysql/DbImplMySql.java index f16ea96b2..7524cd096 100644 --- a/jqm-all/jqm-dbadapter/jqm-dbadapter-mysql/src/main/java/com/enioka/jqm/jdbc/impl/mysql/DbImplMySql.java +++ b/jqm-all/jqm-dbadapter/jqm-dbadapter-mysql/src/main/java/com/enioka/jqm/jdbc/impl/mysql/DbImplMySql.java @@ -142,7 +142,7 @@ public void beforeUpdate(Connection cnx, QueryPreparation q) { throw new NoResultException("The query returned zero rows when one was expected."); } - q.preGeneratedKey = rs.getInt(1); + q.preGeneratedKey = rs.getLong(1); q.parameters.add(0, q.preGeneratedKey); } catch (SQLException e) diff --git a/jqm-all/jqm-engine-api/src/main/java/com/enioka/jqm/engine/api/lifecycle/JqmSingleRunnerOperations.java b/jqm-all/jqm-engine-api/src/main/java/com/enioka/jqm/engine/api/lifecycle/JqmSingleRunnerOperations.java index f4571053d..36f7d95ac 100644 --- a/jqm-all/jqm-engine-api/src/main/java/com/enioka/jqm/engine/api/lifecycle/JqmSingleRunnerOperations.java +++ b/jqm-all/jqm-engine-api/src/main/java/com/enioka/jqm/engine/api/lifecycle/JqmSingleRunnerOperations.java @@ -11,5 +11,5 @@ public interface JqmSingleRunnerOperations * @param jobInstanceId * @return */ - public JobInstance runAtOnce(int jobInstanceId); + public JobInstance runAtOnce(Long jobInstanceId); } diff --git a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/DiscreteResourceManager.java b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/DiscreteResourceManager.java index 70eac9fa4..1599ada98 100644 --- a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/DiscreteResourceManager.java +++ b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/DiscreteResourceManager.java @@ -39,7 +39,7 @@ public class DiscreteResourceManager extends ResourceManagerBase private class Token { private AtomicBoolean free = new AtomicBoolean(true); - private int jiId = 0; + private long jiId = 0; } private int defaultConsumption; diff --git a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/Helpers.java b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/Helpers.java index 0df88643f..362d0dad3 100644 --- a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/Helpers.java +++ b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/Helpers.java @@ -114,10 +114,10 @@ static void createMessage(String textMessage, JobInstance jobInstance, DbConn cn * @param cnx * the DbConn to use. */ - static int createDeliverable(String path, String originalFileName, String fileFamily, Integer jobId, DbConn cnx) + static int createDeliverable(String path, String originalFileName, String fileFamily, Long jobId, DbConn cnx) { QueryResult qr = cnx.runUpdate("deliverable_insert", fileFamily, path, jobId, originalFileName, UUID.randomUUID().toString()); - return qr.getGeneratedId(); + return qr.getGeneratedId().intValue(); } static void checkConfiguration(String nodeName, DbConn cnx) diff --git a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/JobInstanceEngineApi.java b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/JobInstanceEngineApi.java index 9981ec477..e9968748f 100644 --- a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/JobInstanceEngineApi.java +++ b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/JobInstanceEngineApi.java @@ -88,7 +88,7 @@ public void sendProgress(Integer msg) } @Override - public Integer enqueue(String applicationName, String user, String mail, String sessionId, String application, String module, + public Long enqueue(String applicationName, String user, String mail, String sessionId, String application, String module, String keyword1, String keyword2, String keyword3, Map parameters) { JobRequest jr = getJqmClient().newJobRequest(applicationName, user); @@ -111,16 +111,16 @@ public Integer enqueue(String applicationName, String user, String mail, String } @Override - public Integer enqueueSync(String applicationName, String user, String mail, String sessionId, String application, String module, + public Long enqueueSync(String applicationName, String user, String mail, String sessionId, String application, String module, String keyword1, String keyword2, String keyword3, Map parameters) { - int i = enqueue(applicationName, user, mail, sessionId, application, module, keyword1, keyword2, keyword3, parameters); + Long i = enqueue(applicationName, user, mail, sessionId, application, module, keyword1, keyword2, keyword3, parameters); waitChild(i); return i; } @Override - public void waitChild(int id) + public void waitChild(Long id) { JqmClient c = getJqmClient(); Query q = c.newQuery().setQueryHistoryInstances(false).setQueryLiveInstances(true).setJobInstanceId(id); @@ -188,7 +188,7 @@ public Integer addDeliverable(String path, String fileLabel) @Override public File getWorkDir() { - File f = new File(FilenameUtils.concat(ji.getNode().getTmpDirectory(), Integer.toString(this.ji.getId()))); + File f = new File(FilenameUtils.concat(ji.getNode().getTmpDirectory(), Long.toString(this.ji.getId()))); if (!f.isDirectory()) { try @@ -220,7 +220,7 @@ public DataSource getDefaultConnection() throws NamingException } @Override - public boolean hasEnded(int jobId) + public boolean hasEnded(Long jobId) { try (DbConn cnx = Helpers.getNewDbSession()) { @@ -234,7 +234,7 @@ public boolean hasEnded(int jobId) } @Override - public Boolean hasSucceeded(int requestId) + public Boolean hasSucceeded(Long requestId) { try (DbConn cnx = Helpers.getNewDbSession()) { @@ -248,7 +248,7 @@ public Boolean hasSucceeded(int requestId) } @Override - public Boolean hasFailed(int requestId) + public Boolean hasFailed(Long requestId) { Boolean b = hasSucceeded(requestId); if (b == null) @@ -345,13 +345,13 @@ public Integer jobApplicationId() } @Override - public Integer parentID() + public Long parentID() { return this.ji.getParentId(); } @Override - public Integer jobInstanceID() + public Long jobInstanceID() { return this.ji.getId(); } diff --git a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/JqmSingleRunner.java b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/JqmSingleRunner.java index 1ddebaa48..ae4c9fd29 100644 --- a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/JqmSingleRunner.java +++ b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/JqmSingleRunner.java @@ -21,12 +21,12 @@ public class JqmSingleRunner implements JqmSingleRunnerOperations { private final static Logger jqmlogger = LoggerFactory.getLogger(JqmSingleRunner.class); - public JobInstance runAtOnce(int jobInstanceId) + public JobInstance runAtOnce(Long jobInstanceId) { return JqmSingleRunner.run(jobInstanceId); } - public static JobInstance run(int jobInstanceId) + public static JobInstance run(Long jobInstanceId) { jqmlogger.debug("Single runner was asked to start with ID " + jobInstanceId); DbConn cnx = Helpers.getNewDbSession(); @@ -65,7 +65,7 @@ public static JobInstance run(com.enioka.jqm.model.JobInstance job) // Parameters final int poll = Integer.parseInt(GlobalParameter.getParameter(cnx, "internalPollingPeriodMs", "10000")); - final int jobId = job.getId(); + final Long jobId = job.getId(); // Create run container RunnerManager manager = new RunnerManager(cnx); diff --git a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/QuantityResourceManager.java b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/QuantityResourceManager.java index 6f82cb4c1..8d65aa53c 100644 --- a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/QuantityResourceManager.java +++ b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/QuantityResourceManager.java @@ -30,7 +30,7 @@ public class QuantityResourceManager extends ResourceManagerBase private int previousMaxUnits = 0; private int defaultConsumption; - private Map runningJobs = new HashMap<>(10); + private Map runningJobs = new HashMap<>(10); QuantityResourceManager(ResourceManager rm) { diff --git a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/QueuePoller.java b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/QueuePoller.java index 4ed20b60c..593a25fc7 100644 --- a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/QueuePoller.java +++ b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/QueuePoller.java @@ -67,7 +67,7 @@ class QueuePoller implements Runnable, QueuePollerMBean private AtomicInteger actualNbThread = new AtomicInteger(0); private boolean hasStopped = true; private Calendar lastLoop = null; - private Map peremption = new ConcurrentHashMap<>(); + private Map peremption = new ConcurrentHashMap<>(); private List resourceManagers = new ArrayList<>(); private ResourceManager threadresourceManagerConfiguration; diff --git a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningExternalJobInstance.java b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningExternalJobInstance.java index 918bdcbc7..22c70c80e 100644 --- a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningExternalJobInstance.java +++ b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningExternalJobInstance.java @@ -27,7 +27,7 @@ class RunningExternalJobInstance implements Runnable { private static Logger jqmlogger = LoggerFactory.getLogger(RunningExternalJobInstance.class); - int jobId; + Long jobId; JobInstance ji; String opts; String logFilePath; diff --git a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningJobInstance.java b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningJobInstance.java index 88c590cbe..73c75e3ad 100644 --- a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningJobInstance.java +++ b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningJobInstance.java @@ -419,7 +419,7 @@ public ClassLoader getEngineClassloader() // Helpers /////////////////////////////////////////////////////////////////////////// - int getId() + Long getId() { return this.ji.getId(); } diff --git a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningJobInstanceManager.java b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningJobInstanceManager.java index d000348ac..b510cf9f0 100644 --- a/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningJobInstanceManager.java +++ b/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/engine/RunningJobInstanceManager.java @@ -16,7 +16,7 @@ class RunningJobInstanceManager private Logger jqmlogger = LoggerFactory.getLogger(RunningJobInstanceManager.class); private ConcurrentHashMap instancesByTracker = new ConcurrentHashMap<>(); - private ConcurrentHashMap instancesById = new ConcurrentHashMap<>(); + private ConcurrentHashMap instancesById = new ConcurrentHashMap<>(); void startNewJobInstance(JobInstance ji, QueuePoller qp) { diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ApiSimpleTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ApiSimpleTest.java index b27dfca01..22d97c025 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ApiSimpleTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ApiSimpleTest.java @@ -99,10 +99,10 @@ public void testHttpEnqueue() throws Exception String result = res.body(); - Integer jid = 0; + Long jid = 0L; try { - jid = Integer.parseInt(result); + jid = Long.parseLong(result); } catch (Exception e) { diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ClLeakTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ClLeakTest.java index 5afbb9b8c..1ed524f26 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ClLeakTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ClLeakTest.java @@ -16,7 +16,7 @@ public class ClLeakTest extends JqmBaseTest @Test public void testJmxLeak() throws Exception { - int i = JqmSimpleTest.create(cnx, "pyl.EngineJmxLeak").addWaitTime(10000).expectOk(0).run(this); + Long i = JqmSimpleTest.create(cnx, "pyl.EngineJmxLeak").addWaitTime(10000).expectOk(0).run(this); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = new ObjectName("com.test:type=Node,name=test"); diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/CliTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/CliTest.java index 1c8c79361..52dd76518 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/CliTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/CliTest.java @@ -55,7 +55,7 @@ public void testSingleLauncher() throws Exception { CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", true, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + Long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); cnx.runUpdate("ji_update_status_by_id", TestHelpers.node.getId(), i); cnx.runUpdate("debug_jj_update_node_by_id", TestHelpers.node.getId(), i); cnx.commit(); diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ClientApiTestJdbc.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ClientApiTestJdbc.java index 0cc070f7d..98806beb7 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ClientApiTestJdbc.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ClientApiTestJdbc.java @@ -46,7 +46,7 @@ public void testRestartJob() throws Exception CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", true, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + Long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); addAndStartEngine(); @@ -70,7 +70,7 @@ public void testHistoryFields() throws Exception CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other2", true, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").setSessionID("session42").setKeyword1("k1").setKeyword2("k2") + Long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").setSessionID("session42").setKeyword1("k1").setKeyword2("k2") .enqueue(); addAndStartEngine(); @@ -104,7 +104,7 @@ public void testHistoryFields() throws Exception @Test public void testKillJob() throws Exception { - int i = JqmSimpleTest.create(cnx, "pyl.KillMe").expectOk(0).addWaitTime(3000).run(this); + long i = JqmSimpleTest.create(cnx, "pyl.KillMe").expectOk(0).addWaitTime(3000).run(this); jqmClient.killJob(i); TestHelpers.waitFor(1, 3000, cnx); @@ -121,7 +121,7 @@ public void testGetMsg() throws Exception boolean success2 = false; boolean success3 = false; - int i = JqmSimpleTest.create(cnx, "pyl.EngineApiSend3Msg").run(this); + long i = JqmSimpleTest.create(cnx, "pyl.EngineApiSend3Msg").run(this); List ress = jqmClient.getJobMessages(i); @@ -151,7 +151,7 @@ public void testGetMsg() throws Exception @Test public void testGetProgress() throws Exception { - int i = JqmSimpleTest.create(cnx, "pyl.EngineApiProgress").addWaitMargin(10000).run(this); + long i = JqmSimpleTest.create(cnx, "pyl.EngineApiProgress").addWaitMargin(10000).run(this); Integer k = jqmClient.getJobProgress(i); Assert.assertEquals((Integer) 50, k); } @@ -161,7 +161,7 @@ public void testPauseInQueue() throws Exception { CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); jqmClient.pauseQueuedJob(i); jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); @@ -184,7 +184,7 @@ public void testCancelJob() throws Exception CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); jqmClient.cancelJob(i); jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); @@ -203,7 +203,7 @@ public void testChangeQueue() throws Exception CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); jqmClient.setJobQueue(i, TestHelpers.qSlow); addAndStartEngine(); @@ -221,7 +221,7 @@ public void testDelJobInQueue() throws Exception CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); jqmClient.deleteJob(i); addAndStartEngine(); @@ -236,7 +236,7 @@ public void testResumeInQueue() throws Exception { CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); jqmClient.pauseQueuedJob(i); addAndStartEngine(); @@ -253,7 +253,7 @@ public void testEnqueueWithQueue() throws Exception { CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").setQueueName("NormalQueue").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").setQueueName("NormalQueue").enqueue(); addAndStartEngine(); TestHelpers.waitFor(1, 10000, cnx); @@ -268,7 +268,7 @@ public void testEnqueueWithQueue() throws Exception @Test public void testTempDir() throws Exception { - int i = JqmSimpleTest.create(cnx, "pyl.EngineApiTmpDir").run(this); + long i = JqmSimpleTest.create(cnx, "pyl.EngineApiTmpDir").run(this); File tmpDir = new File(FilenameUtils.concat(TestHelpers.node.getTmpDirectory(), "" + i)); Assert.assertFalse(tmpDir.isDirectory()); @@ -305,7 +305,7 @@ public void testPauseResumeRunning() throws Exception { CreationTools.createJobDef(null, true, "pyl.CallYieldAtOnce", null, "jqm-tests/jqm-test-pyl/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); // Pause the JI in advance, so that it will receive the instruction on startup. jqmClient.pauseRunningJob(i); @@ -405,7 +405,7 @@ public void testChangeXVerbs() int idJobDef = CreationTools.createJobDef(null, true, "pyl.CallYieldAtOnce", null, "jqm-tests/jqm-test-pyl/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); ////////////////////////////////// // JI priority @@ -415,21 +415,21 @@ public void testChangeXVerbs() // Change it. jqmClient.setJobPriority(i, 5); - Assert.assertEquals(5, (int) jqmClient.getJob(i).getPriority()); + Assert.assertEquals(5, (long) jqmClient.getJob(i).getPriority()); ////////////////////////////////// // JI run after Calendar after = Calendar.getInstance(); after.add(Calendar.YEAR, 1); - int i2 = jqmClient.newJobRequest("MarsuApplication", "TestUser").setRunAfter(after).enqueue(); + long i2 = jqmClient.newJobRequest("MarsuApplication", "TestUser").setRunAfter(after).enqueue(); after = Calendar.getInstance(); after.add(Calendar.YEAR, -1); jqmClient.setJobRunAfter(i2, after); Assert.assertTrue(com.enioka.jqm.model.JobInstance.select_id(cnx, i2).getNotBefore().before(Calendar.getInstance())); - int i4 = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i4 = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); Assert.assertNull(com.enioka.jqm.model.JobInstance.select_id(cnx, i4).getNotBefore()); jqmClient.setJobRunAfter(i4, after); Assert.assertTrue(com.enioka.jqm.model.JobInstance.select_id(cnx, i4).getNotBefore().before(Calendar.getInstance())); @@ -437,7 +437,7 @@ public void testChangeXVerbs() ////////////////////////////////// // Schedule - int i3 = jqmClient.newJobRequest("MarsuApplication", "TestUser").setPriority(3).setRecurrence("* * * * *").enqueue(); + Long i3 = jqmClient.newJobRequest("MarsuApplication", "TestUser").setPriority(3).setRecurrence("* * * * *").enqueue(); JobDefDto jd = MetaService.getJobDef(cnx, idJobDef); Assert.assertEquals(3, (int) jd.getSchedules().get(0).getPriority()); @@ -479,14 +479,14 @@ public void testMiscVerbs() jds = jqmClient.getJobDefinitions("AppTag"); Assert.assertEquals(1, jds.size()); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); addAndStartEngine(); TestHelpers.waitFor(1, 5000, cnx); jqmClient.enqueueFromHistory(i); TestHelpers.waitFor(2, 5000, cnx); - int idRec = jqmClient.newJobRequest("MarsuApplication", "TestUser").setRecurrence("* * * * *").enqueue(); + long idRec = jqmClient.newJobRequest("MarsuApplication", "TestUser").setRecurrence("* * * * *").enqueue(); Assert.assertEquals(1, MetaService.getJobDef(cnx, idJobDef1).getSchedules().size()); jqmClient.removeRecurrence(idRec); Assert.assertEquals(0, MetaService.getJobDef(cnx, idJobDef1).getSchedules().size()); @@ -515,7 +515,7 @@ public void testStartHeld() CreationTools.createJobDef(null, true, "pyl.EngineApiSendMsg", null, "jqm-tests/jqm-test-pyl/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", true, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "testuser").startHeld().enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "testuser").startHeld().enqueue(); addAndStartEngine(); // Should not run. diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/DeliverableTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/DeliverableTest.java index eb6e912bc..2339c5c68 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/DeliverableTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/DeliverableTest.java @@ -52,7 +52,7 @@ public void testGetDeliverables() throws Exception GlobalParameter.setParameter(cnx, "enableWsApiSsl", "false"); cnx.commit(); - int id = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) + Long id = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) .addDefParameter("fileName", "jqm-test-deliverable1.txt").run(this); this.waitForWsStart(); @@ -75,7 +75,7 @@ public void testGetOneDeliverableWithAuth() throws Exception GlobalParameter.setParameter(cnx, "enableWsApiSsl", "false"); cnx.commit(); - int jobId = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) + long jobId = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) .addDefParameter("fileName", "jqm-test-deliverable2.txt").run(this); this.waitForWsStart(); @@ -105,7 +105,7 @@ public void testGetOneDeliverableWithoutAuth() throws Exception GlobalParameter.setParameter(cnx, "enableWsApiSsl", "false"); cnx.commit(); - int jobId = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) + long jobId = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) .addDefParameter("fileName", "jqm-test-deliverable3.txt").run(this); this.waitForWsStart(); @@ -139,7 +139,7 @@ public void testGetOneDeliverableWithAuthWithSsl() throws Exception JqmClientFactory.setProperty("com.enioka.jqm.ws.truststorePass", "SuperPassword"); jqmClient = JqmClientFactory.getClient(); - int jobId = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) + long jobId = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) .addDefParameter("fileName", "jqm-test-deliverable4.txt").run(this); this.waitForWsStart(); @@ -163,7 +163,7 @@ public void testGetOneDeliverableWithAuthWithSsl() throws Exception @Test public void testGetAllDeliverables() throws Exception { - int jobId = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) + long jobId = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) .addDefParameter("fileName", "jqm-test-deliverable5.txt").run(this); List tmp = jqmClient.getJobDeliverables(jobId); diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/EngineApiTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/EngineApiTest.java index 644b86df6..864de2b82 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/EngineApiTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/EngineApiTest.java @@ -34,7 +34,7 @@ public void testSendMsg() throws Exception boolean success2 = false; boolean success3 = false; - int i = JqmSimpleTest.create(cnx, "pyl.EngineApiSend3Msg").run(this); + Long i = JqmSimpleTest.create(cnx, "pyl.EngineApiSend3Msg").run(this); List messages = jqmClient.newQuery().setJobInstanceId(i).invoke().get(0).getMessages(); for (String msg : messages) diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ExternalTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ExternalTest.java index 7ca151fed..7259b0646 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ExternalTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ExternalTest.java @@ -33,7 +33,7 @@ public void testExternalKill() throws Exception GlobalParameter.setParameter(cnx, "internalPollingPeriodMs", "100"); cnx.commit(); - int i = JqmSimpleTest.create(cnx, "pyl.KillMeNot").setExternal().expectNonOk(0).expectOk(0).run(this); + Long i = JqmSimpleTest.create(cnx, "pyl.KillMeNot").setExternal().expectNonOk(0).expectOk(0).run(this); TestHelpers.waitForRunning(1, 20000, cnx); jqmClient.killJob(i); diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/HighlanderTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/HighlanderTest.java index 3c54089f8..23a4d0ad1 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/HighlanderTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/HighlanderTest.java @@ -119,7 +119,7 @@ public void testHighlanderEngineRunning() throws Exception addAndStartEngine(); - int firstJob = jqmClient.newJobRequest("kill", "TestUser").enqueue(); + long firstJob = jqmClient.newJobRequest("kill", "TestUser").enqueue(); for (int i = 0; i < 100; i++) { jqmClient.newJobRequest("kill", "TestUser").enqueue(); @@ -166,15 +166,15 @@ public void testHighlanderMultiNodeBug195() throws Exception CreationTools.createJobDef(null, true, "pyl.KillMe", null, "jqm-tests/jqm-test-pyl/target/test.jar", q, 42, "WithoutH", null, "Franquin", "WithoutH", "other", "other", false, cnx); - int i1 = jqmClient.newJobRequest("WithH", "TestUser").enqueue(); + long i1 = jqmClient.newJobRequest("WithH", "TestUser").enqueue(); addAndStartEngine(); addAndStartEngine("localhost4"); TestHelpers.waitForRunning(1, 5000, cnx); - int i2 = jqmClient.newJobRequest("WithH", "TestUser").enqueue(); + long i2 = jqmClient.newJobRequest("WithH", "TestUser").enqueue(); sleep(2); - int i3 = jqmClient.newJobRequest("WithoutH", "TestUser").enqueue(); + long i3 = jqmClient.newJobRequest("WithoutH", "TestUser").enqueue(); TestHelpers.waitForRunning(2, 5000, cnx); sleep(1); // Additional - check no more than two running! diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JettyTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JettyTest.java index d5738372c..839877b1a 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JettyTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JettyTest.java @@ -83,7 +83,7 @@ public void testSslServices() throws Exception // Launch a job so as to be able to query its status later CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", true, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); TestHelpers.waitFor(1, 10000, cnx); // HTTPS client - with @@ -127,7 +127,7 @@ public void testSslClientCert() throws Exception // Launch a job so as to be able to query its status later CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", true, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); TestHelpers.waitFor(1, 10000, cnx); // Server auth against trusted CA root certificate diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JmxTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JmxTest.java index 03abc8c16..e66ff9bd3 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JmxTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JmxTest.java @@ -43,7 +43,7 @@ public void jmxRemoteTest() throws Exception { CreationTools.createJobDef(null, true, "pyl.KillMe", null, "jqm-tests/jqm-test-pyl/target/test.jar", TestHelpers.qVip, 42, "KillApp", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); - int i = jqmClient.newJobRequest("KillApp", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("KillApp", "TestUser").enqueue(); // Set JMX server on free ports ServerSocket s1 = new ServerSocket(0); @@ -96,7 +96,7 @@ public void jmxRemoteTest() throws Exception } JavaJobInstanceTrackerMBean proxy = JMX.newMBeanProxy(mbsc, killBean, JavaJobInstanceTrackerMBean.class); Assert.assertEquals("KillApp", proxy.getApplicationName()); - Assert.assertEquals((Integer) i, proxy.getId()); + Assert.assertEquals((Long) i, proxy.getId()); Assert.assertEquals("TestUser", proxy.getUser()); // Elements that are not set or testable reproductibly, but should not raise any exception diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JqmSimpleTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JqmSimpleTest.java index 6416d9fc3..193ee78bd 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JqmSimpleTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/JqmSimpleTest.java @@ -104,7 +104,7 @@ public JqmSimpleTest addWaitMargin(int ms) return this; } - public Integer run(JqmBaseTest test) + public Long run(JqmBaseTest test) { int nbExpected = expectedNonOk + expectedOk; @@ -112,7 +112,7 @@ public Integer run(JqmBaseTest test) { test.addAndStartEngine(nodeName); } - Integer i = JqmClientFactory.getClient().newJobRequest("TestJqmApplication", "TestUser").setSessionID(sessionId) + Long i = JqmClientFactory.getClient().newJobRequest("TestJqmApplication", "TestUser").setSessionID(sessionId) .setParameters(runtimePrms).enqueue(); TestHelpers.waitFor(nbExpected, 9000 + waitMarginMs + nbExpected * 2000, cnx); if (waitMsMin > 0) diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/LogTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/LogTest.java index aa77bdfce..71f412e1f 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/LogTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/LogTest.java @@ -34,7 +34,7 @@ public void testMultiLog() throws Exception CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", true, cnx); cnx.commit(); - int i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("MarsuApplication", "TestUser").enqueue(); addAndStartEngine(); TestHelpers.waitFor(1, 20000, cnx); diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/MiscTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/MiscTest.java index 07353eca4..612f4acea 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/MiscTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/MiscTest.java @@ -196,7 +196,7 @@ public void testStartupCleanupRunning() throws Exception null, "Franquin", "ModuleMachin", "other", "other", false, cnx); /// Create a running job that should be cleaned at startup - int i1 = jqmClient.enqueue("jqm-test-em", "test"); + long i1 = jqmClient.enqueue("jqm-test-em", "test"); cnx.runUpdate("ji_update_status_by_id", TestHelpers.node.getId(), i1); cnx.runUpdate("jj_update_run_by_id", i1); cnx.commit(); @@ -215,7 +215,7 @@ public void testStartupCleanupAttr() throws Exception null, "Franquin", "ModuleMachin", "other", "other", false, cnx); // Create a running job that should be cleaned at startup - int i = jqmClient.enqueue("jqm-test-em", "test"); + long i = jqmClient.enqueue("jqm-test-em", "test"); cnx.runUpdate("ji_update_status_by_id", TestHelpers.node.getId(), i); cnx.commit(); diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/NoApiPayloadTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/NoApiPayloadTest.java index abef3e35e..2929f51b0 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/NoApiPayloadTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/NoApiPayloadTest.java @@ -116,7 +116,7 @@ public void testDisabledPayload() throws Exception public void testMainTypeInjectWithFullApi() throws Exception { // Here, engine API + full API mix. - int i = JqmSimpleTest.create(cnx, "pyl.EngineApiInject", "jqm-test-pyl-hibapi").setSessionId("123X").expectOk(3).run(this); + long i = JqmSimpleTest.create(cnx, "pyl.EngineApiInject", "jqm-test-pyl-hibapi").setSessionId("123X").expectOk(3).run(this); Assert.assertEquals(1, jqmClient.getJob(i).getMessages().size()); // 1 message per run created by payload Assert.assertEquals(100, (int) jqmClient.getJob(i).getProgress()); diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/QueueTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/QueueTest.java index 6b59d3e34..8d142a457 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/QueueTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/QueueTest.java @@ -32,11 +32,11 @@ public void testQueueWidth() throws Exception "jqm-test-kill", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); cnx.commit(); - int i1 = jqmClient.enqueue("jqm-test-kill", "test"); - int i2 = jqmClient.enqueue("jqm-test-kill", "test"); - int i3 = jqmClient.enqueue("jqm-test-kill", "test"); - int i4 = jqmClient.enqueue("jqm-test-kill", "test"); - int i5 = jqmClient.enqueue("jqm-test-kill", "test"); + long i1 = jqmClient.enqueue("jqm-test-kill", "test"); + long i2 = jqmClient.enqueue("jqm-test-kill", "test"); + long i3 = jqmClient.enqueue("jqm-test-kill", "test"); + long i4 = jqmClient.enqueue("jqm-test-kill", "test"); + long i5 = jqmClient.enqueue("jqm-test-kill", "test"); addAndStartEngine(); @@ -44,8 +44,8 @@ public void testQueueWidth() throws Exception TestHelpers.waitForRunning(3, 10000, cnx); Thread.sleep(3000); // Additional wait time to ensure no additional starts - jqmlogger.debug("COUNT RUNNING " + cnx.runSelectSingle("ji_select_count_running", Integer.class)); - jqmlogger.debug("COUNT ALL " + cnx.runSelectSingle("ji_select_count_all", Integer.class)); + jqmlogger.debug("COUNT RUNNING " + cnx.runSelectSingle("ji_select_count_running", Long.class)); + jqmlogger.debug("COUNT ALL " + cnx.runSelectSingle("ji_select_count_all", Long.class)); Assert.assertEquals(3, jqmClient.newQuery().setQueryLiveInstances(true).setQueryHistoryInstances(false) .addStatusFilter(com.enioka.jqm.client.api.State.RUNNING).invoke().size()); Assert.assertEquals(2, jqmClient.newQuery().setQueryLiveInstances(true).setQueryHistoryInstances(false) @@ -138,8 +138,8 @@ public void testPriority() throws Exception cnx.commit(); // Enqueue a low priority first, then a higher priority one. The higher priority should run first. - int i1 = jqmClient.newJobRequest("jqm-test-wait", "test").addParameter("ms", "100").setPriority(1).enqueue(); - int i2 = jqmClient.newJobRequest("jqm-test-wait", "test").addParameter("ms", "100").setPriority(6).enqueue(); + long i1 = jqmClient.newJobRequest("jqm-test-wait", "test").addParameter("ms", "100").setPriority(1).enqueue(); + long i2 = jqmClient.newJobRequest("jqm-test-wait", "test").addParameter("ms", "100").setPriority(6).enqueue(); addAndStartEngine(); @@ -184,8 +184,8 @@ public void testFifo() throws Exception cnx.commit(); // No priority = FIFO queue. - int i1 = jqmClient.newJobRequest("jqm-test-wait", "test").addParameter("ms", "100").setPriority(null).enqueue(); - int i2 = jqmClient.newJobRequest("jqm-test-wait", "test").addParameter("ms", "100").setPriority(null).enqueue(); + long i1 = jqmClient.newJobRequest("jqm-test-wait", "test").addParameter("ms", "100").setPriority(null).enqueue(); + long i2 = jqmClient.newJobRequest("jqm-test-wait", "test").addParameter("ms", "100").setPriority(null).enqueue(); addAndStartEngine(); displayAllQueueTable(); @@ -220,8 +220,8 @@ public void testTakingMultipleResources() throws Exception "jqm-test-wait-single", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); cnx.commit(); - int i1 = jqmClient.newJobRequest("jqm-test-wait-single", "test").setPriority(null).enqueue(); - int i2 = jqmClient.newJobRequest("jqm-test-wait-dual", "test").setPriority(null).enqueue(); + long i1 = jqmClient.newJobRequest("jqm-test-wait-single", "test").setPriority(null).enqueue(); + long i2 = jqmClient.newJobRequest("jqm-test-wait-dual", "test").setPriority(null).enqueue(); addAndStartEngine(); @@ -255,7 +255,7 @@ public void testRmParameterCleanup() throws Exception "jqm-test-kill", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); cnx.commit(); - int i1 = jqmClient.newJobRequest("jqm-test-kill", "test").setPriority(null).enqueue(); + long i1 = jqmClient.newJobRequest("jqm-test-kill", "test").setPriority(null).enqueue(); addAndStartEngine(); TestHelpers.waitFor(1, 60000, cnx); @@ -302,7 +302,7 @@ public void testRmDiscrete() throws Exception Assert.assertEquals(3, TestHelpers.getQueueAllCount(cnx)); // Kill one, the last JI should start after the kill - int toKill = jqmClient.newQuery().setQueryHistoryInstances(false).setQueryLiveInstances(true).addStatusFilter(State.RUNNING) + long toKill = jqmClient.newQuery().setQueryHistoryInstances(false).setQueryLiveInstances(true).addStatusFilter(State.RUNNING) .invoke().get(0).getId(); jqmClient.killJob(toKill); diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/SchedulerTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/SchedulerTest.java index 01dc59b20..4a786b2ae 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/SchedulerTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/SchedulerTest.java @@ -119,7 +119,7 @@ public void testSimpleSchedule() int id = CreationTools.createJobDef(null, true, "pyl.EngineApiSendMsg", null, "jqm-tests/jqm-test-pyl/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", true, cnx); - int scheduleId = jqmClient.newJobRequest("MarsuApplication", "test user").setRecurrence("* * * * *").addParameter("key1", "value1") + Long scheduleId = jqmClient.newJobRequest("MarsuApplication", "test user").setRecurrence("* * * * *").addParameter("key1", "value1") .enqueue(); JobDef jd_client = jqmClient.getJobDefinition("MarsuApplication"); @@ -176,7 +176,7 @@ public void testStartHeld() CreationTools.createJobDef(null, true, "pyl.EngineApiSendMsg", null, "jqm-tests/jqm-test-pyl/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", true, cnx); - int i = jqmClient.newJobRequest("MarsuApplication", "testuser").startHeld().enqueue(); + Long i = jqmClient.newJobRequest("MarsuApplication", "testuser").startHeld().enqueue(); addAndStartEngine(); // Should not run. diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ShellRunnerTest.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ShellRunnerTest.java index 87f39d9dc..b910defd9 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ShellRunnerTest.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ShellRunnerTest.java @@ -154,7 +154,7 @@ public void testKill() "module1", "kw1", "kw2", null, false, cnx, null, false, null, false, PathType.DEFAULTSHELLCOMMAND); } - int i = jqmClient.newJobRequest("TestApp1", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("TestApp1", "TestUser").enqueue(); GlobalParameter.setParameter(cnx, "internalPollingPeriodMs", "500"); cnx.commit(); @@ -184,7 +184,7 @@ public void testShellDelivery() PathType.DEFAULTSHELLCOMMAND); } - int i = jqmClient.newJobRequest("TestApp1", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("TestApp1", "TestUser").enqueue(); GlobalParameter.setParameter(cnx, "internalPollingPeriodMs", "500"); cnx.commit(); diff --git a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ShellRunnerTestWithSimpleApi.java b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ShellRunnerTestWithSimpleApi.java index fe0b2e1e7..687702050 100644 --- a/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ShellRunnerTestWithSimpleApi.java +++ b/jqm-all/jqm-integration-tests/src/test/java/com/enioka/jqm/integration/tests/ShellRunnerTestWithSimpleApi.java @@ -75,7 +75,7 @@ public void testApiCallFromShellJob() throws IOException "module1", "kw1", "kw2", null, false, cnx, null, false, null, false, PathType.DEFAULTSHELLCOMMAND); } - int i = jqmClient.newJobRequest("TestApp1", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("TestApp1", "TestUser").enqueue(); addAndStartEngine(); TestHelpers.waitFor(2, 20000, cnx); @@ -104,7 +104,7 @@ public void testShellDelivery() PathType.DEFAULTSHELLCOMMAND); } - int i = jqmClient.newJobRequest("TestApp1", "TestUser").enqueue(); + long i = jqmClient.newJobRequest("TestApp1", "TestUser").enqueue(); GlobalParameter.setParameter(cnx, "internalPollingPeriodMs", "500"); addAndStartEngine(); diff --git a/jqm-all/jqm-model-updater/jqm-model-updater-liquibase/src/main/resources/liquibase-xml/changelogs/changelog-3.0.0.xml b/jqm-all/jqm-model-updater/jqm-model-updater-liquibase/src/main/resources/liquibase-xml/changelogs/changelog-3.0.0.xml index 6fc73c348..a1c2476fb 100644 --- a/jqm-all/jqm-model-updater/jqm-model-updater-liquibase/src/main/resources/liquibase-xml/changelogs/changelog-3.0.0.xml +++ b/jqm-all/jqm-model-updater/jqm-model-updater-liquibase/src/main/resources/liquibase-xml/changelogs/changelog-3.0.0.xml @@ -247,7 +247,7 @@ - + @@ -300,7 +300,7 @@ - + @@ -781,4 +781,4 @@ - \ No newline at end of file + diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbConn.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbConn.java index 4fd27b119..eb4818b2e 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbConn.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbConn.java @@ -113,7 +113,7 @@ public QueryResult runUpdate(String query_key, Object... params) { try { - qr.generatedKey = gen.getInt(1); + qr.generatedKey = gen.getLong(1); } catch (SQLException e) { diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/QueryPreparation.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/QueryPreparation.java index fb6c29bca..ceda9b324 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/QueryPreparation.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/QueryPreparation.java @@ -23,7 +23,7 @@ public class QueryPreparation * If you know in advance the key which will be used for an INSERTed object, put it here. Ignore for other queries and when keys are * generated by the database. */ - public Integer preGeneratedKey = null; + public Long preGeneratedKey = null; /** * It true, the query should lock the results. diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/QueryResult.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/QueryResult.java index 6e23015fa..094ca2e07 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/QueryResult.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/QueryResult.java @@ -3,9 +3,9 @@ public class QueryResult { public int nbUpdated = 0; - public Integer generatedKey = null; + public Long generatedKey = null; - public Integer getGeneratedId() + public Long getGeneratedId() { return generatedKey; } diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Cl.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Cl.java index a09b56614..18c321798 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Cl.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Cl.java @@ -229,7 +229,7 @@ public static int create(DbConn cnx, String name, boolean childFirst, String hid String allowedRunners) { QueryResult r = cnx.runUpdate("cl_insert", name, childFirst, hiddenClasses, tracing, persistent, allowedRunners); - int newId = r.getGeneratedId(); + int newId = r.getGeneratedId().intValue(); return newId; } diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/ClHandler.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/ClHandler.java index f460aa410..df1987e3f 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/ClHandler.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/ClHandler.java @@ -132,7 +132,7 @@ public static List select(DbConn cnx, String query_key, Object... arg public static int create(DbConn cnx, ClEvent type, String className, int classloaderId, Map parameters) { QueryResult r = cnx.runUpdate("cleh_insert", type, className, classloaderId); - int newId = r.getGeneratedId(); + int newId = r.getGeneratedId().intValue(); for (Map.Entry prm : parameters.entrySet()) { diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Deliverable.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Deliverable.java index d82565972..b974ffab8 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Deliverable.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Deliverable.java @@ -41,7 +41,7 @@ public class Deliverable implements Serializable protected String fileFamily; - private Integer jobId; + private Long jobId; private String randomId; @@ -67,7 +67,7 @@ public void setFileFamily(final String fileFamily) * ID of the {@link JobInstance} which created this {@link Deliverable}. This is also the ID of the {@link History} object once the * {@link JobInstance} has finished (and therefore disappeared) */ - public Integer getJobId() + public Long getJobId() { return jobId; } @@ -75,7 +75,7 @@ public Integer getJobId() /** * See {@link #getJobId()} */ - public void setJobId(final Integer jobId) + public void setJobId(final Long jobId) { this.jobId = jobId; @@ -181,7 +181,7 @@ public static List select(DbConn cnx, String query_key, Object... a tmp.id = rs.getInt(1); tmp.fileFamily = rs.getString(2); tmp.filePath = rs.getString(3); - tmp.jobId = rs.getInt(4); + tmp.jobId = rs.getLong(4); tmp.originalFileName = rs.getString(5); tmp.randomId = rs.getString(6); diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/DeploymentParameter.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/DeploymentParameter.java index 991f0a98a..5e252a8f0 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/DeploymentParameter.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/DeploymentParameter.java @@ -190,7 +190,7 @@ public static DeploymentParameter create(DbConn cnx, Boolean enabled, Integer no { QueryResult r = cnx.runUpdate("dp_insert", enabled, nbThread, pollingInterval, nodeId, qId); DeploymentParameter res = new DeploymentParameter(); - res.id = r.getGeneratedId(); + res.id = r.getGeneratedId().intValue(); res.node = nodeId; res.nbThread = nbThread; res.pollingInterval = pollingInterval; diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java index 3a5577ec0..d51ddb872 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/GlobalParameter.java @@ -111,7 +111,7 @@ public static GlobalParameter create(DbConn cnx, String key, String value) { QueryResult r = cnx.runUpdate("globalprm_insert", key, value); GlobalParameter res = new GlobalParameter(); - res.id = r.getGeneratedId(); + res.id = r.getGeneratedId().intValue(); res.key = key; res.value = value; return res; diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/History.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/History.java index feccccc21..a7fb0e100 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/History.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/History.java @@ -616,7 +616,7 @@ public static void create(DbConn cnx, JobInstance ji, State finalState, Calendar * Create an History object from a {@link JobInstance}. (if it does not exist, exception). * */ - public static void create(DbConn cnx, int launchId, State finalState, Calendar endDate) + public static void create(DbConn cnx, Long launchId, State finalState, Calendar endDate) { JobInstance ji = JobInstance.select_id(cnx, launchId); create(cnx, ji, finalState, endDate); diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JndiObjectResource.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JndiObjectResource.java index fbed57e1c..e09a8f25a 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JndiObjectResource.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JndiObjectResource.java @@ -230,7 +230,7 @@ public static int create(DbConn cnx, String jndiAlias, String className, String Map parameters) { QueryResult r = cnx.runUpdate("jndi_insert", description, factoryClass, jndiAlias, singleton, (String) null, className); - int newId = r.getGeneratedId(); + int newId = r.getGeneratedId().intValue(); for (Map.Entry prms : parameters.entrySet()) { diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDef.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDef.java index 505acf9f9..0ea067057 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDef.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDef.java @@ -519,7 +519,7 @@ public static int create(DbConn cnx, String description, String javaClassName, M { QueryResult r = cnx.runUpdate("jd_insert", application, applicationName, classLoaderId, description, true, false, highlander, jarPath, javaClassName, null, keyword1, keyword2, keyword3, maxTimeRunning, module, pathType.toString(), queue_id); - int newId = r.getGeneratedId(); + int newId = r.getGeneratedId().intValue(); if (parameters != null) { diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDefParameter.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDefParameter.java index dd4080f45..67cb3a853 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDefParameter.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobDefParameter.java @@ -166,6 +166,6 @@ public static Map select_map(DbConn cnx, String query_key, Objec public static int create(DbConn cnx, String key, String value, int jdId) { QueryResult qr = cnx.runUpdate("jdprm_insert", key, value, jdId); - return qr.getGeneratedId(); + return qr.getGeneratedId().intValue(); } } diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobInstance.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobInstance.java index 3cb05cf4f..4bee35bdc 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobInstance.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/JobInstance.java @@ -40,7 +40,7 @@ public class JobInstance implements Serializable { private static final long serialVersionUID = -7710486847228806301L; - private Integer id; + private Long id; private int jd_id; private int queue_id; @@ -53,7 +53,7 @@ public class JobInstance implements Serializable private boolean highlander; private boolean fromSchedule; - private Integer parentId; + private Long parentId; private String email; private Integer progress; @@ -98,7 +98,7 @@ public RuntimeParameter addParameter(String key, String value) /** * A technical ID without any meaning. Generated by the database. */ - public int getId() + public Long getId() { return id; } @@ -270,7 +270,7 @@ public void setInternalPosition(double internalPosition) /** * Only set when a job request is created by a running job, in which case it contains the job {@link JobInstance} ID. */ - public Integer getParentId() + public Long getParentId() { return parentId; } @@ -278,7 +278,7 @@ public Integer getParentId() /** * See {@link #getParentId()} */ - public void setParentId(Integer parentId) + public void setParentId(Long parentId) { this.parentId = parentId; } @@ -379,7 +379,7 @@ public void setKeyword3(String keyword3) this.instanceKeyword3 = keyword3; } - void setId(Integer id) + void setId(Long id) { this.id = id; } @@ -493,7 +493,7 @@ public static List select(DbConn cnx, String query_key, Object... a { JobInstance tmp = new JobInstance(); - tmp.id = rs.getInt(1); + tmp.id = rs.getLong(1); tmp.attributionDate = cnx.getCal(rs, 2); tmp.creationDate = cnx.getCal(rs, 3); @@ -505,7 +505,7 @@ public static List select(DbConn cnx, String query_key, Object... a tmp.instanceKeyword3 = rs.getString(9); tmp.instanceModule = rs.getString(10); tmp.internalPosition = rs.getDouble(11); - tmp.parentId = rs.getInt(12); + tmp.parentId = rs.getLong(12); tmp.progress = rs.getInt(13); tmp.sessionID = rs.getString(14); tmp.state = State.valueOf(rs.getString(15)); @@ -533,7 +533,7 @@ public static List select(DbConn cnx, String query_key, Object... a return res; } - public static JobInstance select_id(DbConn cnx, int id) + public static JobInstance select_id(DbConn cnx, Long id) { List res = select(cnx, "ji_select_by_id", id); if (res.isEmpty()) @@ -548,7 +548,7 @@ public static JobInstance select_id(DbConn cnx, int id) return res.get(0); } - public static void delete_id(DbConn cnx, int id) + public static void delete_id(DbConn cnx, Long id) { QueryResult res = cnx.runUpdate("ji_delete_by_id", id); if (res.nbUpdated != 1) @@ -557,14 +557,14 @@ public static void delete_id(DbConn cnx, int id) } } - public static int enqueue(DbConn cnx, State status, int queue_id, int job_id, String application, Integer parentId, String module, + public static Long enqueue(DbConn cnx, State status, int queue_id, int job_id, String application, Long parentId, String module, String keyword1, String keyword2, String keyword3, String sessionId, String userName, String email, boolean highlander, boolean fromSchedule, Calendar notBefore, int priority, Instruction instruction, Map prms) { QueryResult qr = cnx.runUpdate("ji_insert_enqueue", email, application, keyword1, keyword2, keyword3, module, parentId, sessionId, status, userName, job_id, queue_id, highlander, fromSchedule, notBefore, priority, instruction); - int newId = qr.getGeneratedId(); + Long newId = qr.getGeneratedId(); if (prms != null) { diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Message.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Message.java index 5b7c492a9..c08ccab42 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Message.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Message.java @@ -37,7 +37,7 @@ public class Message implements Serializable private String textMessage; - private int ji; + private Long ji; /** * A technical ID without any meaning. Generated by the database. @@ -75,7 +75,7 @@ public void setTextMessage(final String textMessage) /** * The ID of the corresponding JobInstance or History */ - public int getJi() + public Long getJi() { return ji; } @@ -83,7 +83,7 @@ public int getJi() /** * See {@link #getJi()} */ - public void setJi(int ji) + public void setJi(Long ji) { this.ji = ji; } @@ -91,10 +91,10 @@ public void setJi(int ji) /** * Create a new entry in the database. No commit performed. */ - public static int create(DbConn cnx, String textMessage, Integer jobId) + public static int create(DbConn cnx, String textMessage, Long jobId) { QueryResult r = cnx.runUpdate("message_insert", jobId, textMessage); - return r.getGeneratedId(); + return r.getGeneratedId().intValue(); } } diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Node.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Node.java index d0e6f938c..e2aafed21 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Node.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Node.java @@ -335,7 +335,7 @@ public static Node create(DbConn cnx, String nodeName, Integer port, String dlRe QueryResult r = cnx.runUpdate("node_insert", dlRepo, dns, true, 0, 0, false, false, true, nodeName, port, repo, logLevel, false, tmpDir); Node res = new Node(); - res.id = r.getGeneratedId(); + res.id = r.getGeneratedId().intValue(); res.name = nodeName; res.dns = dns; res.port = port; diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/PKI.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/PKI.java index 91c8d8974..36ecbb7ba 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/PKI.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/PKI.java @@ -123,6 +123,6 @@ public static PKI select_key(DbConn cnx, String key) public static int create(DbConn cnx, String alias, String pemPK, String pemCert) { QueryResult qr = cnx.runUpdate("pki_insert", pemCert, pemPK, alias); - return qr.getGeneratedId(); + return qr.getGeneratedId().intValue(); } } diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Queue.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Queue.java index d734d83ab..91e855a5a 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Queue.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/Queue.java @@ -132,7 +132,7 @@ public static Integer create(DbConn cnx, String name, String description, boolea { QueryResult r = cnx.runUpdate("q_insert", defaultQ, description, name); Queue res = new Queue(); - res.id = r.getGeneratedId(); + res.id = r.getGeneratedId().intValue(); res.name = name; res.description = description; res.defaultQueue = defaultQ; diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RRole.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RRole.java index f33d32d14..061e80284 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RRole.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RRole.java @@ -102,7 +102,7 @@ public static List select(DbConn cnx, String query_key, Object... args) public static void create(DbConn cnx, String roleName, String description, String... permissions) { QueryResult r = cnx.runUpdate("role_insert", description, roleName); - int newId = r.getGeneratedId(); + int newId = r.getGeneratedId().intValue(); for (String s : permissions) { diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RUser.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RUser.java index 9fcde9968..24b3c2df7 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RUser.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RUser.java @@ -215,7 +215,7 @@ public static int create(DbConn cnx, String login, String password_hash, String String... role_names) { QueryResult r = cnx.runUpdate("user_insert", null, expiration, null, password_salt, internal, false, login, password_hash); - int newId = r.getGeneratedId(); + int newId = r.getGeneratedId().intValue(); for (String s : role_names) { diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RuntimeParameter.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RuntimeParameter.java index 7800544b6..2c075d83e 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RuntimeParameter.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/RuntimeParameter.java @@ -41,7 +41,7 @@ public class RuntimeParameter implements Serializable private String key; private String value; - private int ji; + private Long ji; /** * The name of the parameter.
@@ -93,7 +93,7 @@ void setId(final Integer id) /** * ID of the History or JoBinstance to which this parameter belongs. */ - public int getJi() + public Long getJi() { return ji; } @@ -101,7 +101,7 @@ public int getJi() /** * See {@link #getJi()} */ - public void setJi(int ji) + public void setJi(Long ji) { this.ji = ji; } @@ -123,7 +123,7 @@ public static Map select_map(DbConn cnx, String query_key, Objec return res; } - public static void create(DbConn cnx, int jobInstanceId, String keyName, String value) + public static void create(DbConn cnx, Long jobInstanceId, String keyName, String value) { cnx.runUpdate("jiprm_insert", jobInstanceId, keyName, value); } diff --git a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/ScheduledJob.java b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/ScheduledJob.java index 02248de69..a6dea3ae6 100644 --- a/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/ScheduledJob.java +++ b/jqm-all/jqm-model/src/main/java/com/enioka/jqm/model/ScheduledJob.java @@ -18,7 +18,7 @@ */ public class ScheduledJob { - private int id; + private Long id; private Integer jobDefinition; @@ -32,12 +32,12 @@ public class ScheduledJob private Map parametersCache = new HashMap<>(); - public int getId() + public Long getId() { return id; } - public void setId(int id) + public void setId(Long id) { this.id = id; } @@ -100,8 +100,8 @@ public void setPriority(Integer priority) public static List select(DbConn cnx, String query_key, Object... args) { List res = new ArrayList<>(); - List currentIdList = null; - List> allIdLists = new ArrayList<>(); + List currentIdList = null; + List> allIdLists = new ArrayList<>(); ScheduledJob tmp = null; try (ResultSet rs = cnx.runSelect(query_key, args)) { @@ -109,7 +109,7 @@ public static List select(DbConn cnx, String query_key, Object... { // ID, CRON_EXPRESSION, JOBDEF, QUEUE, LAST_UPDATED tmp = new ScheduledJob(); - tmp.setId(rs.getInt(1)); + tmp.setId(rs.getLong(1)); tmp.setCronExpression(rs.getString(2)); tmp.setJobDefinition(rs.getInt(3)); tmp.setQueue(rs.getInt(4) > 0 ? rs.getInt(4) : null); @@ -133,7 +133,7 @@ public static List select(DbConn cnx, String query_key, Object... // Batch fetch parameters, 500 by 500. int currentSJ = 0; - for (List ids : allIdLists) + for (List ids : allIdLists) { try (ResultSet rs = cnx.runSelect("sjprm_select_for_sj_list", ids);) { @@ -170,6 +170,6 @@ public static int create(DbConn cnx, String cronExpression, Integer jobDefId, In cnx.runUpdate("sjprm_insert", e.getKey(), e.getValue(), r.generatedKey); } - return r.generatedKey; + return r.generatedKey.intValue(); } } diff --git a/jqm-all/jqm-runner/jqm-runner-java-api/src/main/java/com/enioka/jqm/runner/java/api/jmx/JavaJobInstanceTrackerMBean.java b/jqm-all/jqm-runner/jqm-runner-java-api/src/main/java/com/enioka/jqm/runner/java/api/jmx/JavaJobInstanceTrackerMBean.java index ef6f6c332..bf100e6c8 100644 --- a/jqm-all/jqm-runner/jqm-runner-java-api/src/main/java/com/enioka/jqm/runner/java/api/jmx/JavaJobInstanceTrackerMBean.java +++ b/jqm-all/jqm-runner/jqm-runner-java-api/src/main/java/com/enioka/jqm/runner/java/api/jmx/JavaJobInstanceTrackerMBean.java @@ -74,7 +74,7 @@ public interface JavaJobInstanceTrackerMBean /** * The unique ID of the launch. It holds no special meaning. */ - Integer getId(); + Long getId(); /** * Number of seconds the job instance has been running. diff --git a/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/runner/java/EngineApiProxy.java b/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/runner/java/EngineApiProxy.java index 6e6d29649..86929c7b2 100644 --- a/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/runner/java/EngineApiProxy.java +++ b/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/runner/java/EngineApiProxy.java @@ -160,22 +160,22 @@ else if ("addDeliverable".equals(methodName) && classes.length == 2 && classes[0 { return this.api.addDeliverable((String) args[0], (String) args[1]); } - else if ("waitChild".equals(methodName) && classes.length == 1 && (args[0] instanceof Integer)) + else if ("waitChild".equals(methodName) && classes.length == 1 && (args[0] instanceof Long)) { - this.api.waitChild((Integer) args[0]); + this.api.waitChild((Long) args[0]); return null; } - else if ("hasEnded".equals(methodName) && classes.length == 1 && (args[0] instanceof Integer)) + else if ("hasEnded".equals(methodName) && classes.length == 1 && (args[0] instanceof Long)) { - return this.api.hasEnded((Integer) args[0]); + return this.api.hasEnded((Long) args[0]); } - else if ("hasSucceeded".equals(methodName) && classes.length == 1 && (args[0] instanceof Integer)) + else if ("hasSucceeded".equals(methodName) && classes.length == 1 && (args[0] instanceof Long)) { - return this.api.hasSucceeded((Integer) args[0]); + return this.api.hasSucceeded((Long) args[0]); } - else if ("hasFailed".equals(methodName) && classes.length == 1 && (args[0] instanceof Integer)) + else if ("hasFailed".equals(methodName) && classes.length == 1 && (args[0] instanceof Long)) { - return this.api.hasFailed((Integer) args[0]); + return this.api.hasFailed((Long) args[0]); } throw new NoSuchMethodException(methodName); diff --git a/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/runner/java/JavaJobInstanceTracker.java b/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/runner/java/JavaJobInstanceTracker.java index 6838fb45a..542efb12d 100644 --- a/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/runner/java/JavaJobInstanceTracker.java +++ b/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/runner/java/JavaJobInstanceTracker.java @@ -253,7 +253,7 @@ public String getSessionId() } @Override - public Integer getId() + public Long getId() { return this.job.getId(); } diff --git a/jqm-all/jqm-runner/jqm-runner-shell-api/src/main/java/com/enioka/jqm/runner/shell/api/jmx/ShellJobInstanceTrackerMBean.java b/jqm-all/jqm-runner/jqm-runner-shell-api/src/main/java/com/enioka/jqm/runner/shell/api/jmx/ShellJobInstanceTrackerMBean.java index 9bf152988..03877cdf8 100644 --- a/jqm-all/jqm-runner/jqm-runner-shell-api/src/main/java/com/enioka/jqm/runner/shell/api/jmx/ShellJobInstanceTrackerMBean.java +++ b/jqm-all/jqm-runner/jqm-runner-shell-api/src/main/java/com/enioka/jqm/runner/shell/api/jmx/ShellJobInstanceTrackerMBean.java @@ -59,5 +59,5 @@ public interface ShellJobInstanceTrackerMBean /** * The unique ID of the launch. It holds no special meaning. */ - Integer getId(); + Long getId(); } diff --git a/jqm-all/jqm-runner/jqm-runner-shell/src/main/java/com/enioka/jqm/runner/shell/ShellJobInstanceTracker.java b/jqm-all/jqm-runner/jqm-runner-shell/src/main/java/com/enioka/jqm/runner/shell/ShellJobInstanceTracker.java index e36cf4355..b7870bc92 100644 --- a/jqm-all/jqm-runner/jqm-runner-shell/src/main/java/com/enioka/jqm/runner/shell/ShellJobInstanceTracker.java +++ b/jqm-all/jqm-runner/jqm-runner-shell/src/main/java/com/enioka/jqm/runner/shell/ShellJobInstanceTracker.java @@ -271,7 +271,7 @@ public String getSessionId() } @Override - public Integer getId() + public Long getId() { return this.ji.getId(); } diff --git a/jqm-all/jqm-tests/jqm-test-pyl-hibapi/src/main/java/pyl/EngineApiInject.java b/jqm-all/jqm-tests/jqm-test-pyl-hibapi/src/main/java/pyl/EngineApiInject.java index b11b26380..fda122131 100644 --- a/jqm-all/jqm-tests/jqm-test-pyl-hibapi/src/main/java/pyl/EngineApiInject.java +++ b/jqm-all/jqm-tests/jqm-test-pyl-hibapi/src/main/java/pyl/EngineApiInject.java @@ -98,7 +98,7 @@ public static void main(String[] args) Map prms = new HashMap<>(); prms.put("rr", "2nd run"); System.out.println("creating a new async job instance request"); - int i = jm.enqueue(jm.applicationName(), null, null, null, jm.application(), jm.module(), null, null, null, prms); + long i = jm.enqueue(jm.applicationName(), null, null, null, jm.application(), jm.module(), null, null, null, prms); System.out.println("New request is number " + i); jm.sendProgress(66); diff --git a/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiGetStatus.java b/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiGetStatus.java index b3786c79b..e1fa9ae4e 100644 --- a/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiGetStatus.java +++ b/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiGetStatus.java @@ -43,11 +43,11 @@ public void run() Map prms = new HashMap<>(); prms.put("fail", "1"); - int failId = jm.enqueueSync(jm.applicationName(), jm.userName(), null, null, null, null, null, null, null, prms); + long failId = jm.enqueueSync(jm.applicationName(), jm.userName(), null, null, null, null, null, null, null, prms); prms = new HashMap<>(); prms.put("succeed", "1"); - int successId = jm.enqueueSync(jm.applicationName(), jm.userName(), null, null, null, null, null, null, null, prms); + long successId = jm.enqueueSync(jm.applicationName(), jm.userName(), null, null, null, null, null, null, null, prms); if (!jm.hasEnded(failId)) { diff --git a/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiInject.java b/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiInject.java index c2fa6a9fb..6abc32aaf 100644 --- a/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiInject.java +++ b/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiInject.java @@ -99,7 +99,7 @@ public static void main(String[] args) Map prms = new HashMap<>(); prms.put("rr", "2nd run"); System.out.println("creating a new async job instance request"); - int i = jm.enqueue(jm.applicationName(), null, null, null, jm.application(), jm.module(), null, null, null, prms); + long i = jm.enqueue(jm.applicationName(), null, null, null, jm.application(), jm.module(), null, null, null, prms); System.out.println("New request is number " + i); jm.sendProgress(66); diff --git a/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiInjectThread.java b/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiInjectThread.java index 0bd0385d9..e090e63dd 100644 --- a/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiInjectThread.java +++ b/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/EngineApiInjectThread.java @@ -95,7 +95,7 @@ public void run() Map prms = new HashMap<>(); prms.put("rr", "2nd run"); System.out.println("creating a new async job instance request"); - int i = jm.enqueue(jm.applicationName(), null, null, null, jm.application(), jm.module(), null, null, null, prms); + long i = jm.enqueue(jm.applicationName(), null, null, null, jm.application(), jm.module(), null, null, null, prms); System.out.println("New request is number " + i); jm.sendProgress(66); diff --git a/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/StressFiboSync.java b/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/StressFiboSync.java index 6819753e2..7a738e3fe 100644 --- a/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/StressFiboSync.java +++ b/jqm-all/jqm-tests/jqm-test-pyl/src/main/java/pyl/StressFiboSync.java @@ -34,7 +34,7 @@ public void start() if (Integer.parseInt(this.getParameters().get("p1")) <= 100) { - int i = enQueueSynchronously(jm.applicationName(), "Luke", null, null, null, null, null, null, null, p); + Long i = enQueueSynchronously(jm.applicationName(), "Luke", null, null, null, null, null, null, null, p); System.out.println("Synchronous job finished: " + i); } diff --git a/jqm-all/jqm-tests/jqm-test-spring-2/src/main/java/com/enioka/jqm/spring/job/Job2.java b/jqm-all/jqm-tests/jqm-test-spring-2/src/main/java/com/enioka/jqm/spring/job/Job2.java index e01b5a2b4..64a0296aa 100644 --- a/jqm-all/jqm-tests/jqm-test-spring-2/src/main/java/com/enioka/jqm/spring/job/Job2.java +++ b/jqm-all/jqm-tests/jqm-test-spring-2/src/main/java/com/enioka/jqm/spring/job/Job2.java @@ -99,7 +99,7 @@ public void run() // Test calling JM methods JobManager jm = jmp.getObject(); System.out.println("Job instance ID is " + jm.jobInstanceID()); - int instanceId = jm.jobInstanceID(); + long instanceId = jm.jobInstanceID(); jm.enqueueSync("Job1", jm.userName(), null, null, null, jm.module(), null, null, null, jm.parameters()); if (instanceId != jmp.getObject().jobInstanceID()) diff --git a/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/JqmAsynchronousTesterOsgi.java b/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/JqmAsynchronousTesterOsgi.java index 46cadf209..1a98ad444 100644 --- a/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/JqmAsynchronousTesterOsgi.java +++ b/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/JqmAsynchronousTesterOsgi.java @@ -227,7 +227,7 @@ public JqmAsynchronousTester start() } @Override - public int enqueue(String name) + public Long enqueue(String name) { return JqmClientFactory.getClient().newJobRequest(name, "test").enqueue(); } diff --git a/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/JqmSynchronousTesterOsgi.java b/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/JqmSynchronousTesterOsgi.java index 46fdf4df3..33e1c0f34 100644 --- a/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/JqmSynchronousTesterOsgi.java +++ b/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/JqmSynchronousTesterOsgi.java @@ -44,7 +44,7 @@ public class JqmSynchronousTesterOsgi implements JqmSynchronousTester private Node node = null; private Integer jd = null; private Integer q = null; - private Integer ji = null; + private Long ji = null; // Just for dependency. @Reference diff --git a/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/api/JqmAsynchronousTester.java b/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/api/JqmAsynchronousTester.java index dac02ca74..315b980aa 100644 --- a/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/api/JqmAsynchronousTester.java +++ b/jqm-all/jqm-tst-osgi/src/main/java/com/enioka/jqm/tester/api/JqmAsynchronousTester.java @@ -138,7 +138,7 @@ public interface JqmAsynchronousTester * * @return the request ID. */ - public int enqueue(String name); + public Long enqueue(String name); /** * Wait for a given amount of ended job instances (OK or KO). diff --git a/jqm-all/jqm-tst/src/main/java/com/enioka/jqm/test/JqmAsynchonousTesterJse.java b/jqm-all/jqm-tst/src/main/java/com/enioka/jqm/test/JqmAsynchonousTesterJse.java index 55ddaba52..a57e4a228 100644 --- a/jqm-all/jqm-tst/src/main/java/com/enioka/jqm/test/JqmAsynchonousTesterJse.java +++ b/jqm-all/jqm-tst/src/main/java/com/enioka/jqm/test/JqmAsynchonousTesterJse.java @@ -116,7 +116,7 @@ public JqmAsynchronousTester start() } @Override - public int enqueue(String name) + public Long enqueue(String name) { return tester.enqueue(name); } diff --git a/jqm-all/jqm-tst/src/test/java/com/enioka/jqm/test/JqmTesterAsyncTest2.java b/jqm-all/jqm-tst/src/test/java/com/enioka/jqm/test/JqmTesterAsyncTest2.java index 471e9cfd2..8de084712 100644 --- a/jqm-all/jqm-tst/src/test/java/com/enioka/jqm/test/JqmTesterAsyncTest2.java +++ b/jqm-all/jqm-tst/src/test/java/com/enioka/jqm/test/JqmTesterAsyncTest2.java @@ -79,7 +79,7 @@ public void testFour() throws IOException .addSimpleJobDefinitionFromLibrary("payload1", "pyl.EngineApiSendDeliverable", "../jqm-tests/jqm-test-pyl/target/test.jar") .start(); - int jobId = JqmClientFactory.getClient().newJobRequest("payload1", "tesuser").addParameter("fileName", "marsu.txt") + long jobId = JqmClientFactory.getClient().newJobRequest("payload1", "tesuser").addParameter("fileName", "marsu.txt") .addParameter("filepath", "./").enqueue(); tester.waitForResults(1, 10000, 0); diff --git a/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/ws/api/ServiceClient.java b/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/ws/api/ServiceClient.java index e2c8aaf2f..e5677c174 100644 --- a/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/ws/api/ServiceClient.java +++ b/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/ws/api/ServiceClient.java @@ -104,7 +104,7 @@ public JobInstance enqueueObject(JobRequestBaseImpl jd) target.startHeld(); } - int i = target.enqueue(); + Long i = target.enqueue(); JobInstance ji = new JobInstance(); ji.setId(i); @@ -131,74 +131,74 @@ public int enqueue(String applicationName, String userName) @Path("ji/{id}") @POST - public int enqueueFromHistory(@PathParam("id") int jobIdToCopy) + public Long enqueueFromHistory(@PathParam("id") Long jobIdToCopy) { return JqmClientFactory.getClient().enqueueFromHistory(jobIdToCopy); } @Path("ji/cancelled/{jobId}") @POST - public void cancelJob(@PathParam("jobId") int jobId) + public void cancelJob(@PathParam("jobId") Long jobId) { JqmClientFactory.getClient().cancelJob(jobId); } @Path("ji/waiting/{jobId}") @DELETE - public void deleteJob(@PathParam("jobId") int jobId) + public void deleteJob(@PathParam("jobId") Long jobId) { JqmClientFactory.getClient().deleteJob(jobId); } @Path("ji/killed/{jobId}") @POST - public void killJob(@PathParam("jobId") int jobId) + public void killJob(@PathParam("jobId") Long jobId) { JqmClientFactory.getClient().killJob(jobId); } @Path("schedule/{scheduleId}") @DELETE - public void removeRecurrence(@PathParam("scheduleId") int scheduleId) + public void removeRecurrence(@PathParam("scheduleId") Long scheduleId) { JqmClientFactory.getClient().removeRecurrence(scheduleId); } @Path("ji/paused/{jobId}") @POST - public void pauseQueuedJob(@PathParam("jobId") int jobId) + public void pauseQueuedJob(@PathParam("jobId") Long jobId) { JqmClientFactory.getClient().pauseQueuedJob(jobId); } @Path("ji/paused/{jobId}") @DELETE - public void resumeQueuedJob(@PathParam("jobId") int jobId) + public void resumeQueuedJob(@PathParam("jobId") Long jobId) { JqmClientFactory.getClient().resumeQueuedJob(jobId); } - public void resumeJob(@PathParam("jobId") int jobId) + public void resumeJob(@PathParam("jobId") Long jobId) { resumeQueuedJob(jobId); } @Path("ji/running/paused/{jobId}") @POST - public void pauseRunningJob(@PathParam("jobId") int jobId) + public void pauseRunningJob(@PathParam("jobId") Long jobId) { JqmClientFactory.getClient().pauseRunningJob(jobId); } @Path("ji/running/paused/{jobId}") @DELETE - public void resumeRunningJob(@PathParam("jobId") int jobId) + public void resumeRunningJob(@PathParam("jobId") Long jobId) { JqmClientFactory.getClient().resumeRunningJob(jobId); } // Not exposed directly - we prefer objects to primitive types - public int restartCrashedJob(int jobId) + public int restartCrashedJob(Long jobId) { return 0; } @@ -206,48 +206,48 @@ public int restartCrashedJob(int jobId) @Path("ji/crashed/{jobId}") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @DELETE - public JobInstance restartCrashedJobObject(@PathParam("jobId") int jobId) + public JobInstance restartCrashedJobObject(@PathParam("jobId") Long jobId) { - int i = JqmClientFactory.getClient().restartCrashedJob(jobId); + Long i = JqmClientFactory.getClient().restartCrashedJob(jobId); return getJob(i); } @Path("q/{queueId: [0-9]+}/{jobId: [0-9]+}") @POST - public void setJobQueue(@PathParam("jobId") int jobId, @PathParam("queueId") int queueId) + public void setJobQueue(@PathParam("jobId") Long jobId, @PathParam("queueId") int queueId) { JqmClientFactory.getClient().setJobQueue(jobId, queueId); } // No need to expose. Client side work. - public void setJobQueue(int jobId, Queue queue) + public void setJobQueue(Long jobId, Queue queue) { JqmClientFactory.getClient().setJobQueue(jobId, queue); } @POST @Path("ji/{jobId}/position/{newPosition}") - public void setJobQueuePosition(@PathParam("jobId") int jobId, @PathParam("newPosition") int newPosition) + public void setJobQueuePosition(@PathParam("jobId") Long jobId, @PathParam("newPosition") int newPosition) { JqmClientFactory.getClient().setJobQueuePosition(jobId, newPosition); } @POST @Path("ji/{jobId}/priority/{priority}") - public void setJobPriority(@PathParam("jobId") int jobId, @PathParam("priority") int priority) + public void setJobPriority(@PathParam("jobId") Long jobId, @PathParam("priority") int priority) { JqmClientFactory.getClient().setJobPriority(jobId, priority); } - public void setJobRunAfter(@PathParam("jobId") int jobId, @PathParam("whenToRun") Calendar whenToRun) + public void setJobRunAfter(@PathParam("jobId") Long jobId, @PathParam("whenToRun") Calendar whenToRun) { JqmClientFactory.getClient().setJobRunAfter(jobId, whenToRun); } @POST @Path("ji/{jobId}/delay/{whenToRun}") - public void setJobRunAfter(@PathParam("jobId") int jobId, @PathParam("whenToRun") long whenToRun) + public void setJobRunAfter(@PathParam("jobId") Long jobId, @PathParam("whenToRun") long whenToRun) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(whenToRun); @@ -256,21 +256,21 @@ public void setJobRunAfter(@PathParam("jobId") int jobId, @PathParam("whenToRun" @POST @Path("schedule/{scheduleId}/queue/{queueId}") - public void setScheduleQueue(@PathParam("scheduleId") int scheduleId, @PathParam("queueId") int queueId) + public void setScheduleQueue(@PathParam("scheduleId") Long scheduleId, @PathParam("queueId") int queueId) { JqmClientFactory.getClient().setScheduleQueue(scheduleId, queueId); } @POST @Path("schedule/{scheduleId}/cron/{cronExpression}") - public void setScheduleRecurrence(@PathParam("scheduleId") int scheduleId, @PathParam("cronExpression") String cronExpression) + public void setScheduleRecurrence(@PathParam("scheduleId") Long scheduleId, @PathParam("cronExpression") String cronExpression) { JqmClientFactory.getClient().setScheduleRecurrence(scheduleId, cronExpression); } @POST @Path("schedule/{scheduleId}/priority/{priority}") - public void setSchedulePriority(@PathParam("scheduleId") int scheduleId, @PathParam("priority") int priority) + public void setSchedulePriority(@PathParam("scheduleId") Long scheduleId, @PathParam("priority") int priority) { JqmClientFactory.getClient().setSchedulePriority(scheduleId, priority); } @@ -279,7 +279,7 @@ public void setSchedulePriority(@PathParam("scheduleId") int scheduleId, @PathPa @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Path("ji/{jobId}") @HttpCache("public, max-age=60") - public JobInstance getJob(@PathParam("jobId") int jobId) + public JobInstance getJob(@PathParam("jobId") Long jobId) { return JqmClientFactory.getClient().getJob(jobId); } @@ -358,7 +358,7 @@ public Query getJobsQuery(QueryBaseImpl query) @GET @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @HttpCache("public, max-age=60") - public List getJobMessages(@PathParam("jobId") int jobId) + public List getJobMessages(@PathParam("jobId") Long jobId) { return JqmClientFactory.getClient().getJobMessages(jobId); } @@ -374,7 +374,7 @@ public int getJobProgress(int jobId) @GET @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @HttpCache("public, max-age=60") - public List getJobDeliverables(@PathParam("jobId") int jobId) + public List getJobDeliverables(@PathParam("jobId") Long jobId) { return JqmClientFactory.getClient().getJobDeliverables(jobId); } @@ -382,7 +382,7 @@ public List getJobDeliverables(@PathParam("jobId") int jobId) // Not exposed. Returning a list of files is a joke anyway... Loop should be // client-side. - public List getJobDeliverablesContent(int jobId) + public List getJobDeliverablesContent(Long jobId) { throw new NotSupportedException(); } @@ -411,7 +411,7 @@ public InputStream getDeliverableContent(@PathParam("id") int delId, @Context Ht @Path("ji/{jobId}/stderr") @Produces("application/octet-stream") @GET - public InputStream getJobLogStdErr(@PathParam("jobId") int jobId, @Context HttpServletResponse res) + public InputStream getJobLogStdErr(@PathParam("jobId") Long jobId, @Context HttpServletResponse res) { SelfDestructFileStream fs = (SelfDestructFileStream) JqmClientFactory.getClient().getJobLogStdErr(jobId); res.setHeader("Content-Disposition", "attachment; filename=" + fs.nameHint); @@ -421,7 +421,7 @@ public InputStream getJobLogStdErr(@PathParam("jobId") int jobId, @Context HttpS @Path("ji/{jobId}/stdout") @Produces("application/octet-stream") @GET - public InputStream getJobLogStdOut(@PathParam("jobId") int jobId, @Context HttpServletResponse res) + public InputStream getJobLogStdOut(@PathParam("jobId") Long jobId, @Context HttpServletResponse res) { SelfDestructFileStream fs = (SelfDestructFileStream) JqmClientFactory.getClient().getJobLogStdOut(jobId); res.setHeader("Content-Disposition", "attachment; filename=" + fs.nameHint); diff --git a/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/ws/api/ServiceSimple.java b/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/ws/api/ServiceSimple.java index c415160bf..6d653be9c 100644 --- a/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/ws/api/ServiceSimple.java +++ b/jqm-all/jqm-ws/src/main/java/com/enioka/jqm/ws/api/ServiceSimple.java @@ -117,7 +117,7 @@ private Node getLocalNodeIfRunningOnJqm() @GET @Path("status") @Produces(MediaType.TEXT_PLAIN) - public String getStatus(@QueryParam("id") int id) + public String getStatus(@QueryParam("id") Long id) { return JqmClientFactory.getClient().getJob(id).getState().toString(); } @@ -254,7 +254,7 @@ private String getUserName(@Context SecurityContext security) @Produces(MediaType.TEXT_PLAIN) public String enqueue(@FormParam("applicationname") String applicationName, @FormParam("module") String module, @FormParam("mail") String mail, @FormParam("keyword1") String keyword1, @FormParam("keyword2") String keyword2, - @FormParam("keyword3") String keyword3, @FormParam("parentid") Integer parentId, @FormParam("user") String user, + @FormParam("keyword3") String keyword3, @FormParam("parentid") Long parentId, @FormParam("user") String user, @FormParam("sessionid") String sessionId, @FormParam("parameterNames") List prmNames, @FormParam("parameterValues") List prmValues, @Context SecurityContext security) { @@ -289,7 +289,7 @@ public String enqueue(@FormParam("applicationname") String applicationName, @For log.trace("Adding a parameter: " + name + " - " + value); } - Integer i = jd.enqueue(); + Long i = jd.enqueue(); return i.toString(); }