You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/07/30 17:45:16 UTC
[incubator-openwhisk] branch master updated: Fix misspelled or
wrongly named types. (#3915)
This is an automated email from the ASF dual-hosted git repository.
rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 7000687 Fix misspelled or wrongly named types. (#3915)
7000687 is described below
commit 70006876a431152e2a1ca09cfc4c562a54900e6f
Author: Markus Thömmes <ma...@me.com>
AuthorDate: Mon Jul 30 19:45:13 2018 +0200
Fix misspelled or wrongly named types. (#3915)
* Rename ForcableSemaphore to ForcibleSemaphore.
* Rename Unresponsible to Unresponsive.
---
.../{ForcableSemaphore.scala => ForcibleSemaphore.scala} | 2 +-
.../scala/whisk/core/loadBalancer/InvokerSupervision.scala | 12 ++++++------
.../core/loadBalancer/ShardingContainerPoolBalancer.scala | 10 +++++-----
...leSemaphoreTests.scala => ForcibleSemaphoreTests.scala} | 14 +++++++-------
.../core/loadBalancer/test/InvokerSupervisionTests.scala | 4 ++--
.../test/ShardingContainerPoolBalancerTests.scala | 6 +++---
6 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/common/scala/src/main/scala/whisk/common/ForcableSemaphore.scala b/common/scala/src/main/scala/whisk/common/ForcibleSemaphore.scala
similarity index 99%
rename from common/scala/src/main/scala/whisk/common/ForcableSemaphore.scala
rename to common/scala/src/main/scala/whisk/common/ForcibleSemaphore.scala
index 9544a30..8eb1252 100644
--- a/common/scala/src/main/scala/whisk/common/ForcableSemaphore.scala
+++ b/common/scala/src/main/scala/whisk/common/ForcibleSemaphore.scala
@@ -34,7 +34,7 @@ import scala.annotation.tailrec
*
* @param maxAllowed maximum number of permits given away by `tryAcquire`
*/
-class ForcableSemaphore(maxAllowed: Int) {
+class ForcibleSemaphore(maxAllowed: Int) {
class Sync extends AbstractQueuedSynchronizer {
setState(maxAllowed)
diff --git a/core/controller/src/main/scala/whisk/core/loadBalancer/InvokerSupervision.scala b/core/controller/src/main/scala/whisk/core/loadBalancer/InvokerSupervision.scala
index 223b747..18f5ac3 100644
--- a/core/controller/src/main/scala/whisk/core/loadBalancer/InvokerSupervision.scala
+++ b/core/controller/src/main/scala/whisk/core/loadBalancer/InvokerSupervision.scala
@@ -61,7 +61,7 @@ object InvokerState {
// Pings are arriving fine, the invoker returns system errors though
case object Unhealthy extends Unusable { val asString = "unhealthy" }
// Pings are arriving fine, the invoker does not respond with active-acks in the expected time though
- case object Unresponsible extends Unusable { val asString = "unresponsible" }
+ case object Unresponsive extends Unusable { val asString = "unresponsive" }
// Pings are not arriving for this invoker
case object Offline extends Unusable { val asString = "down" }
}
@@ -313,8 +313,8 @@ class InvokerActor(invokerInstance: InvokerInstanceId, controllerInstance: Contr
/** An Unhealthy invoker represents an invoker that was not able to handle actions successfully. */
when(Unhealthy, stateTimeout = healthyTimeout)(healthPingingState)
- /** An Unresponsible invoker represents an invoker that is not responding with active acks in a timely manner */
- when(Unresponsible, stateTimeout = healthyTimeout)(healthPingingState)
+ /** An Unresponsive invoker represents an invoker that is not responding with active acks in a timely manner */
+ when(Unresponsive, stateTimeout = healthyTimeout)(healthPingingState)
/**
* A Healthy invoker is characterized by continuously getting pings. It will go offline if that state is not confirmed
@@ -350,7 +350,7 @@ class InvokerActor(invokerInstance: InvokerInstanceId, controllerInstance: Contr
}
onTransition(healthPingingTransitionHandler(Unhealthy))
- onTransition(healthPingingTransitionHandler(Unresponsible))
+ onTransition(healthPingingTransitionHandler(Unresponsive))
initialize()
@@ -380,11 +380,11 @@ class InvokerActor(invokerInstance: InvokerInstanceId, controllerInstance: Contr
stay
} else {
val entries = buffer.toList
- // Goto Unhealthy or Unresponsible respectively if there are more errors than accepted in buffer, else goto Healthy
+ // Goto Unhealthy or Unresponsive respectively if there are more errors than accepted in buffer, else goto Healthy
if (entries.count(_ == InvocationFinishedResult.SystemError) > InvokerActor.bufferErrorTolerance) {
gotoIfNotThere(Unhealthy)
} else if (entries.count(_ == InvocationFinishedResult.Timeout) > InvokerActor.bufferErrorTolerance) {
- gotoIfNotThere(Unresponsible)
+ gotoIfNotThere(Unresponsive)
} else {
gotoIfNotThere(Healthy)
}
diff --git a/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala b/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
index 3cdce1d..47be740 100644
--- a/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
+++ b/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
@@ -462,7 +462,7 @@ object ShardingContainerPoolBalancer extends LoadBalancerProvider {
*/
@tailrec
def schedule(invokers: IndexedSeq[InvokerHealth],
- dispatched: IndexedSeq[ForcableSemaphore],
+ dispatched: IndexedSeq[ForcibleSemaphore],
index: Int,
step: Int,
stepsDone: Int = 0)(implicit logging: Logging, transId: TransactionId): Option[InvokerInstanceId] = {
@@ -513,7 +513,7 @@ case class ShardingContainerPoolBalancerState(
private var _blackboxInvokers: IndexedSeq[InvokerHealth] = IndexedSeq.empty[InvokerHealth],
private var _managedStepSizes: Seq[Int] = ShardingContainerPoolBalancer.pairwiseCoprimeNumbersUntil(0),
private var _blackboxStepSizes: Seq[Int] = ShardingContainerPoolBalancer.pairwiseCoprimeNumbersUntil(0),
- private var _invokerSlots: IndexedSeq[ForcableSemaphore] = IndexedSeq.empty[ForcableSemaphore],
+ private var _invokerSlots: IndexedSeq[ForcibleSemaphore] = IndexedSeq.empty[ForcibleSemaphore],
private var _clusterSize: Int = 1)(
lbConfig: ShardingContainerPoolBalancerConfig =
loadConfigOrThrow[ShardingContainerPoolBalancerConfig](ConfigKeys.loadbalancer))(implicit logging: Logging) {
@@ -530,7 +530,7 @@ case class ShardingContainerPoolBalancerState(
def blackboxInvokers: IndexedSeq[InvokerHealth] = _blackboxInvokers
def managedStepSizes: Seq[Int] = _managedStepSizes
def blackboxStepSizes: Seq[Int] = _blackboxStepSizes
- def invokerSlots: IndexedSeq[ForcableSemaphore] = _invokerSlots
+ def invokerSlots: IndexedSeq[ForcibleSemaphore] = _invokerSlots
def clusterSize: Int = _clusterSize
/**
@@ -564,7 +564,7 @@ case class ShardingContainerPoolBalancerState(
if (oldSize < newSize) {
// Keeps the existing state..
_invokerSlots = _invokerSlots ++ IndexedSeq.fill(newSize - oldSize) {
- new ForcableSemaphore(currentInvokerThreshold)
+ new ForcibleSemaphore(currentInvokerThreshold)
}
}
}
@@ -589,7 +589,7 @@ case class ShardingContainerPoolBalancerState(
_clusterSize = actualSize
val newTreshold = (totalInvokerThreshold / actualSize) max 1 // letting this fall below 1 doesn't make sense
currentInvokerThreshold = newTreshold
- _invokerSlots = _invokerSlots.map(_ => new ForcableSemaphore(currentInvokerThreshold))
+ _invokerSlots = _invokerSlots.map(_ => new ForcibleSemaphore(currentInvokerThreshold))
logging.info(
this,
diff --git a/tests/src/test/scala/whisk/common/ForcableSemaphoreTests.scala b/tests/src/test/scala/whisk/common/ForcibleSemaphoreTests.scala
similarity index 91%
rename from tests/src/test/scala/whisk/common/ForcableSemaphoreTests.scala
rename to tests/src/test/scala/whisk/common/ForcibleSemaphoreTests.scala
index bcd3871..87cea2e 100644
--- a/tests/src/test/scala/whisk/common/ForcableSemaphoreTests.scala
+++ b/tests/src/test/scala/whisk/common/ForcibleSemaphoreTests.scala
@@ -22,11 +22,11 @@ import org.scalatest.{FlatSpec, Matchers}
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
-class ForcableSemaphoreTests extends FlatSpec with Matchers {
+class ForcibleSemaphoreTests extends FlatSpec with Matchers {
behavior of "ForcableSemaphore"
it should "not allow to acquire, force or release negative amounts of permits" in {
- val s = new ForcableSemaphore(2)
+ val s = new ForcibleSemaphore(2)
an[IllegalArgumentException] should be thrownBy s.tryAcquire(0)
an[IllegalArgumentException] should be thrownBy s.tryAcquire(-1)
@@ -38,12 +38,12 @@ class ForcableSemaphoreTests extends FlatSpec with Matchers {
}
it should "allow to acquire the defined amount of permits only" in {
- val s = new ForcableSemaphore(2)
+ val s = new ForcibleSemaphore(2)
s.tryAcquire() shouldBe true // 1 permit left
s.tryAcquire() shouldBe true // 0 permits left
s.tryAcquire() shouldBe false
- val s2 = new ForcableSemaphore(4)
+ val s2 = new ForcibleSemaphore(4)
s2.tryAcquire(5) shouldBe false // only 4 permits available
s2.tryAcquire(3) shouldBe true // 1 permit left
s2.tryAcquire(2) shouldBe false // only 1 permit available
@@ -51,7 +51,7 @@ class ForcableSemaphoreTests extends FlatSpec with Matchers {
}
it should "allow to release permits again" in {
- val s = new ForcableSemaphore(2)
+ val s = new ForcibleSemaphore(2)
s.tryAcquire() shouldBe true // 1 permit left
s.tryAcquire() shouldBe true // 0 permits left
s.tryAcquire() shouldBe false
@@ -62,7 +62,7 @@ class ForcableSemaphoreTests extends FlatSpec with Matchers {
}
it should "allow to force permits, delaying the acceptance of 'usual' permits until all of forced permits are released" in {
- val s = new ForcableSemaphore(2)
+ val s = new ForcibleSemaphore(2)
s.tryAcquire(2) shouldBe true // 0 permits left
s.forceAcquire(5) // -5 permits left
s.tryAcquire() shouldBe false
@@ -77,7 +77,7 @@ class ForcableSemaphoreTests extends FlatSpec with Matchers {
it should "not give away more permits even under concurrent load" in {
// 100 iterations of this test
(0 until 100).foreach { _ =>
- val s = new ForcableSemaphore(32)
+ val s = new ForcibleSemaphore(32)
// try to acquire more permits than allowed in parallel
val acquires = (0 until 64).par.map(_ => s.tryAcquire()).seq
diff --git a/tests/src/test/scala/whisk/core/loadBalancer/test/InvokerSupervisionTests.scala b/tests/src/test/scala/whisk/core/loadBalancer/test/InvokerSupervisionTests.scala
index 7537ab0..c8a8c01 100644
--- a/tests/src/test/scala/whisk/core/loadBalancer/test/InvokerSupervisionTests.scala
+++ b/tests/src/test/scala/whisk/core/loadBalancer/test/InvokerSupervisionTests.scala
@@ -268,13 +268,13 @@ class InvokerSupervisionTests
(1 to InvokerActor.bufferSize).foreach { _ =>
invoker ! InvocationFinishedMessage(InvokerInstanceId(0), InvocationFinishedResult.Timeout)
}
- pool.expectMsg(Transition(invoker, Healthy, Unresponsible))
+ pool.expectMsg(Transition(invoker, Healthy, Unresponsive))
// Fill buffer with successful invocations to become healthy again (one below errorTolerance)
(1 to InvokerActor.bufferSize - InvokerActor.bufferErrorTolerance).foreach { _ =>
invoker ! InvocationFinishedMessage(InvokerInstanceId(0), InvocationFinishedResult.Success)
}
- pool.expectMsg(Transition(invoker, Unresponsible, Healthy))
+ pool.expectMsg(Transition(invoker, Unresponsive, Healthy))
}
}
diff --git a/tests/src/test/scala/whisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala b/tests/src/test/scala/whisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
index 0755b99..2ba4dd6 100644
--- a/tests/src/test/scala/whisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
+++ b/tests/src/test/scala/whisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
@@ -21,7 +21,7 @@ import common.StreamLogging
import org.junit.runner.RunWith
import org.scalatest.{FlatSpec, Matchers}
import org.scalatest.junit.JUnitRunner
-import whisk.common.{ForcableSemaphore, TransactionId}
+import whisk.common.{ForcibleSemaphore, TransactionId}
import whisk.core.entity.InvokerInstanceId
import whisk.core.loadBalancer._
import whisk.core.loadBalancer.InvokerState._
@@ -40,8 +40,8 @@ class ShardingContainerPoolBalancerTests extends FlatSpec with Matchers with Str
def unhealthy(i: Int) = new InvokerHealth(InvokerInstanceId(i), Unhealthy)
def offline(i: Int) = new InvokerHealth(InvokerInstanceId(i), Offline)
- def semaphores(count: Int, max: Int): IndexedSeq[ForcableSemaphore] =
- IndexedSeq.fill(count)(new ForcableSemaphore(max))
+ def semaphores(count: Int, max: Int): IndexedSeq[ForcibleSemaphore] =
+ IndexedSeq.fill(count)(new ForcibleSemaphore(max))
def lbConfig(blackboxFraction: Double, invokerBusyThreshold: Int) =
ShardingContainerPoolBalancerConfig(blackboxFraction, invokerBusyThreshold, 1)