本文整理汇总了Java中org.apache.commons.daemon.DaemonController类的典型用法代码示例。如果您正苦于以下问题:Java DaemonController类的具体用法?Java DaemonController怎么用?Java DaemonController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DaemonController类属于org.apache.commons.daemon包,在下文中一共展示了DaemonController类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
@Override
public synchronized void init(DaemonContext context) {
if (state != State.NONE) {
throw new IllegalStateException("initialized already");
}
final JCommander commander = new JCommander(this);
commander.setProgramName(getClass().getName());
commander.parse(context.getArguments());
if (help != null && help) {
commander.usage();
final DaemonController controller = context.getController();
if (controller != null) {
controller.fail();
}
return;
}
state = State.INITIALIZED;
}
示例2: main
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
QuotaServerDaemon daemon = new QuotaServerDaemon();
try {
DaemonContext dc = new DaemonContext() {
@Override
public DaemonController getController() {
return null;
}
@Override
public String[] getArguments() {
return new String[]{"/home/edgar/Documents/stackSync/stacksync-quota-server/config.properties"};
}
};
daemon.init(dc);
daemon.start();
} catch (Exception e) {
throw e;
}
}
示例3: main
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
SyncServiceDaemon daemon = new SyncServiceDaemon();
try {
DaemonContext dc = new DaemonContext() {
@Override
public DaemonController getController() {
return null;
}
@Override
public String[] getArguments() {
return new String[]{"/home/edgar/Documents/stackSync/sync-service/config.properties"};
}
};
daemon.init(dc);
daemon.start();
} catch (Exception e) {
throw e;
}
}
示例4: DaemonStarter
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public DaemonStarter ( final Class<?> className, final String[] args ) throws Exception
{
final Object o = className.newInstance ();
if ( ! ( o instanceof Daemon ) )
{
throw new RuntimeException ( String.format ( "Class must implement '%s'", Daemon.class ) );
}
final DaemonController controller = this;
this.daemon = (Daemon)o;
this.daemon.init ( new DaemonContext () {
@Override
public String[] getArguments ()
{
return args;
}
@Override
public DaemonController getController ()
{
return controller;
}
} );
this.daemon.start ();
}
示例5: getController
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
@Override
public DaemonController getController() {
return null;
}
示例6: WatchDog
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public WatchDog(DaemonController controller, Context cxt) {
this.controller = controller;
this.cxt = cxt;
this.setDaemon(true);
this.setName("WatchDog");
}
示例7: startWatchDog
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public void startWatchDog(DaemonController controller) {
watchDog = new WatchDog(controller, this);
watchDog.start();
}
示例8: getController
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public DaemonController getController()
{
return daemonController;
}
示例9: setController
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public void setController(DaemonController controller)
{
this.daemonController = controller;
}
示例10: getController
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public DaemonController getController() {
return controller;
}
示例11: setController
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public void setController(DaemonController controller) {
this.controller = controller;
}
示例12: DummyDaemonContext
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public DummyDaemonContext(String[] args, DaemonController dc){
this.args = args;
this.dc = dc;
}
示例13: getController
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
public DaemonController getController() {
return dc;
}
示例14: getController
import org.apache.commons.daemon.DaemonController; //导入依赖的package包/类
@Override
public DaemonController getController() {
return daemonController;
}