Skip to content

Commit

Permalink
Convert usages of Guava's FutureCallback (which aren't actually being…
Browse files Browse the repository at this point in the history
… used in future-handling code) to a generic callback trait
  • Loading branch information
absurdfarce committed Dec 3, 2019
1 parent 22d5f27 commit 4a25388
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package com.datastax.gatling.plugin.request
import akka.actor.Actor
import com.datastax.oss.driver.api.core.cql.ResultSet
import com.datastax.dse.driver.api.core.graph.GraphResultSet
import com.datastax.oss.driver.shaded.guava.common.util.concurrent.FutureCallback
import com.datastax.gatling.plugin.response.SimpleCallback
import com.typesafe.scalalogging.StrictLogging
import io.gatling.core.session.Session

Expand All @@ -20,7 +20,7 @@ import scala.util.{Failure, Success, Try}
case class SendCqlQuery(dseRequestAction: CqlRequestAction, session: Session)
case class SendGraphQuery(dseRequestAction: GraphRequestAction, session: Session)

case class RecordResult[T](t: Try[T], callback: FutureCallback[T])
case class RecordResult[T](t: Try[T], callback: SimpleCallback[T])

class DseRequestActor extends Actor with StrictLogging {
override def receive: Actor.Receive = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.datastax.dse.driver.api.core.graph.{GraphProtocol, GraphResultSet, Gr
import com.datastax.gatling.plugin.metrics.MetricsLogger
import com.datastax.gatling.plugin.model.{DseCqlAttributes, DseGraphAttributes}
import com.datastax.gatling.plugin.utils.{ResponseTime, ResponseTimeBuilder}
import com.datastax.oss.driver.shaded.guava.common.util.concurrent.FutureCallback
import com.typesafe.scalalogging.StrictLogging
import io.gatling.commons.stats._
import io.gatling.commons.validation.Failure
Expand All @@ -35,7 +34,13 @@ object DseResponseHandler {
.mkString(",")
}

abstract class DseResponseHandler[RS, Response <: DseResponse] extends StrictLogging with FutureCallback[RS] {
trait SimpleCallback[RS] {
def onFailure(t: Throwable): Unit

def onSuccess(result: RS): Unit
}

abstract class DseResponseHandler[RS, Response <: DseResponse] extends StrictLogging with SimpleCallback[RS] {
protected def responseTimeBuilder: ResponseTimeBuilder
protected def system: ActorSystem
protected def statsEngine: StatsEngine
Expand Down

0 comments on commit 4a25388

Please sign in to comment.