@SuppressWarnings("unchecked") @VisibleForTesting static <T extends Serializable> Task<T> get(Class<T> workClass) { for (TaskTuple<? extends Serializable> t : taskvec) { if (t.workClass == workClass) { try { Task<T> ret = (Task<T>) t.taskClass.newInstance(); ret.setId("Stage-" + Integer.toString(getAndIncrementId())); return ret; } catch (Exception e) { throw new RuntimeException(e); } } } throw new RuntimeException("No task for work class " + workClass.getName()); }
@SuppressWarnings("unchecked") public static <T extends Serializable> Task<T> get(Class<T> workClass, HiveConf conf) { for (TaskTuple<? extends Serializable> t : taskvec) { if (t.workClass == workClass) { try { Task<T> ret = (Task<T>) t.taskClass.newInstance(); ret.setId("Stage-" + Integer.toString(getAndIncrementId())); return ret; } catch (Exception e) { throw new RuntimeException(e); } } } throw new RuntimeException("No task for work class " + workClass.getName()); }
@SuppressWarnings("unchecked") public static <T extends Serializable> Task<T> get(Class<T> workClass, HiveConf conf) { for (TaskTuple<? extends Serializable> t : taskvec) { if (t.workClass == workClass) { try { Task<T> ret = (Task<T>) t.taskClass.newInstance(); ret.setId("Stage-" + Integer.toString(getAndIncrementId())); return ret; } catch (Exception e) { throw new RuntimeException(e); } } } throw new RuntimeException("No task for work class " + workClass.getName()); }
@SuppressWarnings("unchecked") public static <T extends Serializable> Task<T> get(Class<T> workClass, HiveConf conf) { for (taskTuple<? extends Serializable> t : taskvec) { if (t.workClass == workClass) { try { Task<T> ret = (Task<T>) t.taskClass.newInstance(); ret.setId("Stage-" + Integer.toString(getAndIncrementId())); return ret; } catch (Exception e) { throw new RuntimeException(e); } } } throw new RuntimeException("No task for work class " + workClass.getName()); }
private static Task<? extends Serializable> createTask(DDLWork work) { SentryGrantRevokeTask task = new SentryGrantRevokeTask(); task.setId("Stage-" + Integer.toString(TaskFactory.getAndIncrementId())); task.setWork(work); return task; }