Review Board 1.7.22


SQOOP-1065 Sqoop2: Remove special lock object in FrameworkManager

Review Request #11602 - Created June 3, 2013 and submitted

Jarek Cecho
SQOOP-1065
Reviewers
Sqoop
sqoop-sqoop2
I've removed the lock object and used the class itself.
Unit and integration tests seems to be passing.

Diff revision 2 (Latest)

1 2
1 2

  1. core/src/main/java/org/apache/sqoop/framework/JobManager.java: Loading...
core/src/main/java/org/apache/sqoop/framework/JobManager.java
Revision fd9aac91b4623fada4af8c7dc7113ea163fc3019 New Change
[20] 133 lines
[+20] [+] public static void setInstance(JobManager newInstance) {
134
    * Number of milliseconds for update thread to slepp.
134
    * Number of milliseconds for update thread to slepp.
135
    */
135
    */
136
   private long updateSleep;
136
   private long updateSleep;
137

    
   
137

   
138
   /**
138
   /**
139
    * Mutex for creating new submissions. We're not allowing more then one

   
140
    * running submission for one job.

   
141
    */

   
142
   private final Object submissionMutex = new Object();

   
143

    
   

   
144
   /**

   
145
    * Base notification URL.
139
    * Base notification URL.
146
    *
140
    *
147
    * Framework manager will always add job id.
141
    * Framework manager will always add job id.
148
    */
142
    */
149
   private String notificationBaseUrl;
143
   private String notificationBaseUrl;
[+20] [20] 220 lines
[+20] [+] public MSubmission submit(long jobId) {
370
                       "Unsupported job type " + job.getType().name());
364
                       "Unsupported job type " + job.getType().name());
371
       }
365
       }
372

    
   
366

   
373
       // Make sure that this job id is not currently running and submit the job
367
       // Make sure that this job id is not currently running and submit the job
374
       // only if it's not.
368
       // only if it's not.
375
       synchronized (submissionMutex) {
369
       synchronized (getClass()) {
376
           MSubmission lastSubmission = repository.findSubmissionLastForJob(jobId);
370
           MSubmission lastSubmission = repository.findSubmissionLastForJob(jobId);
377
           if(lastSubmission != null && lastSubmission.getStatus().isRunning()) {
371
           if(lastSubmission != null && lastSubmission.getStatus().isRunning()) {
378
               throw new SqoopException(FrameworkError.FRAMEWORK_0002,
372
               throw new SqoopException(FrameworkError.FRAMEWORK_0002,
379
                       "Job with id " + jobId);
373
                       "Job with id " + jobId);
380
           }
374
           }
[+20] [20] 177 lines
  1. core/src/main/java/org/apache/sqoop/framework/JobManager.java: Loading...