private void upsertJobProperties(Connection connection, JobExecutionInfo jobExecutionInfo) throws SQLException { if (jobExecutionInfo.hasJobProperties()) { Optional<PreparedStatement> upsertStatement = Optional.absent(); int batchSize = 0; for (Map.Entry<String, String> property : jobExecutionInfo.getJobProperties().entrySet()) { if (!upsertStatement.isPresent()) { upsertStatement = Optional.of(connection.prepareStatement(JOB_PROPERTY_UPSERT_STATEMENT_TEMPLATE)); } addPropertyToBatch(upsertStatement.get(), property.getKey(), property.getValue(), jobExecutionInfo.getJobId()); if (batchSize++ > 1000) { executeBatches(upsertStatement); upsertStatement = Optional.absent(); batchSize = 0; } } executeBatches(upsertStatement); } }
upsertTaskMetrics(connection, jobExecutionInfo.getTaskExecutions()); Optional<StringMap> jobProperties = Optional.absent(); if (jobExecutionInfo.hasJobProperties()) { jobProperties = Optional.of(jobExecutionInfo.getJobProperties());
if (jobExecutionInfo.hasJobProperties()) { for (Map.Entry<String, String> entry : jobExecutionInfo.getJobProperties().entrySet()) { boolean insert = !existsProperty(connection, JOB_PROPERTY_EXIST_QUERY_STATEMENT_TEMPLATE,
/** * Extracts the schedule from a job execution. * <p/> * If the job was in run once mode, it will return that, otherwise it will return the schedule. * * @param jobInfo A job execution info to extract from * @return "RUN_ONCE", the Quartz schedule string, or "UNKNOWN" if there were no job properties */ public static String extractJobSchedule(JobExecutionInfo jobInfo) { if (jobInfo.hasJobProperties() && jobInfo.getJobProperties().size() > 0) { StringMap props = jobInfo.getJobProperties(); if (props.containsKey(ConfigurationKeys.JOB_RUN_ONCE_KEY) || !props.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) { return "RUN_ONCE"; } else if (props.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) { return props.get(ConfigurationKeys.JOB_SCHEDULE_KEY); } } return "UNKNOWN"; }
private void upsertJobProperties(Connection connection, JobExecutionInfo jobExecutionInfo) throws SQLException { if (jobExecutionInfo.hasJobProperties()) { Optional<PreparedStatement> upsertStatement = Optional.absent(); int batchSize = 0; for (Map.Entry<String, String> property : jobExecutionInfo.getJobProperties().entrySet()) { if (!upsertStatement.isPresent()) { upsertStatement = Optional.of(connection.prepareStatement(JOB_PROPERTY_UPSERT_STATEMENT_TEMPLATE)); } addPropertyToBatch(upsertStatement.get(), property.getKey(), property.getValue(), jobExecutionInfo.getJobId()); if (batchSize++ > 1000) { executeBatches(upsertStatement); upsertStatement = Optional.absent(); batchSize = 0; } } executeBatches(upsertStatement); } }
upsertTaskMetrics(connection, jobExecutionInfo.getTaskExecutions()); Optional<StringMap> jobProperties = Optional.absent(); if (jobExecutionInfo.hasJobProperties()) { jobProperties = Optional.of(jobExecutionInfo.getJobProperties());
if (jobExecutionInfo.hasJobProperties()) { for (Map.Entry<String, String> entry : jobExecutionInfo.getJobProperties().entrySet()) { boolean insert = !existsProperty(connection, JOB_PROPERTY_EXIST_QUERY_STATEMENT_TEMPLATE,
/** * Extracts the schedule from a job execution. * <p/> * If the job was in run once mode, it will return that, otherwise it will return the schedule. * * @param jobInfo A job execution info to extract from * @return "RUN_ONCE", the Quartz schedule string, or "UNKNOWN" if there were no job properties */ public static String extractJobSchedule(JobExecutionInfo jobInfo) { if (jobInfo.hasJobProperties() && jobInfo.getJobProperties().size() > 0) { StringMap props = jobInfo.getJobProperties(); if (props.containsKey(ConfigurationKeys.JOB_RUN_ONCE_KEY) || !props.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) { return "RUN_ONCE"; } else if (props.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) { return props.get(ConfigurationKeys.JOB_SCHEDULE_KEY); } } return "UNKNOWN"; }