private void doLogin ( LoginGenerator . LoginRecord login ) { // Synchronously call the "Login" procedure passing in a json string containing // login-specific structure/data. try { ClientResponse response = client . callProcedure ( "Login" , login . username , login . password , login . json ) ; long resultCode = response . getResults ( ) [ 0 ] . asScalarLong ( ) ; if ( resultCode == LOGIN_SUCCESSFUL ) acceptedLogins . incrementAndGet ( ) ; else badLogins . incrementAndGet ( ) ; } catch ( Exception e ) { badLogins . incrementAndGet ( ) ; e . printStackTrace ( ) ; } }
Invoke the Login stored procedure to add a login record to the database . If the login is called multiple times for the same username the last accessed time for the login is updated . Thus this sample client can be run repeatedly without having to cycle the database .