Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rssh/trackedfuture
Browse files Browse the repository at this point in the history
  • Loading branch information
rssh committed May 1, 2021
2 parents 9c7ab61 + be3e5c9 commit 141701b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package trackedfuture.agent

import org.objectweb.asm._

class TFClassAdapter(up: ClassVisitor) extends ClassVisitor(Opcodes.ASM5, up) {
class ClassAdapter(up: ClassVisitor) extends ClassVisitor(Opcodes.ASM5, up) {


override def visitMethod(access: Int, name: String, desc: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class TrackedFutureTransformer extends ClassFileTransformer {
} else {
//System.err.println("transforming class:"+className)
val writer = new ClassWriter(0)
val adapter = new TFClassAdapter(writer)
val adapter = new ClassAdapter(writer)
val reader = new ClassReader(classfileBuffer)
reader.accept(adapter, 0)
writer.toByteArray()
writer.toByteArray
}
}

Expand Down
14 changes: 5 additions & 9 deletions agent/src/main/scala/trackedfuture/runtime/TrackedAwait.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import trackedfuture.util.ThreadLocalIterator
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, Awaitable}

/**
* Created by ovoievodin on 14.06.2016.
*/

object TrackedAwait {
def ready[T](awaitOriginal: Await.type, awaitable: Awaitable[T], atMost: Duration): awaitable.type = {
try {
Expand All @@ -24,11 +20,6 @@ object TrackedAwait {
}
}

private def threadLocalTrace[T](awaitable: Awaitable[T]): StackTraces = {
val trace = new ThreadLocalIterator[StackTraces](classOf[StackTraces]).iterator.find(_.getCurrentFuture == awaitable)
if (trace == null) new StackTraces(Array()) else trace.get
}

def result[T](awaitOriginal: Await.type, awaitable: Awaitable[T], atMost: Duration): T = {
try {
awaitOriginal.result(awaitable, atMost)
Expand All @@ -40,4 +31,9 @@ object TrackedAwait {
}
}
}

private def threadLocalTrace[T](awaitable: Awaitable[T]): StackTraces = {
val trace = new ThreadLocalIterator[StackTraces](classOf[StackTraces]).iterator.find(_.getCurrentFuture == awaitable)
if (trace == null) new StackTraces(Array()) else trace.get
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package trackedfuture.util
import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer

/**
* Created by ovoievodin on 16.06.2016.
*/
class ThreadLocalIterator[A](clazz: Class[A]) extends Iterable[A]{


Expand Down

0 comments on commit 141701b

Please sign in to comment.