0

I need to write a portlet for Liferay 6.1 (Tomcat 7) which requires some background threads for efficiency and completeness.

The portlet app needs to regularly poll for information from an external server before it updates its internal state, and then update the UI if one exists.

I am not sure about the context in which a thread will run in Liferay.

Olaseni
  • 7,250
  • 15
  • 41
  • 64

1 Answers1

1

Nothing prevents you from launching a background Thread in a Java EE app server. It's just not recommended because the lifecycle of the thread is unknown to the application server and can lead to unexpected exceptions.

I would recommend reading this post, What is recommended way for spawning threads from a servlet in Tomcat

and especially the response regarding Common-J JSR 237

Community
  • 1
  • 1
Olivier Refalo
  • 46,213
  • 20
  • 84
  • 114