summaryrefslogtreecommitdiff
path: root/same/src/main/java/com/orbekk/same/benchmark/HttpExampleServer.java
blob: f694680edd52d475264d2031954286cae76e32e6 (plain)
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
package com.orbekk.same.benchmark;

import java.util.logging.Logger;

import com.orbekk.same.http.JettyServerBuilder;
import com.orbekk.same.http.JettyServerContainer;

public class HttpExampleServer {
    private final static Logger logger =
            Logger.getLogger(HttpExampleServer.class.getName());
    private volatile JettyServerContainer server;
    
    class ServiceImpl implements HttpExampleService {
        @Override public String methodA(String message, int arg1, int arg2) {
            return message + arg1 + arg2;
        }
    }
    
    public void runServer(int port) throws Exception {
        server = new JettyServerBuilder(port)
            .withService(new ServiceImpl(), HttpExampleService.class)
            .build();
        server.start();
    }
    
    public void stopServer() throws Exception {
        server.stop();
    }
}