GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.voltdb.com — Chapter 5. Client2, A Modern Java Client Programming Interface (API) Guide to Performance and CustomizationChapter 5. Client2, A Modern Java Client Programming Interface (API)VoltDB V11 introduces a new client programming interface. The Client2 interface is similar to the original Client interface in that you create a configuration object, then create the client itself using the client factory. After connecting to the database, you can then make either synchronous or asynchronous procedure calls. However, that is where the similarity ends. Where Client provides a rudimentary interface using generic callbacks to handle both success and failure, Client2 uses modern Java programming techniques and smarter defaults to provide a structured and extensible interface, including:
The following sections describe the individual steps for creating and application using the Client2 API. For a complete listing of classes and methods, see the VoltDB Client API javadoc. 5.1. Configuring the ClientThe first step is to set the configuration options for your client, using Client2Config. You can take the default options by just creating a new Client2Config object: Client2Config config = new Client2Config();
Client2 client = ClientFactory.createClient(config);Or you can specify individual attributes by chaining the associated methods, when you create the configuration object: Client2Config config = new Client2Config().username("john")
.password("doe");
Client2 client = ClientFactory.createClient(config);Note that you can set up custom error handling as part of the configuration by defining which events the application wants to be notified about. For example: Client2Config config = new Client2Config().username("john")
.password("doe")
.connectionDownHandler(..myDropHandler..);
Client2 client = ClientFactory.createClient(config);The interfaces to the handlers are defined as functional interfaces in the class Client2Notification, allowing use of method references or lambda expressions. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |