Skip to content

Commit

Permalink
Add shutdown to HttpRestClient trait
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanadrien committed May 9, 2017
1 parent a3d1389 commit 300ec74
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions build.sbt
Expand Up @@ -37,6 +37,7 @@ publishTo := {
// Dependencies
libraryDependencies += "io.spray" %% "spray-json" % "1.3.2"
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.5.0"
libraryDependencies += "com.typesafe" % "config" % "1.3.1"

// Http client adapters. Provided.
libraryDependencies += "com.typesafe.play" %% "play-ws" % "2.5.14" % "provided"
Expand All @@ -53,6 +54,7 @@ libraryDependencies += "com.typesafe.play" %% "play-ws" % "2.5.14" % "test"
// build settings
pomIncludeRepository := { _ => false }
publishMavenStyle := true
publishArtifact in Test := false

lazy val root = project.in(file("."))
.settings(releaseProcess := ReleaseProcess.process)
Expand Up @@ -39,6 +39,10 @@ class ApacheHttpClient extends HttpRestClient with LazyLogging {
apacheResponse.close()
}

override def shutDown: Unit = {
httpClient.close()
}

override def buildRequest(
url : String,
headers : Seq[(String, String)],
Expand Down
Expand Up @@ -54,7 +54,7 @@ class PlayHttpClient extends HttpRestClient {

}

def shutDown() : Unit = {
override def shutDown() : Unit = {
wsClient.close()
system.terminate().onComplete {
case Failure(t) =>
Expand Down
Expand Up @@ -11,4 +11,6 @@ trait HttpRestClient {
queryParameters : Seq[(String, String)]
) : HttpRestRequest

def shutDown : Unit

}

0 comments on commit 300ec74

Please sign in to comment.