title: quartz: Run single instance per JVM
body: <p>I am using Quartz Scheduler 2.2.0 in my Java SSE (Java Flex) Application. I have set a schedule that run every day at 10:00am and perform some job. I didn't shutdown Quartz Scheduler because I want it to run everyday.</p>
  
  <p>But Is there anyway I know that Quartz Scheduler is already running because if I start it when user open my Java Flex Application so multiple instances exists.</p>
  
  <p>Is there any way I can get JVM process running on computer and I can see that Quartz Scheduler process is already up so I don't need to run it again or If I run it again it should automatically check if one instance exists so it should throw an exception.</p>
  
  <p>I am giving my Configuration XML file below, hope this helps...</p>
  
  <blockquote>
    <p>quartz.properties</p>
  </blockquote>
  
  <pre><code>#============================================================================
  # Configure Main Scheduler Properties  
  #============================================================================
  
  org.quartz.scheduler.instanceName: SF-Tasks-Scheduler
  org.quartz.scheduler.instanceId: Quartz_Instance_1
  org.quartz.scheduler.instanceIdGenerator.class: org.quartz.simpl.HostnameInstanceIdGenerator
  org.quartz.scheduler.skipUpdateCheck: true
  org.quartz.scheduler.makeSchedulerThreadDaemon: true
  
  #============================================================================
  # Configure ThreadPool  
  #============================================================================
  
  org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
  org.quartz.threadPool.threadCount: 1
  org.quartz.threadPool.threadPriority: 5
  
  #============================================================================
  # Configure JobStore  
  #============================================================================
  
  org.quartz.jobStore.misfireThreshold: 60000
  
  org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
  
  
  
  
  #============================================================================
  # Configure Plugins 
  #============================================================================
  
  org.quartz.plugin.triggHistory.class = \org.quartz.plugins.history.LoggingTriggerHistoryPlugin
  org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger {1}.{0} fired job {6}.{5} at\: {4, date, HH\:mm\:ss MM/dd/yyyy}
  org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH\:mm\:ss MM/dd/yyyy}
  </code></pre>
  
  <p>and this is how I schedule my jobs</p>
  
  <pre><code>try {
              Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
              JobDetail jobTaskUpdater = JobBuilder.newJob(JobTaskUpdater.class).withIdentity(JobTaskUpdater.class.getName(), GROUP_TASK_JOB_DETAIL).build();
              Trigger trigger = TriggerBuilder.newTrigger().withIdentity(NAME_TRIGGER_TASK_UPDATER, GROUP_TASK_TRIGGER).withSchedule(SimpleScheduleBuilder.repeatMinutelyForever()).build();          
  
              JobTaskUpdaterStatusListener listener = new JobTaskUpdaterStatusListener();
              KeyMatcher&lt;JobKey&gt; matcherTaskUpdater = KeyMatcher.keyEquals(jobTaskUpdater.getKey());      
  
              scheduler.getListenerManager().addJobListener(listener, matcherTaskUpdater);
  
              scheduler.scheduleJob(jobTaskUpdater, trigger); 
  
  
              scheduler.start();
  
          } catch (SchedulerException e) {
              e.printStackTrace();
          }
  </code></pre>