incorporate Viktor’s review
- rename instance() to getInstance() - add ScalaDoc - some formatting
This commit is contained in:
parent
b6db48818a
commit
201885d125
6 changed files with 61 additions and 21 deletions
|
|
@ -32,18 +32,18 @@ public class JavaAPI {
|
|||
// compilation tests
|
||||
@SuppressWarnings("unused")
|
||||
public void mustCompile() {
|
||||
final Kill kill = Kill.instance();
|
||||
final PoisonPill pill = PoisonPill.instance();
|
||||
final ReceiveTimeout t = ReceiveTimeout.instance();
|
||||
final Kill kill = Kill.getInstance();
|
||||
final PoisonPill pill = PoisonPill.getInstance();
|
||||
final ReceiveTimeout t = ReceiveTimeout.getInstance();
|
||||
|
||||
final LocalScope ls = LocalScope.instance();
|
||||
final NoScopeGiven noscope = NoScopeGiven.instance();
|
||||
final LocalScope ls = LocalScope.getInstance();
|
||||
final NoScopeGiven noscope = NoScopeGiven.getInstance();
|
||||
|
||||
final LoggerInitialized x = Logging.loggerInitialized();
|
||||
|
||||
final CurrentRoutees r = CurrentRoutees.instance();
|
||||
final NoRouter nr = NoRouter.instance();
|
||||
final FromConfig fc = FromConfig.instance();
|
||||
final CurrentRoutees r = CurrentRoutees.getInstance();
|
||||
final NoRouter nr = NoRouter.getInstance();
|
||||
final FromConfig fc = FromConfig.getInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -30,19 +30,28 @@ case class Failed(cause: Throwable) extends AutoReceivedMessage with PossiblyHar
|
|||
|
||||
abstract class PoisonPill extends AutoReceivedMessage with PossiblyHarmful
|
||||
case object PoisonPill extends PoisonPill {
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
}
|
||||
|
||||
abstract class Kill extends AutoReceivedMessage with PossiblyHarmful
|
||||
case object Kill extends Kill {
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
}
|
||||
|
||||
case class Terminated(@BeanProperty actor: ActorRef) extends PossiblyHarmful
|
||||
|
||||
abstract class ReceiveTimeout extends PossiblyHarmful
|
||||
case object ReceiveTimeout extends ReceiveTimeout {
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -71,7 +71,10 @@ case object LocalScope extends LocalScope {
|
|||
@deprecated("use instance() method instead", "2.0.1")
|
||||
def scope: Scope = this
|
||||
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
|
||||
def withFallback(other: Scope): Scope = this
|
||||
}
|
||||
|
|
@ -84,7 +87,10 @@ abstract class NoScopeGiven extends Scope
|
|||
case object NoScopeGiven extends NoScopeGiven {
|
||||
def withFallback(other: Scope): Scope = other
|
||||
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -590,7 +590,10 @@ object Logging {
|
|||
*/
|
||||
abstract class LoggerInitialized
|
||||
case object LoggerInitialized extends LoggerInitialized {
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -346,7 +346,10 @@ case class Broadcast(message: Any)
|
|||
*/
|
||||
abstract class CurrentRoutees
|
||||
case object CurrentRoutees extends CurrentRoutees {
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -376,16 +379,22 @@ case object NoRouter extends NoRouter {
|
|||
def supervisorStrategy = null
|
||||
override def withFallback(other: RouterConfig): RouterConfig = other
|
||||
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
}
|
||||
|
||||
/**
|
||||
* Router configuration which has no default, i.e. external configuration is required.
|
||||
*/
|
||||
case object FromConfig extends FromConfig {
|
||||
def instance = this
|
||||
def apply(routerDispatcher: String = Dispatchers.DefaultDispatcherId) = new FromConfig(routerDispatcher)
|
||||
def unapply(fc: FromConfig): Option[String] = Some(fc.routerDispatcher)
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
@inline final def apply(routerDispatcher: String = Dispatchers.DefaultDispatcherId) = new FromConfig(routerDispatcher)
|
||||
@inline final def unapply(fc: FromConfig): Option[String] = Some(fc.routerDispatcher)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -411,21 +420,28 @@ class FromConfig(val routerDispatcher: String = Dispatchers.DefaultDispatcherId)
|
|||
// open-coded case class to preserve binary compatibility, all deprecated for 2.1
|
||||
@deprecated("FromConfig does not make sense as case class", "2.0.1")
|
||||
override def productPrefix = "FromConfig"
|
||||
|
||||
@deprecated("FromConfig does not make sense as case class", "2.0.1")
|
||||
def productArity = 1
|
||||
|
||||
@deprecated("FromConfig does not make sense as case class", "2.0.1")
|
||||
def productElement(x: Int) = x match {
|
||||
case 0 ⇒ routerDispatcher
|
||||
case _ ⇒ throw new IndexOutOfBoundsException(x.toString)
|
||||
}
|
||||
|
||||
@deprecated("FromConfig does not make sense as case class", "2.0.1")
|
||||
def copy(d: String = Dispatchers.DefaultDispatcherId): FromConfig = new FromConfig(d)
|
||||
|
||||
@deprecated("FromConfig does not make sense as case class", "2.0.1")
|
||||
def canEqual(o: Any) = o.isInstanceOf[FromConfig]
|
||||
|
||||
@deprecated("FromConfig does not make sense as case class", "2.0.1")
|
||||
override def hashCode = ScalaRunTime._hashCode(this)
|
||||
|
||||
@deprecated("FromConfig does not make sense as case class", "2.0.1")
|
||||
override def toString = "FromConfig(" + routerDispatcher + ")"
|
||||
|
||||
@deprecated("FromConfig does not make sense as case class", "2.0.1")
|
||||
override def equals(other: Any): Boolean = other match {
|
||||
case FromConfig(x) ⇒ x == routerDispatcher
|
||||
|
|
|
|||
|
|
@ -12,11 +12,17 @@ sealed trait Response
|
|||
* When the ZeroMQ socket connects it sends this message to a listener
|
||||
*/
|
||||
case object Connecting extends Response {
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
}
|
||||
/**
|
||||
* When the ZeroMQ socket disconnects it sends this message to a listener
|
||||
*/
|
||||
case object Closed extends Response {
|
||||
def instance = this
|
||||
/**
|
||||
* Java API: get the singleton instance
|
||||
*/
|
||||
def getInstance = this
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue