Speaker(s): Tim Berglund, Global Director of Training at DataStax
So you’re a JVM developer, you understand Cassandra’s architecture, and you’re on your way to knowing its data model well enough to build descriptive data models that perform well. What you need now is to know the Java Driver.
What seems like an inconsequential library that proxies your application’s queries to your Cassandra cluster is actually a sophisticated piece of code that solves a lot of problems for you that early Cassandra developers had to code by hand. Come to this session to see features you might be missing and examples of how to use the Java driver in real applications.
23. Outsmar)ng
Yourself
• Pick
one
node
• Send
all
coordina5on
traffic
to
that
node
• Hey,
maybe
make
it
a
fat
node!
• WhiteListPolicy
• PLEASE
DO
NOT
DO
THIS
24. List<InetSocketAddress> whiteList = new
ArrayList<InetSocketAddress>();
whiteList.add(...);
Cluster c = Cluster.builder().withLoadBalancingPolicy(
new WhiteListPolicy(
new RoundRobinPolicy(),
whiteList)).build();
White
Listing
30. ResultSetFuture future =
session.executeAsync("SELECT * FROM sensor");
// Returns immediately
// Go do productive things here…
// Then finally block on the results when you must
ResultSet futureResults = future.get();
List<Row> rows = resultSet.all();
Future
Results
31. Executor executor = Executors.newCachedThreadPool();
ResultSetFuture future =
session.executeAsync("SELECT * FROM sensor");
future.addListener(new Runnable() {
public void run() {
// Do the things here…
}
}, executor);
Future
Results