diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-04-09 12:50:50 +0200 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-04-09 12:50:50 +0200 |
commit | 4dbe03635e19bc894046c920ed1da5c94a023e36 (patch) | |
tree | 98ea0963bac7c97db74b4bde9b7b8df97ed6d19c /same-android | |
parent | 5df074fb9333f23290d1d988e37dc2d821c46b0c (diff) |
Add benchmark for Jetty+JsonRpc.
Diffstat (limited to 'same-android')
3 files changed, 34 insertions, 1 deletions
diff --git a/same-android/AndroidManifest.xml b/same-android/AndroidManifest.xml index 9fdeebd..d51c4e2 100644 --- a/same-android/AndroidManifest.xml +++ b/same-android/AndroidManifest.xml @@ -24,6 +24,7 @@ <activity android:name=".GraphicsActivity"/> <activity android:name="com.orbekk.same.android.benchmark.RepeatedSetVariableActivity"/> <activity android:name="com.orbekk.same.android.benchmark.ExampleProtobufServerActivity"/> + <activity android:name="com.orbekk.same.android.benchmark.ExampleHttpServerActivity"/> <service android:name=".SameService" android:process="com.orbekk.same.android.SameService"/> </application> diff --git a/same-android/src/main/java/com/orbekk/same/android/MainActivity.java b/same-android/src/main/java/com/orbekk/same/android/MainActivity.java index 4714b37..17b0ff0 100644 --- a/same-android/src/main/java/com/orbekk/same/android/MainActivity.java +++ b/same-android/src/main/java/com/orbekk/same/android/MainActivity.java @@ -16,7 +16,7 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; -import com.orbekk.same.android.R; +import com.orbekk.same.android.benchmark.ExampleHttpServerActivity; import com.orbekk.same.android.benchmark.ExampleProtobufServerActivity; import com.orbekk.same.android.benchmark.RepeatedSetVariableActivity; @@ -33,6 +33,8 @@ public class MainActivity extends Activity { activities.put("Benchmark", RepeatedSetVariableActivity.class); activities.put("ExampleProtobufServer (temp)", ExampleProtobufServerActivity.class); + activities.put("ExampleHttpServer (temp)", + ExampleHttpServerActivity.class); } public final static List<String> activityList = diff --git a/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleHttpServerActivity.java b/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleHttpServerActivity.java new file mode 100644 index 0000000..695988d --- /dev/null +++ b/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleHttpServerActivity.java @@ -0,0 +1,30 @@ +package com.orbekk.same.android.benchmark; + +import android.app.Activity; + +import com.orbekk.same.benchmark.ExampleServer; +import com.orbekk.same.benchmark.HttpExampleServer; + +public class ExampleHttpServerActivity extends Activity { + public final HttpExampleServer server = new HttpExampleServer(); + + @Override public void onResume() { + super.onResume(); + try { + server.runServer(12000); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + @Override public void onStop() { + super.onStop(); + try { + server.stopServer(); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } +} |