+build Add sort imports support. (#28780)

* Add scalafix plugin for jdk 9.
* Add command alias sortImports.
* Excludes some sources from SortImports.
* Update SortImports to 0.4.0
* Sort imports with `sortImports` command.
This commit is contained in:
kerr 2020-04-27 20:32:18 +08:00 committed by GitHub
parent ea7205eaf7
commit 0e4d41ad33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1534 changed files with 7454 additions and 6165 deletions

View file

@ -4,20 +4,22 @@
package akka.cluster.metrics
import akka.actor.Actor
import akka.actor.ActorLogging
import akka.actor.Props
import akka.actor.Address
import akka.cluster.ClusterEvent
import akka.cluster.Member
import akka.cluster.Cluster
import scala.collection.immutable
import akka.cluster.MemberStatus
import java.util.concurrent.ThreadLocalRandom
import akka.actor.DeadLetterSuppression
import scala.collection.immutable
import com.github.ghik.silencer.silent
import akka.actor.Actor
import akka.actor.ActorLogging
import akka.actor.Address
import akka.actor.DeadLetterSuppression
import akka.actor.Props
import akka.cluster.Cluster
import akka.cluster.ClusterEvent
import akka.cluster.Member
import akka.cluster.MemberStatus
/**
* Runtime collection management commands.
*/
@ -50,8 +52,8 @@ case object CollectionStopMessage extends CollectionControlMessage {
*/
private[metrics] class ClusterMetricsSupervisor extends Actor with ActorLogging {
val metrics = ClusterMetricsExtension(context.system)
import metrics.settings._
import context._
import metrics.settings._
override val supervisorStrategy = metrics.strategy
@ -132,8 +134,8 @@ private[metrics] object ClusterMetricsCollector {
* Actor responsible for periodic data sampling in the node and publication to the cluster.
*/
private[metrics] class ClusterMetricsCollector extends Actor with ActorLogging {
import ClusterMetricsCollector._
import ClusterEvent._
import ClusterMetricsCollector._
import Member.addressOrdering
import context.dispatcher
val cluster = Cluster(context.system)

View file

@ -4,21 +4,22 @@
package akka.cluster.metrics
import akka.actor.ExtendedActorSystem
import akka.actor.Extension
import akka.actor.SupervisorStrategy
import akka.event.LoggingAdapter
import akka.event.Logging
import scala.collection.immutable
import com.typesafe.config.Config
import scala.collection.immutable
import akka.actor.Props
import akka.actor.ActorRef
import akka.actor.ActorSystem
import akka.actor.ClassicActorSystemProvider
import akka.actor.Deploy
import akka.actor.ExtendedActorSystem
import akka.actor.Extension
import akka.actor.ExtensionId
import akka.actor.ExtensionIdProvider
import akka.actor.ActorSystem
import akka.actor.ActorRef
import akka.actor.ClassicActorSystemProvider
import akka.actor.Props
import akka.actor.SupervisorStrategy
import akka.event.Logging
import akka.event.LoggingAdapter
/**
* Cluster metrics extension.

View file

@ -5,13 +5,15 @@
package akka.cluster.metrics
import java.util.Arrays
import java.util.concurrent.ThreadLocalRandom
import java.util.concurrent.atomic.AtomicReference
import scala.annotation.tailrec
import scala.collection.immutable
import java.util.concurrent.ThreadLocalRandom
import com.github.ghik.silencer.silent
import com.typesafe.config.Config
import akka.actor.Actor
import akka.actor.ActorSystem
import akka.actor.Address
@ -20,11 +22,10 @@ import akka.actor.NoSerializationVerificationNeeded
import akka.actor.Props
import akka.actor.SupervisorStrategy
import akka.cluster.Cluster
import akka.cluster.routing.ClusterRouterSettingsBase
import akka.dispatch.Dispatchers
import akka.japi.Util.immutableSeq
import akka.routing._
import akka.cluster.routing.ClusterRouterSettingsBase
import com.github.ghik.silencer.silent
/**
* Load balancing of messages to cluster nodes based on cluster metric data.

View file

@ -4,11 +4,13 @@
package akka.cluster.metrics
import com.typesafe.config.Config
import scala.concurrent.duration.FiniteDuration
import akka.util.Helpers.Requiring
import akka.util.Helpers.ConfigOps
import scala.concurrent.duration.Duration
import scala.concurrent.duration.FiniteDuration
import com.typesafe.config.Config
import akka.util.Helpers.ConfigOps
import akka.util.Helpers.Requiring
/**
* Metrics extension settings. Documented in: `src/main/resources/reference.conf`.

View file

@ -5,6 +5,7 @@
package akka.cluster.metrics
import com.typesafe.config.Config
import akka.actor.OneForOneStrategy
import akka.util.Helpers.ConfigOps

View file

@ -4,13 +4,14 @@
package akka.cluster.metrics
import akka.actor.Address
import scala.util.Success
import scala.util.Failure
import scala.util.Success
import scala.util.Try
import com.github.ghik.silencer.silent
import akka.actor.Address
/**
* Metrics key/value.
*

View file

@ -4,20 +4,22 @@
package akka.cluster.metrics
import akka.actor.ActorSystem
import akka.actor.ExtendedActorSystem
import akka.event.Logging
import akka.ConfigurationException
import akka.actor.Address
import java.lang.management.MemoryMXBean
import java.lang.management.ManagementFactory
import java.lang.management.OperatingSystemMXBean
import java.lang.management.MemoryUsage
import java.lang.System.{ currentTimeMillis => newTimestamp }
import akka.cluster.Cluster
import java.io.Closeable
import java.lang.System.{ currentTimeMillis => newTimestamp }
import java.lang.management.ManagementFactory
import java.lang.management.MemoryMXBean
import java.lang.management.MemoryUsage
import java.lang.management.OperatingSystemMXBean
import org.hyperic.sigar.SigarProxy
import akka.ConfigurationException
import akka.actor.ActorSystem
import akka.actor.Address
import akka.actor.ExtendedActorSystem
import akka.cluster.Cluster
import akka.event.Logging
/**
* Metrics sampler.
*

View file

@ -5,13 +5,15 @@
package akka.cluster.metrics
import java.io.File
import scala.language.postfixOps
import scala.util.Failure
import scala.util.Success
import scala.util.Try
import kamon.sigar.SigarProvisioner
import org.hyperic.sigar.Sigar
import org.hyperic.sigar.SigarProxy
import scala.language.postfixOps
import scala.util.Success
import scala.util.Failure
import scala.util.Try
/**
* Provide sigar instance as `SigarProxy`.

View file

@ -4,24 +4,23 @@
package akka.cluster.metrics.protobuf
import java.io.{ ByteArrayInputStream, ByteArrayOutputStream, ObjectOutputStream }
import java.util.zip.{ GZIPInputStream, GZIPOutputStream }
import java.{ lang => jl }
import akka.actor.{ Address, ExtendedActorSystem }
import akka.cluster.metrics.protobuf.msg.{ ClusterMetricsMessages => cm }
import akka.cluster.metrics._
import akka.serialization.{ BaseSerializer, SerializationExtension, SerializerWithStringManifest, Serializers }
import akka.util.ClassLoaderObjectInputStream
import akka.protobufv3.internal.{ ByteString, MessageLite }
import akka.util.ccompat._
import java.io.{ ByteArrayInputStream, ByteArrayOutputStream, ObjectOutputStream }
import java.io.NotSerializableException
import java.util.zip.{ GZIPInputStream, GZIPOutputStream }
import scala.annotation.tailrec
import scala.collection.immutable
import akka.util.ccompat.JavaConverters._
import java.io.NotSerializableException
import akka.actor.{ Address, ExtendedActorSystem }
import akka.cluster.metrics._
import akka.cluster.metrics.protobuf.msg.{ ClusterMetricsMessages => cm }
import akka.dispatch.Dispatchers
import akka.protobufv3.internal.{ ByteString, MessageLite }
import akka.serialization.{ BaseSerializer, SerializationExtension, SerializerWithStringManifest, Serializers }
import akka.util.ClassLoaderObjectInputStream
import akka.util.ccompat._
import akka.util.ccompat.JavaConverters._
/**
* Protobuf serializer for [[akka.cluster.metrics.ClusterMetricsMessage]] types.

View file

@ -4,13 +4,15 @@
package akka.cluster.metrics
import scala.language.postfixOps
import scala.concurrent.duration._
import scala.language.postfixOps
import com.typesafe.config.ConfigFactory
import akka.cluster.MemberStatus
import akka.cluster.MultiNodeClusterSpec
import akka.remote.testkit.MultiNodeConfig
import akka.remote.testkit.MultiNodeSpec
import akka.cluster.MultiNodeClusterSpec
import akka.cluster.MemberStatus
trait ClusterMetricsCommonConfig extends MultiNodeConfig {
import ConfigFactory._

View file

@ -4,7 +4,6 @@
package akka.cluster.metrics
import language.postfixOps
import java.lang.management.ManagementFactory
import scala.concurrent.Await
@ -12,19 +11,21 @@ import scala.concurrent.duration._
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import language.postfixOps
import akka.actor._
import akka.cluster.Cluster
import akka.cluster.MultiNodeClusterSpec
import akka.pattern.ask
import akka.remote.testkit.{ MultiNodeConfig, MultiNodeSpec }
import akka.routing.GetRoutees
import akka.routing.FromConfig
import akka.testkit.{ DefaultTimeout, ImplicitSender, LongRunningTest }
import akka.routing.ActorRefRoutee
import akka.routing.Routees
import akka.cluster.routing.ClusterRouterPool
import akka.cluster.routing.ClusterRouterPoolSettings
import akka.pattern.ask
import akka.remote.testkit.{ MultiNodeConfig, MultiNodeSpec }
import akka.routing.ActorRefRoutee
import akka.routing.FromConfig
import akka.routing.GetRoutees
import akka.routing.Routees
import akka.serialization.jackson.CborSerializable
import akka.testkit.{ DefaultTimeout, ImplicitSender, LongRunningTest }
import akka.util.unused
object AdaptiveLoadBalancingRouterConfig extends MultiNodeConfig {

View file

@ -4,12 +4,12 @@
package akka.cluster.metrics.sample
import scala.concurrent.duration._
import akka.actor.{ Actor, ActorRef, Props, ReceiveTimeout }
import akka.routing.ConsistentHashingRouter.ConsistentHashableEnvelope
import akka.routing.FromConfig
import scala.concurrent.duration._
//#service
class StatsService extends Actor {
// This router is used both with lookup and deploy of routees. If you

View file

@ -4,12 +4,13 @@
package akka.cluster.metrics
import scala.language.postfixOps
import scala.concurrent.duration._
import scala.language.postfixOps
import akka.actor._
import akka.testkit._
import akka.cluster.metrics.StandardMetrics._
import akka.cluster.Cluster
import akka.cluster.metrics.StandardMetrics._
import akka.testkit._
class ClusterMetricsExtensionSpec
extends AkkaSpec(MetricsConfig.clusterSigarMock)

View file

@ -4,11 +4,12 @@
package akka.cluster.metrics
import akka.actor.Address
import akka.cluster.metrics.StandardMetrics._
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import akka.actor.Address
import akka.cluster.metrics.StandardMetrics._
class MetricsSelectorSpec extends AnyWordSpec with Matchers {
val factor = 0.3 // TODO read from reference.conf

View file

@ -4,11 +4,13 @@
package akka.cluster.metrics
import language.postfixOps
import akka.testkit.AkkaSpec
import akka.dispatch.Dispatchers
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import language.postfixOps
import akka.dispatch.Dispatchers
import akka.testkit.AkkaSpec
class ClusterMetricsSettingsSpec extends AkkaSpec {

View file

@ -4,12 +4,14 @@
package akka.cluster.metrics
import scala.concurrent.duration._
import akka.testkit.{ AkkaSpec, LongRunningTest }
import java.util.concurrent.ThreadLocalRandom
import scala.concurrent.duration._
import com.github.ghik.silencer.silent
import akka.testkit.{ AkkaSpec, LongRunningTest }
@silent
class EWMASpec extends AkkaSpec(MetricsConfig.defaultEnabled) with MetricsCollectorFactory {

View file

@ -4,18 +4,19 @@
package akka.cluster.metrics
import akka.cluster.metrics.StandardMetrics._
import java.lang.System.{ currentTimeMillis => newTimestamp }
import scala.util.Failure
import akka.actor.Address
import akka.testkit.AkkaSpec
import akka.testkit.ImplicitSender
import java.lang.System.{ currentTimeMillis => newTimestamp }
import com.github.ghik.silencer.silent
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import akka.actor.Address
import akka.cluster.metrics.StandardMetrics._
import akka.testkit.AkkaSpec
import akka.testkit.ImplicitSender
@silent
class MetricNumericConverterSpec extends AnyWordSpec with Matchers with MetricNumericConverter {

View file

@ -4,13 +4,15 @@
package akka.cluster.metrics
import scala.language.postfixOps
import scala.concurrent.duration._
import scala.language.postfixOps
import scala.util.Try
import akka.testkit._
import akka.cluster.metrics.StandardMetrics._
import com.github.ghik.silencer.silent
import akka.cluster.metrics.StandardMetrics._
import akka.testkit._
@silent
class MetricsCollectorSpec
extends AkkaSpec(MetricsConfig.defaultEnabled)

View file

@ -4,27 +4,28 @@
package akka.cluster.metrics
import scala.language.postfixOps
import java.io.Closeable
import java.util.logging.LogManager
import org.slf4j.bridge.SLF4JBridgeHandler
import akka.testkit.AkkaSpec
import akka.actor.ExtendedActorSystem
import akka.actor.Address
import java.io.Closeable
import scala.language.postfixOps
import akka.actor.ActorRef
import akka.actor.Props
import akka.actor.Actor
import akka.dispatch.RequiresMessageQueue
import akka.actor.Deploy
import akka.dispatch.UnboundedMessageQueueSemantics
import akka.actor.PoisonPill
import akka.actor.ActorLogging
import org.scalatestplus.mockito.MockitoSugar
import org.slf4j.bridge.SLF4JBridgeHandler
import akka.actor.Actor
import akka.actor.ActorLogging
import akka.actor.ActorRef
import akka.actor.ActorSystem
import akka.actor.Address
import akka.actor.Deploy
import akka.actor.ExtendedActorSystem
import akka.actor.PoisonPill
import akka.actor.Props
import akka.dispatch.Dispatchers
import akka.dispatch.RequiresMessageQueue
import akka.dispatch.UnboundedMessageQueueSemantics
import akka.remote.RARP
import akka.testkit.AkkaSpec
/**
* Redirect different logging sources to SLF4J.

View file

@ -4,14 +4,16 @@
package akka.cluster.metrics
import scala.Vector
import com.typesafe.config.ConfigFactory
import akka.actor.Address
import akka.actor.RootActorPath
import akka.remote.RARP
import akka.testkit.AkkaSpec
import akka.routing.ActorSelectionRoutee
import akka.routing.ActorRefRoutee
import scala.Vector
import akka.routing.ActorSelectionRoutee
import akka.testkit.AkkaSpec
class WeightedRouteesSpec extends AkkaSpec(ConfigFactory.parseString("""
akka.actor.provider = "cluster"

View file

@ -5,10 +5,10 @@
package akka.cluster.metrics.protobuf
import akka.actor.{ Address, ExtendedActorSystem }
import akka.testkit.AkkaSpec
import akka.cluster.MemberStatus
import akka.cluster.metrics._
import akka.cluster.TestMember
import akka.cluster.metrics._
import akka.testkit.AkkaSpec
class MessageSerializerSpec extends AkkaSpec("""
akka.actor.provider = cluster