Skip to content

Commit

Permalink
Make ScheduledThreadPoolTimer singleton, shared between FP instances
Browse files Browse the repository at this point in the history
  • Loading branch information
orrsella committed Apr 23, 2014
1 parent 8c87931 commit fd9ff95
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/scala/com/wix/async/FuturePerfect.scala
Expand Up @@ -11,13 +11,9 @@ import com.twitter.util.{Future, FuturePool, ScheduledThreadPoolTimer, Timer, St
* @author shaiyallin
* @since 10/31/12
*/

trait FuturePerfect extends Reporting[Event] {

def executorService: ExecutorService

private lazy val timer: Timer = new ScheduledThreadPoolTimer()

class AsyncExecution[T](executorService: ExecutorService,
timeout: Duration,
retryPolicy: RetryPolicy,
Expand Down Expand Up @@ -100,6 +96,7 @@ trait FuturePerfect extends Reporting[Event] {

object FuturePerfect {
type TimeoutHandler = PartialFunction[TimeoutException, Exception]
private lazy val timer: Timer = new ScheduledThreadPoolTimer()

sealed trait Event {
def executionName: String
Expand Down

0 comments on commit fd9ff95

Please sign in to comment.