   (build-statement [s]
     s))
 
+(defprotocol Listenable
+  (add-listener [_ runnable executor]))
+(deftype AsyncResult [fut]
+  clojure.lang.IDeref
+  (deref [_]
+    (conv/to-clj @fut))
+
+  clojure.lang.IBlockingDeref
+  (deref [_ time-period time-unit]
+    (conv/to-clj (deref fut time-period time-unit)))
+
+  Listenable
+  (add-listener [_ runnable executor]
+    (.addListener fut runnable executor)
+    )
+  )
+
 (defn execute
   [^Session session query]
   (if hayt/*prepared-statement*

;; defn get-keyspace
;; defn get-keyspaces
;; defn rebuild-schema

;;
;; Result Handling
;;

(defn set-callbacks
  "Set callbacks on a result future"
  [^ResultSetFuture fut {:keys [success failure]}]
  {:pre [(not (nil? success))]}
  (future (when-let [res @fut]
            (if (= (type res) Exception)
              (if (nil? failure)
                (throw res)
                (failure res))
              (success res))))
  fut)

(defn get-result
  "Get result from Future. Optional `timeout-ms` should be specified in milliseconds."
  ([^ResultSetFuture future]
     (conv/to-clj (.get future)))
  ([^ResultSetFuture future ^long timeout-ms]
     (conv/to-clj (.get future timeout-ms
                        java.util.concurrent.TimeUnit/MILLISECONDS))))

            Cluster$Builder SimpleStatement PreparedStatement BoundStatement HostDistance PoolingOptions
            SSLOptions ProtocolOptions$Compression]
           [com.datastax.driver.auth DseAuthProvider]
           [com.google.common.util.concurrent ListenableFuture Futures FutureCallback]
           java.net.URI
           [javax.net.ssl TrustManagerFactory KeyManagerFactory SSLContext]
           [java.security KeyStore SecureRandom]
