zoukankan      html  css  js  c++  java
  • 关于JSVC

    svc is a set of libraries and applications for making Java applications run on UNIX more easily.

    Jsvc allows the application (e.g. Tomcat) to perform some privileged operations as root (e.g. bind to a port < 1024), and then switch identity to a non-privileged user.

    SVC一组让java在UNIX上更容易运行库和应用程序
    JSVC允许应用程序如Tomcat)以root权限执行一些特权操作绑定到一个端口<1024然后切换到一个非特权用户身份

    There two ways to use jsvc: via a Class that implements the Daemon interface orvia calling a Class that has the required methods.For example Tomcat-4.1.x uses the Daemon interfacewhereas Tomcat-5.0.x provides a Class whose methods are called by jsvc directly.

    两种方式使用JSVC通过一个实现守护接口或通过调用所需的方法例如Tomcat的4.1.x版守护接口使用的Tomcat5.0.x中提供了一个方法被称为JSVC直接

    Via Daemon interface

    Do the following:

    • Write a Class that implements the Daemon interface (MyClass).
    • Put it in a jarfile (my.jar).
    • Call jsvc like:
      ./jsvc -cp commons-daemon.jar:my.jar MyClass
    守护进程模式:

    如下操作:

    • 一个实现后台程序接口的类如(MyClass的名字)
    • 打包(生成my.jar)
    • 像这样使用jsvc调用:

    ./jsvc -cp commons-daemon.jar:my.jar MyClass

    Directly:

    Write a Class (MyClass) that implements the following methods:

    • void init(String[] arguments): Here open configuration files, create a trace file, create ServerSockets, Threads
    • void start(): Start the Thread, accept incoming connections
    • void stop(): Inform the Thread to terminate the run(), close the ServerSockets
    • void destroy(): Destroy any object created in init()
    Store it in a jarfile and use as above:
    ./jsvc -cp my.jar MyClass

    直接启动模式:

    编写一个实现如下方法的类:

    • void init(String[] arguments): 在这里打开配置文件创建一个跟踪文件创建服务端口线程
    • void start(): 启动线程接受传入的连接
    • void stop():通知线程终止的run(),关闭服务端口
    • void destroy(): 销毁在init()创建的任何对象

    生成一个jar包

    ./jsvc -cp my.jar MyClass


  • 相关阅读:
    slf4j的简单用法以及与log4j的区别
    [转]Git 代码撤销、回滚到任意版本(当误提代码到本地或master分支时)
    【转】IDEA 中配置文件properties文件中文乱码解决
    Python+Selenium练习篇之3-浏览器滚动条操作
    selenium操作下拉滚动条的几种方法
    python利用unittest进行测试用例执行的几种方式
    安装和使用 Python
    PM2实用入门指南
    linux清除缓存
    【centos6.6环境搭建】Github unable to access SSL connect error出错处理
  • 原文地址:https://www.cnblogs.com/AI001/p/3996951.html
Copyright © 2011-2022 走看看