当前位置: 首页>>代码示例>>Java>>正文


Java WrapperManager类代码示例

本文整理汇总了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.
}
 
开发者ID:SOBotics,项目名称:SOCVFinder,代码行数:23,代码来源:SOCVFinderServiceWrapper.java

示例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.
	}
}
 
开发者ID:SOBotics,项目名称:SOCVFinder,代码行数:24,代码来源:SOCVFinderServiceWrapper.java

示例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);
}
 
开发者ID:InstantCom,项目名称:Keiko,代码行数:19,代码来源:KeikoSniffer.java

示例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);
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:17,代码来源:RestartJvmController.java

示例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);
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:17,代码来源:StopJvmController.java

示例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);
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:17,代码来源:ThreadDumpController.java

示例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);
}
 
开发者ID:andresol,项目名称:psi-probe-plus,代码行数:22,代码来源:WrapperInfoController.java

示例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;
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:29,代码来源:LogsHelper.java

示例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.
}
   }
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:10,代码来源:HelloWorld.java

示例10: run

import org.tanukisoftware.wrapper.WrapperManager; //导入依赖的package包/类
public void run() {
    try {
        WrapperManager.signalStopped(_exitCode);
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
 
开发者ID:i2p,项目名称:i2p.plugins.i2pcontrol,代码行数:8,代码来源:RouterManagerHandler.java

示例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);
    }
}
 
开发者ID:InstantCom,项目名称:Keiko,代码行数:10,代码来源:KeikoSniffer.java

示例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);
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:28,代码来源:WrapperInfoController.java

示例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));
}
 
开发者ID:andresol,项目名称:psi-probe-plus,代码行数:13,代码来源:RestartJvmController.java

示例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));
}
 
开发者ID:andresol,项目名称:psi-probe-plus,代码行数:13,代码来源:StopJvmController.java

示例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));
}
 
开发者ID:andresol,项目名称:psi-probe-plus,代码行数:13,代码来源:ThreadDumpController.java


注:本文中的org.tanukisoftware.wrapper.WrapperManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。