Skip to content

Commit

Permalink
Merge pull request #1257 from bcode2/quartz-2.5x-remove-redundant-ini…
Browse files Browse the repository at this point in the history
…tialization

quartz-2.5x remove redundant initialization
  • Loading branch information
jhouserizer authored Nov 12, 2024
2 parents 6ca2800 + 6b474d6 commit 84204e6
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 50 deletions.
10 changes: 5 additions & 5 deletions quartz/src/main/java/org/quartz/core/JobRunShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public class JobRunShell extends SchedulerListenerSupport implements Runnable {

protected QuartzScheduler qs = null;

protected TriggerFiredBundle firedTriggerBundle = null;
protected TriggerFiredBundle firedTriggerBundle;

protected Scheduler scheduler = null;
protected Scheduler scheduler;

protected volatile boolean shutdownRequested = false;

Expand Down Expand Up @@ -121,7 +121,7 @@ public void initialize(QuartzScheduler sched)
throws SchedulerException {
this.qs = sched;

Job job = null;
Job job;
JobDetail jobDetail = firedTriggerBundle.getJobDetail();

try {
Expand Down Expand Up @@ -195,7 +195,7 @@ public void run() {
}

long startTime = System.currentTimeMillis();
long endTime = startTime;
long endTime;

// execute the job
try {
Expand Down Expand Up @@ -287,7 +287,7 @@ public void passivate() {

private boolean notifyListenersBeginning(JobExecutionContext jobExCtx) throws VetoedException {

boolean vetoed = false;
boolean vetoed;

// notify all trigger listeners
try {
Expand Down
14 changes: 7 additions & 7 deletions quartz/src/main/java/org/quartz/core/QuartzScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private void bind() throws RemoteException {
return;
}

RemotableQuartzScheduler exportable = null;
RemotableQuartzScheduler exportable;

if(resources.getRMIServerPort() > 0) {
exportable = (RemotableQuartzScheduler) UnicastRemoteObject
Expand All @@ -370,7 +370,7 @@ private void bind() throws RemoteException {
.exportObject(this, 1099);
}

Registry registry = null;
Registry registry;

if (resources.getRMICreateRegistryStrategy().equals(
QuartzSchedulerResources.CREATE_REGISTRY_AS_NEEDED)) {
Expand Down Expand Up @@ -965,7 +965,7 @@ public boolean deleteJob(JobKey jobKey) throws SchedulerException {
public boolean deleteJobs(List<JobKey> jobKeys) throws SchedulerException {
validateState();

boolean result = false;
boolean result;

result = resources.getJobStore().removeJobs(jobKeys);
notifySchedulerThread(0L);
Expand Down Expand Up @@ -1030,7 +1030,7 @@ public void scheduleJob(JobDetail jobDetail, Set<? extends Trigger> triggersForJ
public boolean unscheduleJobs(List<TriggerKey> triggerKeys) throws SchedulerException {
validateState();

boolean result = false;
boolean result;

result = resources.getJobStore().removeTriggers(triggerKeys);
notifySchedulerThread(0L);
Expand Down Expand Up @@ -2263,8 +2263,8 @@ public boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException {

List<JobExecutionContext> jobs = getCurrentlyExecutingJobs();

JobDetail jobDetail = null;
Job job = null;
JobDetail jobDetail;
Job job;

boolean interrupted = false;

Expand Down Expand Up @@ -2301,7 +2301,7 @@ public boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException {
public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException {
List<JobExecutionContext> jobs = getCurrentlyExecutingJobs();

Job job = null;
Job job;

for(JobExecutionContext jec : jobs) {
if (jec.getFireInstanceId().equals(fireInstanceId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public void run() {
// set triggers to 'executing'
List<TriggerFiredResult> bundles = new ArrayList<>();

boolean goAhead = true;
boolean goAhead;
synchronized(sigLock) {
goAhead = !halted.get();
}
Expand Down Expand Up @@ -397,7 +397,7 @@ public void run() {
continue;
}

JobRunShell shell = null;
JobRunShell shell;
try {
shell = qsRsrcs.getJobRunShellFactory().createJobRunShell(bundle);
shell.initialize(qs);
Expand Down
4 changes: 2 additions & 2 deletions quartz/src/main/java/org/quartz/core/jmx/TriggerSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static void initializeTrigger(MutableTrigger trigger, Map<String, Object>
}

public static OperableTrigger newTrigger(CompositeData cData) throws ParseException {
OperableTrigger result = null;
OperableTrigger result;
if(cData.containsKey("cronExpression")) {
result = CronTriggerSupport.newTrigger(cData);
} else {
Expand All @@ -181,7 +181,7 @@ public static OperableTrigger newTrigger(CompositeData cData) throws ParseExcept
}

public static OperableTrigger newTrigger(Map<String, Object> attrMap) throws ParseException {
OperableTrigger result = null;
OperableTrigger result;
if(attrMap.containsKey("cronExpression")) {
result = CronTriggerSupport.newTrigger(attrMap);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class JobExecutionContextImpl implements java.io.Serializable, JobExecuti

private final Calendar calendar;

private boolean recovering = false;
private boolean recovering;

private int numRefires = 0;

Expand Down
24 changes: 12 additions & 12 deletions quartz/src/main/java/org/quartz/impl/StdSchedulerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ public void initialize(String filename) throws SchedulerException {
throw initException;
}

InputStream is = null;
InputStream is;
Properties props = new Properties();

is = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
Expand Down Expand Up @@ -616,12 +616,12 @@ private Scheduler instantiate() throws SchedulerException {
throw initException;
}

JobStore js = null;
ThreadPool tp = null;
JobStore js;
ThreadPool tp;
QuartzScheduler qs = null;
DBConnectionManager dbMgr = null;
String instanceIdGeneratorClass = null;
Properties tProps = null;
Properties tProps;
String userTXLocation = null;
boolean wrapJobInTx = false;
boolean autoId = false;
Expand Down Expand Up @@ -741,7 +741,7 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) {


// Create class load helper
ClassLoadHelper loadHelper = null;
ClassLoadHelper loadHelper;
try {
loadHelper = (ClassLoadHelper) loadClass(classLoadHelperClass).getDeclaredConstructor().newInstance();
} catch (Exception e) {
Expand All @@ -762,7 +762,7 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) {
throw new SchedulerConfigException("No JMX Proxy Scheduler class provided");
}

RemoteMBeanScheduler jmxScheduler = null;
RemoteMBeanScheduler jmxScheduler;
try {
jmxScheduler = (RemoteMBeanScheduler) loadHelper.loadClass(jmxProxyClass).getDeclaredConstructor()
.newInstance();
Expand Down Expand Up @@ -942,7 +942,7 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) {

// custom connectionProvider...
if (cpClass != null) {
ConnectionProvider cp = null;
ConnectionProvider cp;
try {
cp = (ConnectionProvider) loadHelper.loadClass(cpClass).getDeclaredConstructor().newInstance();
} catch (Exception e) {
Expand Down Expand Up @@ -1036,7 +1036,7 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) {
log.info("Using ConnectionProvider class '" + cpClass + "' for data source '" + dsName + "'");

try {
ConnectionProvider cp = null;
ConnectionProvider cp;
try {
Constructor constructor = loadHelper.loadClass(cpClass).getConstructor(Properties.class);
cp = (ConnectionProvider) constructor.newInstance(pp.getUnderlyingProperties());
Expand Down Expand Up @@ -1079,7 +1079,7 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) {
+ pluginNames[i] + "'");
throw initException;
}
SchedulerPlugin plugin = null;
SchedulerPlugin plugin;
try {
plugin = (SchedulerPlugin)
loadHelper.loadClass(plugInClass).getDeclaredConstructor().newInstance();
Expand Down Expand Up @@ -1119,7 +1119,7 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) {
+ jobListenerNames[i] + "'");
throw initException;
}
JobListener listener = null;
JobListener listener;
try {
listener = (JobListener)
loadHelper.loadClass(listenerClass).getDeclaredConstructor().newInstance();
Expand Down Expand Up @@ -1167,7 +1167,7 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) {
+ triggerListenerNames[i] + "'");
throw initException;
}
TriggerListener listener = null;
TriggerListener listener;
try {
listener = (TriggerListener)
loadHelper.loadClass(listenerClass).getDeclaredConstructor().newInstance();
Expand Down Expand Up @@ -1230,7 +1230,7 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) {
try {


JobRunShellFactory jrsf = null; // Create correct run-shell factory...
JobRunShellFactory jrsf; // Create correct run-shell factory...

if (userTXLocation != null) {
UserTransactionHelper.setUserTxLocation(userTXLocation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected Object getObjectFromBlob(ResultSet rs, String colName)
return null;
}

Object obj = null;
Object obj;

try (ObjectInputStream in = new ObjectInputStream(binaryInput)) {
obj = in.readObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void shutdown() {
@Override
protected Connection getNonManagedTXConnection()
throws JobPersistenceException {
Connection conn = null;
Connection conn;
try {
conn = DBConnectionManager.getInstance().getConnection(
getNonManagedTXDataSource());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected Object getObjectFromBlob(ResultSet rs, String colName)
return null;
}

Object obj = null;
Object obj;

try (ObjectInputStream in = new ObjectInputStream(binaryInput)) {
obj = in.readObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public int insertJobDetail(Connection conn, JobDetail job)

PreparedStatement ps = null;

int insertResult = 0;
int insertResult;

try {
ps = conn.prepareStatement(rtp(INSERT_JOB_DETAIL));
Expand Down Expand Up @@ -114,7 +114,7 @@ public int updateJobDetail(Connection conn, JobDetail job)

PreparedStatement ps = null;

int insertResult = 0;
int insertResult;

try {
ps = conn.prepareStatement(rtp(UPDATE_JOB_DETAIL));
Expand Down Expand Up @@ -146,7 +146,7 @@ public int insertTrigger(Connection conn, OperableTrigger trigger, String state,

PreparedStatement ps = null;

int insertResult = 0;
int insertResult;

try {
ps = conn.prepareStatement(rtp(INSERT_TRIGGER));
Expand Down Expand Up @@ -207,7 +207,7 @@ public int updateTrigger(Connection conn, OperableTrigger trigger, String state,

PreparedStatement ps = null;

int insertResult = 0;
int insertResult;


try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class PostgreSQLDelegate extends StdJDBCDelegate {
@Override
protected Object getObjectFromBlob(ResultSet rs, String colName)
throws ClassNotFoundException, IOException, SQLException {
InputStream binaryInput = null;
InputStream binaryInput;
byte[] bytes = rs.getBytes(colName);

Object obj = null;
Expand All @@ -79,7 +79,7 @@ protected Object getObjectFromBlob(ResultSet rs, String colName)
protected Object getJobDataFromBlob(ResultSet rs, String colName)
throws ClassNotFoundException, IOException, SQLException {
if (canUseProperties()) {
InputStream binaryInput = null;
InputStream binaryInput;
byte[] bytes = rs.getBytes(colName);
if(bytes == null || bytes.length == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected Object getObjectFromBlob(ResultSet rs, String colName)
return null;
}

Object obj = null;
Object obj;

try (ObjectInputStream in = new ObjectInputStream(binaryInput)) {
obj = in.readObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public int insertJobDetail(Connection conn, JobDetail job)

int res = 0;

Blob dbBlob = null;
Blob dbBlob;
if (rs.next()) {
dbBlob = writeDataToBlob(rs, 1, data);
} else {
Expand Down Expand Up @@ -275,7 +275,7 @@ public int insertTrigger(Connection conn, OperableTrigger trigger, String state,
PreparedStatement ps = null;
ResultSet rs = null;

int insertResult = 0;
int insertResult;

try {
ps = conn.prepareStatement(rtp(INSERT_TRIGGER));
Expand Down Expand Up @@ -330,7 +330,7 @@ public int insertTrigger(Connection conn, OperableTrigger trigger, String state,

rs = ps.executeQuery();

Blob dbBlob = null;
Blob dbBlob;
if (rs.next()) {
dbBlob = writeDataToBlob(rs, 1, data);
} else {
Expand Down Expand Up @@ -376,7 +376,7 @@ public int updateTrigger(Connection conn, OperableTrigger trigger, String state,
PreparedStatement ps2 = null;
ResultSet rs = null;

int insertResult = 0;
int insertResult;


try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ public Date getFireTimeAfter(Date afterTime) {
return null;

// d. Calculate and save fireTimeEndDate variable for later use
Date fireTimeEndDate = null;
Date fireTimeEndDate;
if (endTimeOfDay == null)
fireTimeEndDate = new TimeOfDay(23, 59, 59).getTimeOfDayForDate(fireTime);
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ public void jobWasExecuted(JobExecutionContext context,

Trigger trigger = context.getTrigger();

Object[] args = null;
Object[] args;

if (jobException != null) {
if (!getLog().isWarnEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public FileScanJob() {
*/
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap mergedJobDataMap = context.getMergedJobDataMap();
SchedulerContext schedCtx = null;
SchedulerContext schedCtx;
try {
schedCtx = context.getScheduler().getContext();
} catch (SchedulerException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class WorkerThread extends Thread {

private final SimpleThreadPool tp;

private Runnable runnable = null;
private Runnable runnable;

private boolean runOnce = false;

Expand Down
Loading

0 comments on commit 84204e6

Please sign in to comment.