Skip to content

Commit

Permalink
[Minor] Code refactored (lagom#504)
Browse files Browse the repository at this point in the history
* Minor code refactoring done

* minor code refactoring

* Reverted a missing parantheses.
  • Loading branch information
Himani Arora authored and ignasi35 committed Feb 20, 2017
1 parent 36ffc88 commit 18af933
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ private[cassandra] final class CassandraAutoReadSideHandler[Event <: AggregateEv

override protected def invoke(handler: Handler[Event], element: EventStreamElement[Event]): Future[immutable.Seq[BoundStatement]] = {
for {
statements <- (handler.asInstanceOf[EventStreamElement[Event] => Future[immutable.Seq[BoundStatement]]].apply(element))
statements <- handler
.asInstanceOf[EventStreamElement[Event] => Future[immutable.Seq[BoundStatement]]]
.apply(element)
} yield statements :+ offsetDao.bindSaveOffset(element.offset)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ private[lagom] class PersistentEntityActor[C, E, S](

def initEmpty(): Unit =
if (!initialized) {
val inital = entity.initialBehavior(Optional.empty[S])
entity.internalSetCurrentBehavior(inital)
val initial = entity.initialBehavior(Optional.empty[S])
entity.internalSetCurrentBehavior(initial)
initialized = true
}

{
case SnapshotOffer(_, snapshot) =>
if (!initialized) {
val inital = entity.initialBehavior(Optional.ofNullable(snapshot.asInstanceOf[S]))
entity.internalSetCurrentBehavior(inital)
val initial = entity.initialBehavior(Optional.ofNullable(snapshot.asInstanceOf[S]))
entity.internalSetCurrentBehavior(initial)
initialized = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private[lagom] class ReadSideActor[Event <: AggregateEvent[Event]](

case Done =>
val handler = processorFactory().buildHandler()
handler.prepare(tag).toScala.map(Start(_)) pipeTo self
handler.prepare(tag).toScala.map(Start) pipeTo self
context become active(handler, tag)

case Status.Failure(e) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ final class PubSubRef[T](val topic: TopicId[T], mediator: ActorRef, system: Acto
protected def writeReplace(): AnyRef =
throw new NotSerializableException(s"${getClass.getName} is not serializable. Send the entityId instead.")

override def toString(): String = s"PubSubRef($topic)"
override def toString: String = s"PubSubRef($topic)"

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ClusteredPubSubSpec extends MultiNodeSpec(ClusteredPubSubConfig)
enterBarrier("subscription-established-2")

ref2.publisher.runWith(
Source(List("a", "b", "c", "d", "e").map(Notification(_))))
Source(List("a", "b", "c", "d", "e").map(Notification)))
}

enterBarrier("after-2")
Expand Down

0 comments on commit 18af933

Please sign in to comment.