chore: Remove SecurityManager usage. (#2106)

This commit is contained in:
He-Pin(kerr) 2025-08-30 20:36:13 +08:00 committed by GitHub
parent 2a04e9649e
commit 273dc116d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 51 deletions

View file

@ -1,41 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* license agreements; and to You under the Apache License, version 2.0:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* This file is part of the Apache Pekko project, which was derived from Akka.
*/
/*
* Copyright (C) 2009-2022 Lightbend Inc. <https://www.lightbend.com>
*/
package org.apache.pekko.util
import java.util.concurrent.TimeUnit
import scala.annotation.nowarn
import org.openjdk.jmh.annotations.{ Benchmark, Measurement, Scope, State }
@State(Scope.Benchmark)
@Measurement(timeUnit = TimeUnit.MICROSECONDS)
class StackBench {
@nowarn("msg=deprecated")
class CustomSecurtyManager extends SecurityManager {
def getTrace: Array[Class[_]] =
getClassContext
}
@Benchmark
def currentThread(): Array[StackTraceElement] = {
Thread.currentThread().getStackTrace
}
@Benchmark
def securityManager(): Array[Class[_]] = {
(new CustomSecurtyManager).getTrace
}
}