Speaker: 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.
20. Outsmar(ng
Yourself
• Pick
one
node
• Send
all
coordina9on
traffic
to
that
node
• Hey,
maybe
make
it
a
fat
node!
• WhiteListPolicy
21. WhiteListing
ListInetSocketAddress whiteList = new
ArrayListInetSocketAddress();
whiteList.add(...);
Cluster c = Cluster.builder().withLoadBalancingPolicy(
new WhiteListPolicy(
new RoundRobinPolicy(),
whiteList)).build();
27. FutureResults
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();
ListRow rows = resultSet.all();
28. FutureResults
Executor executor = Executors.newCachedThreadPool();
ResultSetFuture future =
session.executeAsync(SELECT * FROM sensor);
future.addListener(new Runnable() {
public void run() {
// Do the things here…
}
}, executor);