GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • V7.x Documentation
  • Privacy Statement
  • License Agreement
  • Contact Us

This view

  • Original page
  • New address

GeezerVison is showing docs.voltdb.com — 6.4. Closing the Connection

  • Volt Active Data
  • Feedback/Discuss
  • V7.x Books
    • VoltDB Tutorial
    • Using VoltDB
    • VoltDB Guide to Performance and Customization
    • VoltDB Planning Guide
    • VoltDB Administrator's Guide
  • Current docs ▶
6.4. Closing the Connection

Documentation

VoltDB Home » Documentation » Using VoltDB
< previoustable of contentsnext >

6.4. Closing the Connection

When the client application is done interacting with the VoltDB database, it is a good practice to close the connection. This ensures that any pending transactions are completed in an orderly way. The following example demonstrates how to close the client connection:

try {
    client.drain();
    client.close();
} catch (InterruptedException e) {
    e.printStackTrace();
}

There are two steps to closing the connection:

  1. Call drain() to make sure all asynchronous calls have completed. The drain() method pauses the current thread until all outstanding asynchronous calls (and their callback procedures) complete. This call is not necessary if the application only makes synchronous procedure calls. However, there is no penalty for calling drain() and so it can be included for completeness in all applications.

  2. Call close() to close all of the connections and release any resources associated with the client.

< previoustable of contentsnext >
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.