• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

twitter / finatra / 570
61%
develop: 81%

Build:
Build:
LAST BUILD BRANCH: master
DEFAULT BRANCH: develop
Ran 08 Jun 2015 08:06PM UTC
Jobs 6
Files 0
Run time –
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
570

push

travis-ci

jenkins
finatra/inject: singletonStartup/Shutdown methods

Problem:

To invoke startup functions within a Module, you have to call
singletonStartup within a configure().  singletonStartup mutates
the callback list of the module. This makes the module mutable, and
it can't be a singleton because when Guice calls its configure()
method, you mutate global state. The problem is exacerbated because
modules that compose it also can't be singletons even if the top
level module doesn't use singletonStartup. Thus it's not always
obvious when a module can be a singleton or not.

tl;dr global mutable state is bad

Solution:

Instead of appending callbacks to a list, use a method override.

override def singletonStartup(injector: Inject): Unit

Result:

Calling configure() will never mutate any state. Modules are more
side-effect free and can be objects.

RB_ID=685180
Jobs
ID Job ID Ran Files Coverage
1 570.1 08 Jun 2015 08:07PM UTC 0
Travis Job 570.1
2 570.2 08 Jun 2015 08:06PM UTC 0
Travis Job 570.2
3 570.3 08 Jun 2015 08:08PM UTC 0
Travis Job 570.3
4 570.4 08 Jun 2015 08:13PM UTC 0
Travis Job 570.4
5 570.5 08 Jun 2015 08:06PM UTC 0
Travis Job 570.5
6 570.6 08 Jun 2015 08:10PM UTC 0
Travis Job 570.6
Source Files on build 570
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #570
  • caac94cd on github
  • Prev Build on master (#566)
  • Next Build on master (#571)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc