public class Daemon
extends java.lang.Object
| Modifier and Type | Class and Description | 
|---|---|
protected static class  | 
Daemon.DaemonThread
>>>>>>> b9b88eb... 
 | 
| Modifier and Type | Field and Description | 
|---|---|
protected static java.lang.String | 
DAEMON_USER_UUID
The uuid defined for the daemon user object 
 | 
protected static java.lang.ThreadLocal<User> | 
daemonThreadUser  | 
protected static java.lang.ThreadLocal<java.lang.Boolean> | 
isDaemonThread  | 
| Constructor and Description | 
|---|
Daemon()  | 
| Modifier and Type | Method and Description | 
|---|---|
static void | 
executeScheduledTask(Task task)
Executes the given task in a new thread that is authenticated as the daemon user. 
 | 
static User | 
getDaemonThreadUser()  | 
static boolean | 
isDaemonThread()  | 
static java.lang.Thread | 
runInDaemonThread(java.lang.Runnable runnable,
                 DaemonToken token)
Executes the given runnable in a new thread that is authenticated as the daemon user. 
 | 
static void | 
runInDaemonThreadAndWait(java.lang.Runnable runnable,
                        DaemonToken token)
Executes the given runnable in a new thread that is authenticated as the daemon user and wait
 for the thread to finish. 
 | 
static java.lang.Thread | 
runInNewDaemonThread(java.lang.Runnable runnable)
Call this method if you are inside a Daemon thread (for example in a Module activator or a
 scheduled task) and you want to start up a new parallel Daemon thread. 
 | 
static void | 
runStartupForService(OpenmrsService service)
Calls the  
OpenmrsService.onStartup() method, as a daemon, for an instance
 implementing the OpenmrsService interface. | 
static Module | 
startModule(Module module)
This method should not be called directly. 
 | 
protected static final java.lang.String DAEMON_USER_UUID
protected static final java.lang.ThreadLocal<java.lang.Boolean> isDaemonThread
protected static final java.lang.ThreadLocal<User> daemonThreadUser
public static Module startModule(Module module) throws ModuleException
ModuleFactory.startModule(Module)
 method uses this to start the given module in a new thread that is authenticated as the
 daemon usermodule - the module to startModuleExceptionpublic static void executeScheduledTask(Task task) throws java.lang.Throwable
TimerSchedulerTask during actual task executiontask - the task to runjava.lang.Throwablepublic static java.lang.Thread runInNewDaemonThread(java.lang.Runnable runnable)
runnable - what to run in a new threadThreadpublic static boolean isDaemonThread()
Context.hasPrivilege(String)public static void runStartupForService(OpenmrsService service) throws ModuleException
OpenmrsService.onStartup() method, as a daemon, for an instance
 implementing the OpenmrsService interface.openmrsService - instance implementing the OpenmrsService interface.ModuleExceptionpublic static java.lang.Thread runInDaemonThread(java.lang.Runnable runnable,
                                                 DaemonToken token)
runnable - an object implementing the Runnable interface.token - the token required to run code as the daemon userThreadpublic static void runInDaemonThreadAndWait(java.lang.Runnable runnable,
                                            DaemonToken token)
runnable - an object implementing the Runnable interface.token - the token required to run code as the daemon userpublic static User getDaemonThreadUser()
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.