[from now] 2013/12/08 00:32:19

diff --git a/core/src/main/scala/info/sumito3478/arangodb.scala b/core/src/main/scala/info/sumito3478/arangodb.scala
index 209c688..dcbb35e 100644
--- a/core/src/main/scala/info/sumito3478/arangodb.scala
+++ b/core/src/main/scala/info/sumito3478/arangodb.scala
@@ -1,6 +1,7 @@
 package info.sumito3478

 package object arangodb {
+  import java.util.concurrent.atomic._
   private[arangodb] case class Logger(name: String) {
     private[this] val underlying = org.slf4j.LoggerFactory.getLogger(name)

@@ -18,4 +19,20 @@ package object arangodb {
   private[arangodb] trait Logging {
     lazy val logger = Logger(getClass.getName)
   }
+  trait Disposable extends Logging {
+    def disposeInternal: Unit
+
+    private[this] val disposed = new AtomicBoolean(false)
+
+    def dispose = if (disposed.compareAndSet(false, true)) disposeInternal
+
+    override def finalize =
+      if (!disposed.get) {
+        logger.warn(s"$this - calling dispose from finalizer!")
+        dispose
+      }
+  }
+  object Disposable extends Logging {
+    def using[A, B](x: A)(f: A => B)(implicit ev: A => Disposable) = try f(x) finally x.dispose
+  }
 }
\ No newline at end of file
[from now] 2013/12/08 01:30:25

diff --git a/project/Build.scala b/project/Build.scala
index fd757df..5e72550 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -9,7 +9,7 @@ object Build extends Build {
     javaOptions := Seq("-Xms1024m"),
     organization := "info.sumito3478",
     scalaVersion := "2.10.3",
-    crossScalaVersions := Seq("2.10.3", "2.9.3"),
+    crossScalaVersions := Seq("2.10.3"),
     fork := true,
     scalacOptions ++= Seq(
       "-encoding", "utf-8",
Remove a redundant type annotation
Add an initial version of HTTP executor
Add an initial version of API implementations