diff options
author | Joonas Lehtinen <joonas.lehtinen@itmill.com> | 2009-04-12 09:20:58 +0000 |
---|---|---|
committer | Joonas Lehtinen <joonas.lehtinen@itmill.com> | 2009-04-12 09:20:58 +0000 |
commit | 050ee582add077199cbf28b395104c6cfc027f5a (patch) | |
tree | 5b099e718a59f8f2ebeeaadf0494f3d0c8c91ea6 | |
parent | 204a857eb54f1840f27969faa9855c38390d2751 (diff) | |
download | vaadin-framework-050ee582add077199cbf28b395104c6cfc027f5a.tar.gz vaadin-framework-050ee582add077199cbf28b395104c6cfc027f5a.zip |
Added serialization-time measurement to Ticket695
svn changeset:7388/svn branch:6.0
-rw-r--r-- | src/com/itmill/toolkit/tests/tickets/Ticket695.java | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket695.java b/src/com/itmill/toolkit/tests/tickets/Ticket695.java index fc040d8ba3..8e45c4ca5c 100644 --- a/src/com/itmill/toolkit/tests/tickets/Ticket695.java +++ b/src/com/itmill/toolkit/tests/tickets/Ticket695.java @@ -3,6 +3,7 @@ package com.itmill.toolkit.tests.tickets; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; + import com.itmill.toolkit.Application; import com.itmill.toolkit.ui.Button; import com.itmill.toolkit.ui.Window; @@ -10,31 +11,33 @@ import com.itmill.toolkit.ui.Button.ClickEvent; public class Ticket695 extends Application { - private static final long serialVersionUID = 3803150085397590662L; - - @Override - public void init() { - final Window w = new Window("Serialization test #695"); - setMainWindow(w); - Button b = new Button("Serialize ApplicationContext"); - w.addComponent(b); - b.addListener(new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - try { - ObjectOutputStream oos = new ObjectOutputStream(buffer); - oos.writeObject(getContext()); - w.showNotification("ApplicationContext serialized (" - + buffer.size() + "bytes)"); - } catch (IOException e) { - e.printStackTrace(); - w - .showNotification("ApplicationContext serialization failed - see console for stacktrace"); - } - - } - }); - } + private static final long serialVersionUID = 3803150085397590662L; + + @Override + public void init() { + final Window w = new Window("Serialization test #695"); + setMainWindow(w); + Button b = new Button("Serialize ApplicationContext"); + w.addComponent(b); + b.addListener(new Button.ClickListener() { + + public void buttonClick(ClickEvent event) { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + try { + ObjectOutputStream oos = new ObjectOutputStream(buffer); + long t = System.currentTimeMillis(); + oos.writeObject(getContext()); + w.showNotification("ApplicationContext serialized (" + + buffer.size() + "bytes) in " + + (System.currentTimeMillis() - t) + "ms"); + } catch (IOException e) { + e.printStackTrace(); + w + .showNotification("ApplicationContext serialization failed - see console for stacktrace"); + } + + } + }); + } } |