remove all use of Class.getSimpleName; fixes #1288

cherry-picked from release-1.3
This commit is contained in:
Roland 2011-10-16 16:52:12 +02:00
parent 076ec4d0a0
commit 676a712ceb
4 changed files with 12 additions and 4 deletions

View file

@ -15,6 +15,7 @@ import akka.performance.workbench.BenchResultRepository
import akka.performance.workbench.Report
import akka.performance.workbench.Stats
import akka.AkkaApplication
import akka.actor.simpleName
trait PerformanceTest extends JUnitSuite {
@ -107,7 +108,7 @@ trait PerformanceTest extends JUnitSuite {
def logMeasurement(scenario: String, numberOfClients: Int, durationNs: Long) {
val name = getClass.getSimpleName
val name = simpleName(this)
val durationS = durationNs.toDouble / 1000000000.0
val percentiles = TreeMap[Int, Long](

View file

@ -15,4 +15,11 @@ package object actor {
def uuidFrom(time: Long, clockSeqAndNode: Long): Uuid = new Uuid(time, clockSeqAndNode)
def uuidFrom(uuid: String): Uuid = new Uuid(uuid)
def simpleName(obj: AnyRef): String = {
val n = obj.getClass.getName
val i = n.lastIndexOf('.')
n.substring(i + 1).replaceAll("\\$+", ".")
}
}

View file

@ -104,7 +104,7 @@ object EventHandler {
def instanceName(instance: AnyRef): String = instance match {
case null "NULL"
case a: ActorRef a.address
case _ instance.getClass.getSimpleName
case _ simpleName(instance)
}
}

View file

@ -4,7 +4,7 @@
package akka.remote.netty
import akka.actor.{ ActorRef, Uuid, newUuid, uuidFrom, IllegalActorStateException, PoisonPill, AutoReceivedMessage }
import akka.actor.{ ActorRef, Uuid, newUuid, uuidFrom, IllegalActorStateException, PoisonPill, AutoReceivedMessage, simpleName }
import akka.remote._
import RemoteProtocol._
import akka.util._
@ -143,7 +143,7 @@ abstract class RemoteClient private[akka] (
val module: NettyRemoteClientModule,
val remoteAddress: InetSocketAddress) {
val name = this.getClass.getSimpleName + "@" +
val name = simpleName(this) + "@" +
remoteAddress.getAddress.getHostAddress + "::" +
remoteAddress.getPort