git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorSweidan Omar <TFS\sweidan.omar>
Mon, 24 Jan 2022 13:51:59 +0000 (13:51 +0000)
committerSweidan Omar <TFS\sweidan.omar>
Mon, 24 Jan 2022 13:51:59 +0000 (13:51 +0000)
server/user.jobengine.osgi.server/src/user/jobengine/server/JobRuntime.java

index bc7312e517457186bd24feb46c722fa70c97db33..13c98bf63929d77b097e9434a0f84e4123e32db3 100644 (file)
@@ -84,9 +84,10 @@ public class JobRuntime extends Job implements IJobRuntime {
        private Semaphore forkSempahore;
        private IJobChangedListener spawnJobListener;
        private String currentStep;
-       //Fuggetlen (beagyazott) alfolyamatok
+       // Fuggetlen (beagyazott) alfolyamatok
        private List<JobRuntime> children;
-       //Parhuzamosan futtatot komplett job-ok, amiket bevarunk, ha a megfelelo step hivja + a forEach parhuzamositas
+       // Parhuzamosan futtatot komplett job-ok, amiket bevarunk, ha a megfelelo step
+       // hivja + a forEach parhuzamositas
        private List<Long> childrenIDs;
        private int spawnOrder;
 
@@ -98,7 +99,7 @@ public class JobRuntime extends Job implements IJobRuntime {
                variables = null;
                jobEngine = null;
                program = null;
-               setStatus(JobStatus.RUNABLE);
+               setStatus(JobStatus.RUNNABLE);
        }
 
        public JobRuntime(ClusteredJob job, IJobEngine jobEngine, IJobStatusChangedListener listener) {
@@ -110,8 +111,8 @@ public class JobRuntime extends Job implements IJobRuntime {
                description = job.getDescription();
                submitted = job.getSubmitted();
                template = job.getTemplate();
-               status = JobStatus.RUNABLE;
-               //CREATE notifikacio miatt
+               status = JobStatus.RUNNABLE;
+               // CREATE notifikacio miatt
                setId(job.getId());
                addEventListener(listener);
        }
@@ -137,7 +138,7 @@ public class JobRuntime extends Job implements IJobRuntime {
                this.jobEngine = jobEngine;
                this.submitted = new Timestamp(System.currentTimeMillis());
                this.stack = new Stack<Object>();
-               this.status = JobStatus.RUNABLE;
+               this.status = JobStatus.RUNNABLE;
                this.variables = new HashMap<>(runtime.getVariables());
                super.setParameters(new HashMap<>(runtime.getParameters()));
                this.persister = runtime.getPersister();
@@ -151,7 +152,7 @@ public class JobRuntime extends Job implements IJobRuntime {
                this.program = program;
                this.stack = new Stack<Object>();
                this.variables = new HashMap<String, Object>();
-               this.status = JobStatus.RUNABLE;
+               this.status = JobStatus.RUNNABLE;
        }
 
        public JobRuntime(IJobEngine jobEngine, IProgram program, IJob job, IEntityPersister persister) {
@@ -188,7 +189,7 @@ public class JobRuntime extends Job implements IJobRuntime {
                this.name = runtime.getName();
                this.owner = runtime.getOwner();
                program.removeAfter(getIp());
-               //logger.info("Program {}", program);
+               // logger.info("Program {}", program);
        }
 
        @Override
@@ -268,12 +269,15 @@ public class JobRuntime extends Job implements IJobRuntime {
 
                if (value == null) {
                        if (requiredType.isPrimitive())
-                               throw new IllegalArgumentException(String.format("Null value for parameter %s (%s) is illegal.", name, requiredType));
+                               throw new IllegalArgumentException(
+                                               String.format("Null value for parameter %s (%s) is illegal.", name, requiredType));
                } else {
                        Class<? extends Object> parameterValueType = value.getClass();
-                       if (!ClassUtils.isAssignable(parameterValueType, requiredType, true) && !isRuntimeAssignable(parameterValueType, requiredType))
-                               throw new RuntimeException(String.format("Got unassignable parameter value type (%s) for parameter %s (%s).", parameterValueType, name,
-                                               requiredType));
+                       if (!ClassUtils.isAssignable(parameterValueType, requiredType, true)
+                                       && !isRuntimeAssignable(parameterValueType, requiredType))
+                               throw new RuntimeException(
+                                               String.format("Got unassignable parameter value type (%s) for parameter %s (%s).",
+                                                               parameterValueType, name, requiredType));
                }
 
        }
@@ -319,7 +323,7 @@ public class JobRuntime extends Job implements IJobRuntime {
                                }
 
                                if (childrenIDs.contains(child.getId())) {
-                                       //logger.info("Child {} notification", child.getId());
+                                       // logger.info("Child {} notification", child.getId());
                                        if (event.getSignalType() == SignalType.UPDATE)
                                                if (finishedStates.contains(child.getStatus()))
                                                        removeSpanwChild(child.getId());
@@ -342,7 +346,7 @@ public class JobRuntime extends Job implements IJobRuntime {
 
        @Override
        public void forkWaitComplete() throws InterruptedException {
-               //atlagos mukodes
+               // atlagos mukodes
                if (forkSempahore == null)
                        return;
                logger.info("Waiting for semaphore {}", forkSempahore);
@@ -391,7 +395,6 @@ public class JobRuntime extends Job implements IJobRuntime {
                                if (i < 0)
                                        break;
                        }
-
                }
 
                return result;
@@ -447,7 +450,7 @@ public class JobRuntime extends Job implements IJobRuntime {
                        result = getParameters().get(name);
                } catch (Exception e) {
                        logger.error(e);
-                       //TODO test!
+                       // TODO test!
                        throw e;
                }
                return result;
@@ -469,13 +472,15 @@ public class JobRuntime extends Job implements IJobRuntime {
        }
 
        /***
-        * Log session marker. A teljes folyamat osszes naplobejegyzese osszegyujtheto a segitsegevel. MediaCubeMarker tipusu, folyamatonkent uj peldany jon letre.
+        * Log session marker. A teljes folyamat osszes naplobejegyzese osszegyujtheto a
+        * segitsegevel. MediaCubeMarker tipusu, folyamatonkent uj peldany jon letre.
         */
        @Override
        public Marker getSessionMarker() {
                if (sessionMarker == null) {
                        sessionMarker = new MediaCubeMarker();
-                       sessionMarker.setSessionID(getParentJobId() == 0 ? String.valueOf(getId()) : String.valueOf(getParentJobId()));
+                       sessionMarker
+                                       .setSessionID(getParentJobId() == 0 ? String.valueOf(getId()) : String.valueOf(getParentJobId()));
                        sessionMarker.setSessionName(name);
                        sessionMarker.setUseSessionLog(getProgram().getTemplate().isUseSessionLog());
                        Marker parentMarker = MarkerManager.getMarker(template);
@@ -529,7 +534,7 @@ public class JobRuntime extends Job implements IJobRuntime {
 
        @Override
        public void incrementProgress(int progress) {
-               //remote ghost
+               // remote ghost
                if (program == null) {
                        setProgress(progress);
                        NotifyUpdate();
@@ -560,10 +565,10 @@ public class JobRuntime extends Job implements IJobRuntime {
                        setProgress((int) currentProgress);
                        NotifyUpdate();
                }
-               //              if (currentProgress >= 96) {
-               //                      setProgress((int) currentProgress);
-               //                      NotifyUpdate();
-               //              }
+               // if (currentProgress >= 96) {
+               // setProgress((int) currentProgress);
+               // NotifyUpdate();
+               // }
        }
 
        @Override
@@ -577,8 +582,8 @@ public class JobRuntime extends Job implements IJobRuntime {
        }
 
        @Override
-       public boolean isRunable() {
-               return JobStatus.RUNABLE.equals(status);
+       public boolean isRunnable() {
+               return JobStatus.RUNNABLE.equals(status);
        }
 
        private boolean isRuntimeAssignable(Class<?> fromType, Class<?> toType) {
@@ -725,16 +730,13 @@ public class JobRuntime extends Job implements IJobRuntime {
        }
 
        /*
-               private final EventListenerList listeners = new EventListenerList();
-               private List<JobRuntime> children;
-               private MediaCubeMarker sessionMarker;
-               private MediaCubeMarker finishMarker;
-               private boolean isService;
-               private Semaphore forkSempahore;
-               private IJobChangedListener jobChangedListener;
-               private List<Long> childrenIDs;
-       
-        * */
+        * private final EventListenerList listeners = new EventListenerList(); private
+        * List<JobRuntime> children; private MediaCubeMarker sessionMarker; private
+        * MediaCubeMarker finishMarker; private boolean isService; private Semaphore
+        * forkSempahore; private IJobChangedListener jobChangedListener; private
+        * List<Long> childrenIDs;
+        * 
+        */
 
        @Override
        public void saveStatus() {