6.4. Defining Options on a Per-Call Basis

Documentation

VoltDB Home » Documentation » Using VoltDB

6.4. Defining Options on a Per-Call Basis

Some invocation attributes defined in the configuration by Client2Config can be overridden on a per-call basis by means of an options object. You create a new option object with Client2CallOptions, then apply it to a procedure call as the first argument. For example, the following code sets a call-specific timeout of 1,234 milliseconds and a priority of 3:

Client2CallOptions opts = new Client2CallOptions()
    .clientTimeout(1234, TimeUnit.MILLISECONDS)
    .requestPriority(3);
addUserFuture = callProcedureAsync(opts, "AddUser", username, password);

Options that are not specified in Client2CallOptions are defined by the configuration settings (or their defaults), so the interface is extensible without forcing application code changes.