WebService

Apache CXF

CXF 是一个开源的 service 框架。

CXF 使用 WSDL协议 描述发布一个服务,使用 SOAP协议 进行消息的交换,使用 HTTP协议 进行消息的传输。同时使用 JAX-WS API 向外暴露接口。

阅读全文

BigData-storm-supervisor

storm supervisor 的实现

1. 保存 supervisor id

创建 {storm-local}/“isupervisor” 目录。以 “supervisor-id” 作为 key 。以 .version 为文件。这个文件中存储着 SupervisorId. 这个 SupervisorId 就是一个 uuid, 使用 UUID.randomUUID 方法生成。

阅读全文

Centos-自定义服务并添加到开机启动

自定义服务

以禅道为例

创建脚本 /etc/init.d/zentao

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# zentao service
# chkconfig: 2345 55 25

otart(){
/opt/zbox/zbox start
}

stop(){
/opt/zbox/zbox stop
}

restart(){
/opt/zbox/zbox restart
}


status(){
/opt/zbox/zbox status
}


case "$1" in
start)
start
;;

stop)
stop
;;

restart)
restart
;;

status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
;;
esac

阅读全文

BigData-Thrift

定义服务

Thrifty 提供了一套快速发布服务的编程抽象。使用其所定义的 IDL 编写 .thrift ,通过编译生成目标语言的运行代码。其主要的核心是生成 TProcessor 的子类,以及提供一个 IFace 接口。

阅读全文

BigData-storm(2)

storm 命令的使用

bin/strom nimbus 命令的执行过程

    阅读全文

    clojure-基本

    clojure 安装使用

    安装过程

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    ## 安装 lein
    lein self-install

    ## 创建一个 clojure 工程
    lein new app myclojure

    ## 编译命名空间
    lein compile myclojure.core

    ## 运行命名空间
    lein run myclojure.core

    ## 运行指定的方法
    lein run -m myclojure.demo/say

    阅读全文

    JVM-相关工具

    配置 jmx

    在 jvm 启动的时候添加以下参数

    1
    2
    3
    4
    JAVA_OPTS="-Dcom.sun.management.jmxremote=true
    -Dcom.sun.management.jmxremote.port=12345
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false"

    阅读全文

    JVM-3.JamVM解释器的实现

    executeJava

    主要在 /src/interp/engine/interp.c 和 interp-inlining.h 中。

    阅读全文

    JVM-2.JamVM的初始化

    JamVM

    程序的入口点在 jam.c 的 main 函数。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    int main(int argc, char *argv[]) {
    Class *array_class, *main_class;
    Object *system_loader, *array;
    MethodBlock *mb;
    InitArgs args;
    int class_arg;
    char *cpntr;
    int status;
    int i;

    // 初始化 InitArgs 变量,这个变量中存储这 JamVM 后续
    // 各个模块初始化过程中需要的配置参数。这些参数的来源由:
    // 1. 给定默认值 例如 args->java_stack = DEFAULT_STACK;
    // 2. 通过 sysconf 查询 JamVM 所运行的系统的配置进行设置
    // 例如,查询系统的内存,从而设置 args->max_heap 和 args->min_heap
    // 3. 通过命令行参数来获取,例如下面的 parseCommandLine 调用
    setDefaultInitArgs(&args);
    class_arg = parseCommandLine(argc, argv, &args);

    args.main_stack_base = &array_class;

    if(!initVM(&args)) {
    printf("Could not initialise VM. Aborting.\n");
    exit(1);
    }

    if((system_loader = getSystemClassLoader()) == NULL)
    goto error;

    mainThreadSetContextClassLoader(system_loader);

    for(cpntr = argv[class_arg]; *cpntr; cpntr++)
    if(*cpntr == '.')
    *cpntr = '/';

    main_class = findClassFromClassLoader(argv[class_arg], system_loader);
    if(main_class != NULL)
    initClass(main_class);

    if(exceptionOccurred())
    goto error;

    mb = lookupMethod(main_class, SYMBOL(main),
    SYMBOL(_array_java_lang_String__V));

    if(mb == NULL || !(mb->access_flags & ACC_STATIC)) {
    signalException(java_lang_NoSuchMethodError, "main");
    goto error;
    }

    /* Create the String array holding the command line args */

    i = class_arg + 1;
    if((array_class = findArrayClass(SYMBOL(array_java_lang_String))) &&
    (array = allocArray(array_class, argc - i, sizeof(Object*)))) {
    Object **args = ARRAY_DATA(array, Object*) - i;

    for(; i < argc; i++)
    if(!(args[i] = Cstr2String(argv[i])))
    break;

    /* Call the main method */
    if(i == argc)
    executeStaticMethod(main_class, mb, array);
    }

    error:
    /* ExceptionOccurred returns the exception or NULL, which is OK
    for normal conditionals, but not here... */
    if((status = exceptionOccurred() ? 1 : 0))
    uncaughtException();

    /* Wait for all but daemon threads to die */
    mainThreadWaitToExitVM();
    exitVM(status);

    /* Keep the compiler happy */
    return 0;
    }

    阅读全文

    JVM-1.类加载机制和对象模型的实现

    类加载机制的实现

    阅读全文