use of hudson.init.Initializer in project hudson-2.x by hudson.
the class InitialUserContent method init.
@Initializer(after = JOB_LOADED)
public static void init(Hudson h) throws IOException {
File userContentDir = new File(h.getRootDir(), "userContent");
if (!userContentDir.exists()) {
userContentDir.mkdirs();
FileUtils.writeStringToFile(new File(userContentDir, "readme.txt"), Messages.Hudson_USER_CONTENT_README());
}
}
use of hudson.init.Initializer in project hudson-2.x by hudson.
the class Trigger method init.
@Initializer(after = JOB_LOADED)
public static void init() {
new DoubleLaunchChecker().schedule();
// start all PeridocWorks
for (PeriodicWork p : PeriodicWork.all()) timer.scheduleAtFixedRate(p, p.getInitialDelay(), p.getRecurrencePeriod());
// start monitoring nodes, although there's no hurry.
timer.schedule(new SafeTimerTask() {
public void doRun() {
ComputerSet.initialize();
}
}, 1000 * 10);
}
use of hudson.init.Initializer in project hudson-2.x by hudson.
the class GroovyInitScript method init.
@Initializer(after = JOB_LOADED)
public static void init(Hudson h) throws IOException {
URL bundledInitScript = h.servletContext.getResource("/WEB-INF/init.groovy");
if (bundledInitScript != null) {
LOGGER.info("Executing bundled init script: " + bundledInitScript);
execute(new GroovyCodeSource(bundledInitScript));
}
File initScript = new File(h.getRootDir(), "init.groovy");
if (initScript.exists()) {
LOGGER.info("Executing " + initScript);
execute(new GroovyCodeSource(initScript));
}
}
use of hudson.init.Initializer in project hudson-2.x by hudson.
the class QueueSorter method installDefaultQueueSorter.
/**
* Installs the default queue sorter.
*
* {@link Queue#Queue(hudson.model.LoadBalancer)} is too early to do this
*/
@Initializer(after = JOB_LOADED)
public static void installDefaultQueueSorter() {
ExtensionList<QueueSorter> all = all();
if (all.isEmpty())
return;
Queue q = Hudson.getInstance().getQueue();
// someone has already installed something. leave that alone.
if (q.getSorter() != null)
return;
q.setSorter(all.get(0));
if (all.size() > 1)
LOGGER.warning("Multiple QueueSorters are registered. Only the first one is used and the rest are ignored: " + all);
}
Aggregations