/** * Gets job priority. At first tries to get from job context. If job context has no priority, then * tries to get from task session. If task session has no priority default one will be used. * * @param ctx Collision job context. * @return Job priority. */ private int getJobPriority(GridCollisionJobContext ctx) { assert ctx != null; Integer p = null; GridJobContext jctx = ctx.getJobContext(); try { p = (Integer) jctx.getAttribute(jobAttrKey); } catch (ClassCastException e) { LT.error( log, e, "Type of job context priority attribute '" + jobAttrKey + "' is not java.lang.Integer [type=" + jctx.getAttribute(jobAttrKey).getClass() + ']'); } if (p == null) { GridTaskSession ses = ctx.getTaskSession(); try { p = (Integer) ses.getAttribute(taskAttrKey); } catch (ClassCastException e) { LT.error( log, e, "Type of task session priority attribute '" + taskAttrKey + "' is not java.lang.Integer [type=" + ses.getAttribute(taskAttrKey).getClass() + ']'); } if (p == null) { if (log.isDebugEnabled()) { log.debug( "Failed get priority from job context attribute '" + jobAttrKey + "' and task session attribute '" + taskAttrKey + "' (will use default priority): " + dfltPriority); } p = dfltPriority; } } assert p != null; return p; }