- Купить более мощный кнут.
- Сменить наездника.
- Говорить: «А мы всегда так скачем — на дохлых лошадях».
- Создать комитет по изучению лошади.
- Посетить другие компании, чтобы узнать их опыт скачек на дохлых лошадях.
- Начать разрабатывать стандарты езды на мертвых лошадях.
- Создать специальную команду из сильных специалистов для оживления лошади.
- Создать курсы для персонала по езде на дохлых лошадях.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// было | |
val best = found.foldLeft(DoerAvailability(null, 0, null)) { (best, cur) ⇒ | |
if (best.availability > cur.availability) best | |
else cur | |
} | |
// стало | |
val best = found.reduce { (best, cur) ⇒ | |
if (best.availability > cur.availability) best |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// было | |
lastCheckinNode match { | |
case Some(node) ⇒ { | |
if (node == route.routeTemplate.fromNode) { | |
workload match { | |
case 0 ⇒ 10 | |
case x if x > 0 ⇒ 0 | |
case x ⇒ 6 - x | |
} | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// initiator | |
// send synced message | |
SimpleSync(articleTerminator, TerminateArticle(1L, 1)) onSucces { | |
// sync ok, article successfully removed | |
} onFailure { | |
// sync fail | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Continue(otherService ? "my message") onSuccess { | |
case r ⇒ println("Yahhooo! onSuccess: " + r) | |
} onFailure { | |
case e ⇒ println("Fail: " + e) | |
} | |
otherService ? "my message" continueSuccess { | |
case r ⇒ println("Yahhooo! onSuccess: " + r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.libitec.sce.util.actor | |
import akka.actor.{ActorRef, Actor} | |
import akka.dispatch.Future | |
/** | |
* Message wrapper | |
*/ | |
sealed protected case class ContinuationMessageWrapper[T](message: T, handler: PartialFunction[T, Unit]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def useRedis[T](handler: (Jedis) ⇒ T): T = { | |
val jedis = redisPool.getResource | |
try { | |
handler(jedis) | |
} finally { | |
redisPool.returnResource(jedis) | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Finds acceptable route or creates a new route from possible templates to the given neighbour node | |
* @since 07.09.12 18:32 | |
* @author kulikov | |
*/ | |
def returnRouteTo(node: NodeInfo, need: NeedInfo) { | |
val routesToTargetNode = outgoingRoutes filter (_._2.routeTemplate.toNode == node) | |
// find scheduled route, if not exists - find instant route | |
// if has't ready routes - create and return new instant route |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"/doer/:doerId/:sortBy": (doerId, sortBy) -> | |
"widget": "//mainLayout" | |
"params": | |
"doerId": doerId | |
"sortBy": sortBy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Finds available doer for this route and send it back | |
*/ | |
def findDoerForRoute(route: RouteInfo) { | |
val originalSender = sender | |
def doerNotFound(reason: Option[_] = None) { | |
self ! RegisterUnassignedRoute(route) | |
originalSender ! DoerNotFound(reason.orNull) | |
} |