This page is no longer maintained — Please continue to the home page at

Cleanup Actor resources issue

No replies
Jozo Vilcek
Joined: 2012-01-03,
User offline. Last seen 42 years 45 weeks ago.

Hi everyone,

I have recently started to play with Scala (version 2.9.1) ant its
Actor model. As a demo application to test overall experience and
integration with java, I decided to create kind of a ping pong actor
communication, which would be initialized via Spring IoC and hosted in
web container (Tomcat 7).

Everything plays well, but I am facing an issue with stopping and
cleaning up Actors code. When I stop / reload / undeploy my demo
application on Tomcat, I see error in the console complaining about :

org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [Demo] appears to have started a thread
named [Timer-0] but has failed to stop it. This is very likely to
create a memory leak.

After some investigation I find out that Actor singleton object is
spawning a Timer in daemon mode which seems to be a possible reason,
because I was not able to find a proper hook to somehow release it.

I seek for an advise how to use Actors safely, start / stop / release
resources. Am I right about the cause of my issue? How to mitigate


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland