You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2008/04/23 16:57:21 UTC

[jira] Created: (JCR-1551) TransientRepository: application doesn't exist quickly

TransientRepository: application doesn't exist quickly
------------------------------------------------------

                 Key: JCR-1551
                 URL: https://issues.apache.org/jira/browse/JCR-1551
             Project: Jackrabbit
          Issue Type: Bug
          Components: jackrabbit-core
            Reporter: Thomas Mueller
            Assignee: Thomas Mueller
            Priority: Minor


When using the TransientRepository, the repository should be closed when the last session logs out. This works, but in some cases there is a very long (60 seconds) delay between closing the last session and closing the repository.

Test case:

    public static void main(String[] args) throws Exception {
        Repository repository = new TransientRepository();
        Session session = repository.login(new SimpleCredentials("", new char[0]));
        session.getRootNode().setProperty("a", "0");
        session.save(); // very quick logout without this line
        session.logout();
        System.out.println("Logout...");
        final long time = System.currentTimeMillis();
        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() {
                System.out.println("End after: " + (System.currentTimeMillis() - time));
            }
        });
    }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1551) TransientRepository: application doesn't exist quickly

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592606#action_12592606 ] 

Jukka Zitting commented on JCR-1551:
------------------------------------

The shutdown delay seems to be caused by the static DynamicPooledExecutor instance introduced in JCR-1222.

> TransientRepository: application doesn't exist quickly
> ------------------------------------------------------
>
>                 Key: JCR-1551
>                 URL: https://issues.apache.org/jira/browse/JCR-1551
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>
> When using the TransientRepository, the repository should be closed when the last session logs out. This works, but in some cases there is a very long (60 seconds) delay between closing the last session and closing the repository.
> Test case:
>     public static void main(String[] args) throws Exception {
>         Repository repository = new TransientRepository();
>         Session session = repository.login(new SimpleCredentials("", new char[0]));
>         session.getRootNode().setProperty("a", "0");
>         session.save(); // very quick logout without this line
>         session.logout();
>         System.out.println("Logout...");
>         final long time = System.currentTimeMillis();
>         Runtime.getRuntime().addShutdownHook(new Thread() {
>             public void run() {
>                 System.out.println("End after: " + (System.currentTimeMillis() - time));
>             }
>         });
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1551) TransientRepository: application doesn't exist quickly

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592754#action_12592754 ] 

Thomas Mueller commented on JCR-1551:
-------------------------------------

Thanks for the tip! Indeed the DynamicPooledExecutor seems to be the problem. from http://g.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.html

"The default keep-alive value is one minute"

If I change that to 500 ms, the repository is shut down very quickly. I don't know however what the effect on indexing performance is, so I wait with committing until somebody with more insight can review the change. See also: https://issues.apache.org/jira/browse/JCR-1222

Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DynamicPooledExecutor.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DynamicPooledExecutor.java	(revision 651569)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DynamicPooledExecutor.java	(working copy)
@@ -49,6 +49,7 @@
      */
     public DynamicPooledExecutor() {
         executor = new PooledExecutor();
+        executor.setKeepAliveTime(500);
         executor.waitWhenBlocked();
         adjustPoolSize();
     }


> TransientRepository: application doesn't exist quickly
> ------------------------------------------------------
>
>                 Key: JCR-1551
>                 URL: https://issues.apache.org/jira/browse/JCR-1551
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>
> When using the TransientRepository, the repository should be closed when the last session logs out. This works, but in some cases there is a very long (60 seconds) delay between closing the last session and closing the repository.
> Test case:
>     public static void main(String[] args) throws Exception {
>         Repository repository = new TransientRepository();
>         Session session = repository.login(new SimpleCredentials("", new char[0]));
>         session.getRootNode().setProperty("a", "0");
>         session.save(); // very quick logout without this line
>         session.logout();
>         System.out.println("Logout...");
>         final long time = System.currentTimeMillis();
>         Runtime.getRuntime().addShutdownHook(new Thread() {
>             public void run() {
>                 System.out.println("End after: " + (System.currentTimeMillis() - time));
>             }
>         });
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1551) TransientRepository: application doesn't exit quickly

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12594840#action_12594840 ] 

Marcel Reutegger commented on JCR-1551:
---------------------------------------

Looks OK to me. Please go ahead and commit the change.

> TransientRepository: application doesn't exit quickly
> -----------------------------------------------------
>
>                 Key: JCR-1551
>                 URL: https://issues.apache.org/jira/browse/JCR-1551
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>
> When using the TransientRepository, the repository should be closed when the last session logs out. This works, but in some cases there is a very long (60 seconds) delay between closing the last session and closing the repository.
> Test case:
>     public static void main(String[] args) throws Exception {
>         Repository repository = new TransientRepository();
>         Session session = repository.login(new SimpleCredentials("", new char[0]));
>         session.getRootNode().setProperty("a", "0");
>         session.save(); // very quick logout without this line
>         session.logout();
>         System.out.println("Logout...");
>         final long time = System.currentTimeMillis();
>         Runtime.getRuntime().addShutdownHook(new Thread() {
>             public void run() {
>                 System.out.println("End after: " + (System.currentTimeMillis() - time));
>             }
>         });
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1551) TransientRepository: application doesn't exit quickly

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller resolved JCR-1551.
---------------------------------

    Resolution: Fixed

Fixed in revision 654078

> TransientRepository: application doesn't exit quickly
> -----------------------------------------------------
>
>                 Key: JCR-1551
>                 URL: https://issues.apache.org/jira/browse/JCR-1551
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>
> When using the TransientRepository, the repository should be closed when the last session logs out. This works, but in some cases there is a very long (60 seconds) delay between closing the last session and closing the repository.
> Test case:
>     public static void main(String[] args) throws Exception {
>         Repository repository = new TransientRepository();
>         Session session = repository.login(new SimpleCredentials("", new char[0]));
>         session.getRootNode().setProperty("a", "0");
>         session.save(); // very quick logout without this line
>         session.logout();
>         System.out.println("Logout...");
>         final long time = System.currentTimeMillis();
>         Runtime.getRuntime().addShutdownHook(new Thread() {
>             public void run() {
>                 System.out.println("End after: " + (System.currentTimeMillis() - time));
>             }
>         });
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1551) TransientRepository: application doesn't exit quickly

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1551:
-------------------------------

    Affects Version/s: 1.4
                       core 1.4.1
                       core 1.4.2
                       core 1.4.3
                       core 1.4.4
        Fix Version/s: core 1.4.5

Merged to the 1.4 branch in revision 654078.

> TransientRepository: application doesn't exit quickly
> -----------------------------------------------------
>
>                 Key: JCR-1551
>                 URL: https://issues.apache.org/jira/browse/JCR-1551
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.4, core 1.4.1, core 1.4.2, core 1.4.3, core 1.4.4
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>             Fix For: core 1.4.5
>
>
> When using the TransientRepository, the repository should be closed when the last session logs out. This works, but in some cases there is a very long (60 seconds) delay between closing the last session and closing the repository.
> Test case:
>     public static void main(String[] args) throws Exception {
>         Repository repository = new TransientRepository();
>         Session session = repository.login(new SimpleCredentials("", new char[0]));
>         session.getRootNode().setProperty("a", "0");
>         session.save(); // very quick logout without this line
>         session.logout();
>         System.out.println("Logout...");
>         final long time = System.currentTimeMillis();
>         Runtime.getRuntime().addShutdownHook(new Thread() {
>             public void run() {
>                 System.out.println("End after: " + (System.currentTimeMillis() - time));
>             }
>         });
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.