Adding ScalaDoc to EventStream

This commit is contained in:
Viktor Klang 2011-12-29 13:50:54 +01:00
parent f566182786
commit 3ac4672ac7
2 changed files with 8 additions and 2 deletions

View file

@ -116,7 +116,7 @@ trait LookupClassification { this: EventBus ⇒
*/
trait SubchannelClassification { this: EventBus
implicit val subclassification: Subclassification[Classifier]
protected implicit def subclassification: Subclassification[Classifier]
// must be lazy to avoid initialization order problem with subclassification
private lazy val subscriptions = new SubclassifiedIndex[Classifier, Subscriber]()

View file

@ -11,12 +11,18 @@ object EventStream {
implicit def fromActorSystem(system: ActorSystem) = system.eventStream
}
/**
* An Akka EventStream is a pub-sub stream of events both system and user generated,
* where subscribers are ActorRefs and the channels are Classes and Events are any java.lang.Object.
* EventStreams employ SubchannelClassification, which means that if you listen to a Class,
* you'll receive any message that is of that type or a subtype.
*/
class EventStream(private val debug: Boolean = false) extends LoggingBus with SubchannelClassification {
type Event = AnyRef
type Classifier = Class[_]
val subclassification = new Subclassification[Class[_]] {
protected implicit val subclassification = new Subclassification[Class[_]] {
def isEqual(x: Class[_], y: Class[_]) = x == y
def isSubclass(x: Class[_], y: Class[_]) = y isAssignableFrom x
}