<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Portlet lifecycle and concurrency</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=60589000" />
  <subtitle>Portlet lifecycle and concurrency</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=60589000</id>
  <updated>2026-04-07T16:11:47Z</updated>
  <dc:date>2026-04-07T16:11:47Z</dc:date>
  <entry>
    <title>RE: Portlet lifecycle and concurrency</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60612953" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60612953</id>
    <updated>2015-10-09T15:39:09Z</updated>
    <published>2015-10-09T15:39:09Z</published>
    <summary type="html">I&amp;#39;d say that the number of portlet object instances is probably undefined. It&amp;#39;s definitely insignificant and there&amp;#39;s no reason to have more than one. Any member variable in a portlet (or a servlet for that matter) is most likely the manifestation of a bug that you haven&amp;#39;t yet found.</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2015-10-09T15:39:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: Portlet lifecycle and concurrency</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60592390" />
    <author>
      <name>Ralph van Etten</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60592390</id>
    <updated>2015-10-09T06:46:59Z</updated>
    <published>2015-10-09T06:46:59Z</published>
    <summary type="html">I was reviewing some code and you confirmed my suspicions. I could not find a definite answer using Google.&lt;br /&gt;&lt;br /&gt;Anyway, thanks!</summary>
    <dc:creator>Ralph van Etten</dc:creator>
    <dc:date>2015-10-09T06:46:59Z</dc:date>
  </entry>
  <entry>
    <title>RE: Portlet lifecycle and concurrency</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60591396" />
    <author>
      <name>Devang Patel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60591396</id>
    <updated>2015-10-09T06:45:04Z</updated>
    <published>2015-10-09T06:45:04Z</published>
    <summary type="html">Hi Ralph van Etten,&lt;br /&gt;&lt;br /&gt;You can refer this links : &lt;br /&gt;&lt;a href="https://www.liferay.com/web/meera.success/blog/-/blogs/liferay-mvc-portlet-development-introduction"&gt;Blog on Liferay Portlet&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.opensource-techblog.com/2014/12/introduction-to-portlet-phases-and.html"&gt;Portlet Lifecycle&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And by default there is only one instance for portlet but you can do multiple instance for the portlet.&lt;br /&gt;Regards,&lt;br /&gt;Devang Patel</summary>
    <dc:creator>Devang Patel</dc:creator>
    <dc:date>2015-10-09T06:45:04Z</dc:date>
  </entry>
  <entry>
    <title>RE: Portlet lifecycle and concurrency</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60592298" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60592298</id>
    <updated>2015-10-09T06:39:09Z</updated>
    <published>2015-10-09T06:39:09Z</published>
    <summary type="html">Well, it&amp;#39;s kinda like asking how many instances of a servlet are in a web app because there, too, there will seem to be only one instance.&lt;br /&gt;&lt;br /&gt;Like a servlet, your portlet code must be multithreadable.  That&amp;#39;s why the action and render phases pass you the request and response objects, so when you have X number of users rendering your portlet, there will be X threads all invoking your portlet code with X requests and X responses.&lt;br /&gt;&lt;br /&gt;doView() is an artifact of Liferay MVC framework built upon the standard portlet lifecycle so yes, it too will be called concurrently.&lt;br /&gt;&lt;br /&gt;Sometimes developers get stuck on this, they&amp;#39;ll use private member variables for local value stores between action and render calls and it will actually test out fine on their local system where they are the only ones invoking the portlet lifecycle.  But when the code gets pushed to test and hit by many others, this code problem will reveal itself, sometimes in odd ways (depends, of course, on how it was coded).</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2015-10-09T06:39:09Z</dc:date>
  </entry>
  <entry>
    <title>Portlet lifecycle and concurrency</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60588999" />
    <author>
      <name>Ralph van Etten</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60588999</id>
    <updated>2015-10-09T05:59:30Z</updated>
    <published>2015-10-09T05:59:30Z</published>
    <summary type="html">Hi,&lt;br /&gt;&lt;br /&gt;I have a few questions about the portlet lifecycle and concurrency. &lt;br /&gt;&lt;br /&gt;1. How many instances are there of a portlet? It seems there is only a single instance in existence. Is this correct?&lt;br /&gt;&lt;br /&gt;2. Can the doView() method (for instance) be called concurrently by multiple threads/for multiple requests?&lt;br /&gt;&lt;br /&gt;Is there any documentation about this? I tried googling for this but I could not find anything useful about concurrency.&lt;br /&gt;&lt;br /&gt;Thanks.</summary>
    <dc:creator>Ralph van Etten</dc:creator>
    <dc:date>2015-10-09T05:59:30Z</dc:date>
  </entry>
</feed>
