Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 17 18 21 package org.quartz.impl; 22 23 import java.util.Collection ; 24 import java.util.HashMap ; 25 26 import org.quartz.Scheduler; 27 import org.quartz.SchedulerException; 28 29 38 public class SchedulerRepository { 39 40 47 48 private HashMap schedulers; 49 50 private static SchedulerRepository inst; 51 52 59 60 private SchedulerRepository() { 61 schedulers = new HashMap (); 62 } 63 64 71 72 public static synchronized SchedulerRepository getInstance() { 73 if (inst == null) { 74 inst = new SchedulerRepository(); 75 } 76 77 return inst; 78 } 79 80 public synchronized void bind(Scheduler sched) throws SchedulerException { 81 82 if ((Scheduler) schedulers.get(sched.getSchedulerName()) != null) { 83 throw new SchedulerException("Scheduler with name '" 84 + sched.getSchedulerName() + "' already exists.", 85 SchedulerException.ERR_BAD_CONFIGURATION); 86 } 87 88 schedulers.put(sched.getSchedulerName(), sched); 89 } 90 91 public synchronized boolean remove(String schedName) { 92 return (schedulers.remove(schedName) != null); 93 } 94 95 public synchronized Scheduler lookup(String schedName) { 96 return (Scheduler) schedulers.get(schedName); 97 } 98 99 public synchronized Collection lookupAll() { 100 return java.util.Collections 101 .unmodifiableCollection(schedulers.values()); 102 } 103 104 }
| Popular Tags
|