<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Repository Session pools in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/repository-session-pools/m-p/16620#M7393</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am having a problem creating a JCR session pool.&amp;nbsp; Any suggestions are appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I set SimpleCreds and Repository for my Pool, then do lazy init for Repository Sessions. (using tomcat)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem comes up in this scenario:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Request A comes in, A is handled by thread P.&amp;nbsp; Session Z is created (Z is associated with P).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Request A is finished, session Z remains open in pool&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Request B comes in, takes up session Z.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4) Request C comes in, is handled by thread P.&amp;nbsp; Session Z is busy - need to create new session.&amp;nbsp; Thread P attempts to create a session - Exception! (there is a session Z associated with thread P already)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What are my options?&amp;nbsp; I was thinking:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- always start the Session from a new thread (but what if a new thread matches older thread?)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- check Alfresco source code, see what Thread is remembered by, keep a mapping in my app to make sure no duplicates are started.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- keep 1 session for all "read" operations, only give out root node.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The last option seems most attractive… but are may be possible concurrency issues with giving out root nodes from one session for all "read" operations… right?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Apr 2006 15:54:55 GMT</pubDate>
    <dc:creator>alexeyg</dc:creator>
    <dc:date>2006-04-04T15:54:55Z</dc:date>
    <item>
      <title>Repository Session pools</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/repository-session-pools/m-p/16620#M7393</link>
      <description>I am having a problem creating a JCR session pool.&amp;nbsp; Any suggestions are appreciated.I set SimpleCreds and Repository for my Pool, then do lazy init for Repository Sessions. (using tomcat)The problem comes up in this scenario:1) Request A comes in, A is handled by thread P.&amp;nbsp; Session Z is created (Z i</description>
      <pubDate>Tue, 04 Apr 2006 15:54:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/repository-session-pools/m-p/16620#M7393</guid>
      <dc:creator>alexeyg</dc:creator>
      <dc:date>2006-04-04T15:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Repository Session pools</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/repository-session-pools/m-p/16621#M7394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;JCR session login is not heavy.&amp;nbsp; The Alfresco JCR facade is very thin and relies upon level 1 and level 2 caching of the underlying Alfresco repository services - hardly anything is cached against the JCR session itself.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore, you might want to consider retrieving a new session for each thread.&amp;nbsp; This will give each thread its own transaction and is thread safe.&amp;nbsp; If you want to throttle usage, throttle the number of concurrent threads.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Apr 2006 20:57:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/repository-session-pools/m-p/16621#M7394</guid>
      <dc:creator>davidc</dc:creator>
      <dc:date>2006-04-04T20:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Repository Session pools</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/repository-session-pools/m-p/16622#M7395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your reply!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would you actually recommend starting a new session for each thread, or is it more of a convenience thing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We have multiple independent repository requests generated from each HTTP request - session pool came about because I was paranoid multiple log-ins per single request.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since posting I got it working by having the session pool start a new session from another thread.&amp;nbsp; It seems to work really well…&amp;nbsp; i will keep it that way unless you see possible problems with that setup…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am still getting "A valid SecureContext was not provided in the RequestContext" exceptions on session.getRootNode() from time to time… but refreshing the session by loggin in again takes care of that…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2006 16:55:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/repository-session-pools/m-p/16622#M7395</guid>
      <dc:creator>alexeyg</dc:creator>
      <dc:date>2006-04-05T16:55:37Z</dc:date>
    </item>
  </channel>
</rss>

