Vojtech Szocs has posted comments on this change.

Change subject: webadmin: REST API login popup
......................................................................


Patch Set 2:

(2 comments)

Just a couple of comments regarding the use of Java "long" in GWT client code.

Looks good otherwise.

https://gerrit.ovirt.org/#/c/38453/2/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/restapi/RestApiSessionManager.java
File 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/plugin/restapi/RestApiSessionManager.java:

Line 88:     private final String restApiBaseUrl;
Line 89: 
Line 90:     private int restApiSessionTimeout;
Line 91: 
Line 92:     private long restApiSessionHardlimit;
Please keep in mind that GWT supports Java "long" (64-bit) integral type 
through emulation, using a pair of 32-bit integers [1].

[1] 
http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsCompatibility.html#language

This is because JavaScript has only *one* numerical type, called "number", 
which is equivalent to Java "double" (64-bit floating point).

In compiled JavaScript code, all Java numerical types except "long" are 
implemented as operations on "double" via JavaScript "number" type. Since the 
Java "long" doesn't fit into JavaScript "number" precision, it must be 
emulated, which has performance implications.

TL;DR - we should avoid Java "long" in GWT client code if we can. Do we really 
need to use "long" here?
Line 93:     //On logout the page reloads and this will be reset.
Line 94:     private Date restApiLoginTimePlusHardLimit;
Line 95: 
Line 96:     private String restApiSessionId;


Line 135:     }
Line 136: 
Line 137:     public void setHardLimit(String sessionHardLimit) {
Line 138:         try {
Line 139:             restApiSessionHardlimit = Long.valueOf(sessionHardLimit); 
//Minutes
Based on my comment above, can't we just use "int" for 
"restApiSessionHardlimit" field?

WebAdminHostPageServlet#getUserSessionHardTimeout returns Integer anyway, so is 
there any particular reason to use "long" here?

(We can always make Long out of Integer in GWT client code if needed, e.g. when 
working with java.util.Date class.)
Line 140:         } catch (NumberFormatException ex) {
Line 141:             restApiSessionHardlimit = DEFAULT_HARD_LIMIT;
Line 142:         }
Line 143:     }


-- 
To view, visit https://gerrit.ovirt.org/38453
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia09a6495268cacbb47019e3207a63c66205e9e03
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <aw...@redhat.com>
Gerrit-Reviewer: Alexander Wels <aw...@redhat.com>
Gerrit-Reviewer: Einav Cohen <eco...@redhat.com>
Gerrit-Reviewer: Greg Sheremeta <gsher...@redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vsz...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to