Caching all the prepared statements in thread safe way
public BoundStatement getStatement(String cql) {
    Session session = TestUtils.getInstance().getSession();
    PreparedStatement ps = holder.computeIfAbsent(cql, s -&gt; session.prepare(s));
    return ps.bind();
}


According to computeIfAbsent's Javadoc:


  The entire method invocation is performed atomically, so the function is applied at most once per key.


I also suggest that you declare holder of type ConcurrentHashMap instead of Map so that it becomes unambiguous for anyone reading getStatement that the synchronisation in computeIfAbsent is guaranteed.