Skip to content

Commit e7ebeb4

Browse files
greenlaw110waghanza
authored andcommitted
Add Java/act framework (the-benchmarker#222)
* add Java/act framework * add Dockerfile to java/act * add make command to build act (java) * complete actframework benchmark suite * remove unused files * remove redundant methods in AppEntry * Marwan Rabbâa prefer to implement the service using Java code instead of routes.conf file * add test for java
1 parent 80b7718 commit e7ebeb4

10 files changed

Lines changed: 943 additions & 1 deletion

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ env:
1717
- "TESTLANG=cpp"
1818
- "TESTLANG=scala"
1919
- "TESTLANG=csharp"
20+
- "TESTLANG=java"
2021

2122
script:
2223
- crystal spec

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
all: elixir node ruby crystal go rust swift python nim csharp scala
1+
all: elixir node ruby crystal go rust swift python nim csharp scala java cpp
22

33
# --- Elixir ---
44
elixir: plug phoenix
@@ -192,6 +192,19 @@ jester:
192192
mofuw:
193193
docker build -t mofuw nim/mofuw
194194

195+
# --- Java ---
196+
java: act
197+
198+
# Act
199+
act:
200+
docker build -t act java/act
201+
202+
# --- cpp ---
203+
cpp: evhtp
204+
205+
evhtp:
206+
docker build -t evhtp cpp/evhtp
207+
195208
# Cleaning all executables
196209
clean:
197210
rm -rf bin/*

java/act/.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.iml
2+
target
3+
.idea
4+
classes
5+
*.log
6+
*.DS_Store
7+
*all.sql
8+
tmp/
9+
**/.act*
10+
**/.classpath
11+
**/.settings
12+
**/.project
13+
**/.settings/
14+
store1/
15+
test.mv.db
16+
test.trace.db
17+
act.pid
18+
.workspace
19+
*.geany

java/act/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM maven
2+
3+
WORKDIR /usr/src/app
4+
5+
COPY pom.xml ./
6+
COPY src src
7+
8+
RUN mvn clean package
9+
RUN cp /usr/src/app/target/dist/*.tar.gz .
10+
RUN tar xzf *.tar.gz
11+
12+
EXPOSE 3000
13+
14+
CMD /usr/src/app/run

java/act/pom.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>benchmark.act</groupId>
8+
<artifactId>which-is-the-fastest</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<name>act</name>
12+
13+
<parent>
14+
<groupId>org.actframework</groupId>
15+
<artifactId>act-starter-parent</artifactId>
16+
<version>1.8.8.4</version>
17+
</parent>
18+
19+
<properties>
20+
<app.entry>benchmark.act.AppEntry</app.entry>
21+
</properties>
22+
23+
</project>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package benchmark.act;
2+
3+
import act.Act;
4+
import act.handler.NonBlock;
5+
import org.osgl.mvc.annotation.GetAction;
6+
import org.osgl.mvc.annotation.PostAction;
7+
import org.osgl.mvc.annotation.ResponseStatus;
8+
import org.osgl.mvc.annotation.SessionFree;
9+
10+
@SuppressWarnings("unused")
11+
public class AppEntry {
12+
13+
@GetAction("/")
14+
@SessionFree
15+
@NonBlock
16+
public String index(String id) {
17+
return "";
18+
}
19+
20+
@GetAction("/user/{id}")
21+
@SessionFree
22+
@NonBlock
23+
public String user(String id) {
24+
return id;
25+
}
26+
27+
@ResponseStatus(200)
28+
@PostAction("/user")
29+
@SessionFree
30+
@NonBlock
31+
public String create() {
32+
return "";
33+
}
34+
35+
public static void main(String[] args) throws Exception {
36+
Act.start();
37+
}
38+
39+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
artifact=${project.artifactId}
2+
version=${project.version}
3+
build=${buildNumber}

0 commit comments

Comments
 (0)