本文整理汇总了Java中org.tanukisoftware.wrapper.WrapperManager类的典型用法代码示例。如果您正苦于以下问题:Java WrapperManager类的具体用法?Java WrapperManager怎么用?Java WrapperManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WrapperManager类属于org.tanukisoftware.wrapper包,在下文中一共展示了WrapperManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SOCVFinderServiceWrapper
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
/**
* Creates an instance of a WrapperSimpleApp.
*
* @param The
* full list of arguments passed to the JVM.
*/
protected SOCVFinderServiceWrapper(String args[]) {
// Initialize the WrapperManager class on startup by referencing it.
@SuppressWarnings("unused")
Class<WrapperManager> wmClass = WrapperManager.class;
// Start the application. If the JVM was launched from the native
// Wrapper then the application will wait for the native Wrapper to
// call the application's start method. Otherwise the start method
// will be called immediately.
WrapperManager.start(this, args);
// This thread ends, the WrapperManager will start the application after
// the Wrapper has
// been properly initialized by calling the start method above.
}
示例2: controlEvent
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
/**
* Called whenever the native wrapper code traps a system control signal
* against the Java process. It is up to the callback to take any actions
* necessary. Possible values are: WrapperManager.WRAPPER_CTRL_C_EVENT,
* WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, or
* WRAPPER_CTRL_SHUTDOWN_EVENT
*/
@Override
public void controlEvent(int event) {
if ((event == WrapperManager.WRAPPER_CTRL_LOGOFF_EVENT) && WrapperManager.isLaunchedAsService()) {
// Ignore
if (logger.isInfoEnabled()) {
logger.info("ServiceWrapper: controlEvent(" + event + ") Ignored");
}
} else {
if (logger.isInfoEnabled()) {
logger.info("ServiceWrapper: controlEvent(" + event + ") Stopping");
}
WrapperManager.stop(0);
// Will not get here.
}
}
示例3: main
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) throws Exception {
// Configure Log4J
PropertyConfigurator.configure(Configuration.getInstance().getConfigurationFile()
.getAbsolutePath());
// Create JSR-160 enabled MBean Server
createJSR160Server();
// Register Wrapper MBean
registerMBean(new org.tanukisoftware.wrapper.jmx.WrapperManager(),
"KeikoSniffer:type=server");
// Start server
WrapperManager.start(new KeikoSniffer(), args);
}
示例4: handleRequestInternal
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
boolean done = false;
try {
Class.forName("org.tanukisoftware.wrapper.WrapperManager");
logger.info("JVM is RESTARTED by {}", request.getRemoteAddr());
WrapperManager.restartAndReturn();
done = true;
} catch (ClassNotFoundException e) {
logger.info("WrapperManager not found. Do you have wrapper.jar in the classpath?");
logger.trace("", e);
}
return new ModelAndView(getViewName(), "done", done);
}
示例5: handleRequestInternal
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
boolean done = false;
try {
Class.forName("org.tanukisoftware.wrapper.WrapperManager");
logger.info("JVM is STOPPED by {}", request.getRemoteAddr());
WrapperManager.stop(stopExitCode);
done = true;
} catch (ClassNotFoundException e) {
logger.info("WrapperManager not found. Do you have wrapper.jar in the classpath?");
logger.trace("", e);
}
return new ModelAndView(getViewName(), "done", done);
}
示例6: handleRequestInternal
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
boolean done = false;
try {
Class.forName("org.tanukisoftware.wrapper.WrapperManager");
logger.info("ThreadDump requested by {}", request.getRemoteAddr());
WrapperManager.requestThreadDump();
done = true;
} catch (ClassNotFoundException e) {
logger.info("WrapperManager not found. Do you have wrapper.jar in the classpath?");
logger.trace("", e);
}
return new ModelAndView(getViewName(), "done", done);
}
示例7: handleRequestInternal
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
WrapperInfo wi = new WrapperInfo();
try {
Class.forName("org.tanukisoftware.wrapper.WrapperManager");
wi.setVersion(WrapperManager.getVersion());
wi.setBuildTime(WrapperManager.getBuildTime());
wi.setUser(WrapperManager.getUser(false) != null ? WrapperManager.getUser(false).getUser() : null);
wi.setInteractiveUser(WrapperManager.getInteractiveUser(false) != null ? WrapperManager.getInteractiveUser(false).getUser() : null);
wi.setJvmPid(WrapperManager.getJavaPID());
wi.setWrapperPid(WrapperManager.getWrapperPID());
wi.setProperties(WrapperManager.getProperties().entrySet());
wi.setControlledByWrapper(WrapperManager.isControlledByNativeWrapper());
wi.setDebugEnabled(WrapperManager.isDebugEnabled());
wi.setLaunchedAsService(WrapperManager.isLaunchedAsService());
} catch (ClassNotFoundException e) {
logger.info("Could not find WrapperManager class. Is wrapper.jar in the classpath?");
wi.setControlledByWrapper(false);
}
return new ModelAndView(getViewName(), "wrapperInfo", wi);
}
示例8: wrapperLogFile
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
/**
* Does not necessarily exist.
* @since 0.9.1
*/
static File wrapperLogFile(I2PAppContext ctx) {
File f = null;
if (ctx.hasWrapper()) {
String wv = System.getProperty("wrapper.version");
if (wv != null && VersionComparator.comp(wv, LOCATION_AVAILABLE) >= 0) {
try {
f = WrapperManager.getWrapperLogFile();
} catch (Throwable t) {}
}
}
if (f == null || !f.exists()) {
// RouterLaunch puts the location here if no wrapper
String path = System.getProperty("wrapper.logfile");
if (path != null) {
f = new File(path);
} else {
// look in new and old places
f = new File(System.getProperty("java.io.tmpdir"), "wrapper.log");
if (!f.exists())
f = new File(ctx.getBaseDir(), "wrapper.log");
}
}
return f;
}
示例9: controlEvent
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
public void controlEvent(int event) {
if ((event == WrapperManager.WRAPPER_CTRL_LOGOFF_EVENT)
&& (WrapperManager.isLaunchedAsService() || WrapperManager.isLaunchedAsService())) {
// Ignore
} else {
WrapperManager.stop(0);
// Will not get here.
}
}
示例10: run
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
public void run() {
try {
WrapperManager.signalStopped(_exitCode);
} catch (Throwable t) {
t.printStackTrace();
}
}
示例11: controlEvent
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
@Override
public void controlEvent(int event) {
if ((WrapperManager.WRAPPER_CTRL_LOGOFF_EVENT == event)
&& WrapperManager.isLaunchedAsService()) {
// Ignore
} else {
WrapperManager.stop(0);
}
}
示例12: handleRequestInternal
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
WrapperInfo wi = new WrapperInfo();
try {
Class.forName("org.tanukisoftware.wrapper.WrapperManager");
wi.setVersion(WrapperManager.getVersion());
wi.setBuildTime(WrapperManager.getBuildTime());
wi.setUser(
WrapperManager.getUser(false) != null ? WrapperManager.getUser(false).getUser() : null);
wi.setInteractiveUser(WrapperManager.getInteractiveUser(false) != null
? WrapperManager.getInteractiveUser(false).getUser() : null);
wi.setJvmPid(WrapperManager.getJavaPID());
wi.setWrapperPid(WrapperManager.getWrapperPID());
wi.setProperties(WrapperManager.getProperties().entrySet());
wi.setControlledByWrapper(WrapperManager.isControlledByNativeWrapper());
wi.setDebugEnabled(WrapperManager.isDebugEnabled());
wi.setLaunchedAsService(WrapperManager.isLaunchedAsService());
} catch (ClassNotFoundException e) {
logger.info("Could not find WrapperManager class. Is wrapper.jar in the classpath?");
logger.trace("", e);
wi.setControlledByWrapper(false);
}
return new ModelAndView(getViewName(), "wrapperInfo", wi);
}
示例13: handleRequestInternal
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
boolean done = false;
try {
Class.forName("org.tanukisoftware.wrapper.WrapperManager");
logger.info("JVM is RESTARTED by "+request.getRemoteAddr());
WrapperManager.restartAndReturn();
done = true;
} catch (ClassNotFoundException e) {
logger.info("WrapperManager not found. Do you have wrapper.jar in the classpath?");
}
return new ModelAndView(getViewName(), "done", Boolean.valueOf(done));
}
示例14: handleRequestInternal
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
boolean done = false;
try {
Class.forName("org.tanukisoftware.wrapper.WrapperManager");
logger.info("JVM is STOPPED by "+request.getRemoteAddr());
WrapperManager.stop(stopExitCode);
done = true;
} catch (ClassNotFoundException e) {
logger.info("WrapperManager not found. Do you have wrapper.jar in the classpath?");
}
return new ModelAndView(getViewName(), "done", Boolean.valueOf(done));
}
示例15: handleRequestInternal
import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
boolean done = false;
try {
Class.forName("org.tanukisoftware.wrapper.WrapperManager");
logger.info("ThreadDump requested by "+request.getRemoteAddr());
WrapperManager.requestThreadDump();
done = true;
} catch (ClassNotFoundException e) {
logger.info("WrapperManager not found. Do you have wrapper.jar in the classpath?");
}
return new ModelAndView(getViewName(), "done", Boolean.valueOf(done));
}