You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Peter Gardfjäll (JIRA)" <ji...@apache.org> on 2010/03/14 15:43:27 UTC

[jira] Created: (FELIX-2201) [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order

[FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order
-------------------------------------------------------------------------------------------

                 Key: FELIX-2201
                 URL: https://issues.apache.org/jira/browse/FELIX-2201
             Project: Felix
          Issue Type: Improvement
          Components: File Install
    Affects Versions: fileinstall-2.0.4
            Reporter: Peter Gardfjäll


Currently FileInstall does not process new files in the load directory in any particular order.
It would be beneficial to have these artifacts processed in a First-Come-First-Served order.
That is, in order of increasing file modification time.

Refer to the following email thread for details
  http://www.mail-archive.com/users@felix.apache.org/msg06949.html

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


[jira] Reopened: (FELIX-2201) [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order

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

Guillaume Nodet reopened FELIX-2201:
------------------------------------


Hi,

The patch applied to fix FELIX-2201 seems to have caused a regression:
See: https://issues.apache.org/jira/browse/FELIX-2201
svn diff -c937979 http://svn.apache.org/repos/asf/felix

The problem is that it keeps a TreeSet of files, ordered by last
modification time.  This causes a problem when more than one file in
the directory has the same modification time.  Say all the files in
the watched directory have the same timestamp: the resulting TreeSet
contains only one element!  (See TreeMap#put(K,V)).

I've read though the mailing list discussion about the issue [1], and
I still don't understand the purpose of the patch.  Specifically, I
don't follow why it's necessary to handle artifacts that "are
basically sets of 'library bundles' that export packages rather than
services" [2].

Maintaining a TreeSet based on a file timestamp doesn't seem like a
good solution:  what happens if the timestamp changes while it is in
the set?  Does the TreeSet then become inconsistent?  It also seems
somewhat heavyweight: how many times do all the files get stat'd to
check their timestamps while building the set?

Because of the regression: I'd like to re-open the bug, if that's OK?
Could the 'fix' be reverted until a better solution can be found?

Regards,
Martin

[1] http://www.mail-archive.com/users@felix.apache.org/msg06949.html
[2] http://www.mail-archive.com/users@felix.apache.org/msg06963.html


> [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order
> -------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2201
>                 URL: https://issues.apache.org/jira/browse/FELIX-2201
>             Project: Felix
>          Issue Type: Improvement
>          Components: File Install
>    Affects Versions: fileinstall-2.0.4
>            Reporter: Peter Gardfjäll
>            Assignee: Guillaume Nodet
>             Fix For: fileinstall-2.0.10
>
>         Attachments: processing_order_patch.diff
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> Currently FileInstall does not process new files in the load directory in any particular order.
> It would be beneficial to have these artifacts processed in a First-Come-First-Served order.
> That is, in order of increasing file modification time.
> Refer to the following email thread for details
>   http://www.mail-archive.com/users@felix.apache.org/msg06949.html

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


[jira] Resolved: (FELIX-2201) [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order

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

Guillaume Nodet resolved FELIX-2201.
------------------------------------

         Assignee: Guillaume Nodet
    Fix Version/s: fileinstall-2.0.10
       Resolution: Fixed

Committing to https://svn.apache.org/repos/asf/felix/trunk ...
	M	fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Scanner.java
Committed r937979


> [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order
> -------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2201
>                 URL: https://issues.apache.org/jira/browse/FELIX-2201
>             Project: Felix
>          Issue Type: Improvement
>          Components: File Install
>    Affects Versions: fileinstall-2.0.4
>            Reporter: Peter Gardfjäll
>            Assignee: Guillaume Nodet
>             Fix For: fileinstall-2.0.10
>
>         Attachments: processing_order_patch.diff
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> Currently FileInstall does not process new files in the load directory in any particular order.
> It would be beneficial to have these artifacts processed in a First-Come-First-Served order.
> That is, in order of increasing file modification time.
> Refer to the following email thread for details
>   http://www.mail-archive.com/users@felix.apache.org/msg06949.html

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


[jira] Updated: (FELIX-2201) [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order

Posted by "Peter Gardfjäll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Gardfjäll updated FELIX-2201:
-----------------------------------

    Attachment: processing_order_patch.diff

Attached a patch that implements the requested feature.

> [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order
> -------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2201
>                 URL: https://issues.apache.org/jira/browse/FELIX-2201
>             Project: Felix
>          Issue Type: Improvement
>          Components: File Install
>    Affects Versions: fileinstall-2.0.4
>            Reporter: Peter Gardfjäll
>         Attachments: processing_order_patch.diff
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> Currently FileInstall does not process new files in the load directory in any particular order.
> It would be beneficial to have these artifacts processed in a First-Come-First-Served order.
> That is, in order of increasing file modification time.
> Refer to the following email thread for details
>   http://www.mail-archive.com/users@felix.apache.org/msg06949.html

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


[jira] Updated: (FELIX-2201) [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order

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

Guillaume Nodet updated FELIX-2201:
-----------------------------------

    Fix Version/s: fileinstall-3.1.0
                       (was: fileinstall-3.0.0)

> [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order
> -------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2201
>                 URL: https://issues.apache.org/jira/browse/FELIX-2201
>             Project: Felix
>          Issue Type: Improvement
>          Components: File Install
>    Affects Versions: fileinstall-2.0.4
>            Reporter: Peter Gardfjäll
>            Assignee: Guillaume Nodet
>             Fix For: fileinstall-3.1.0
>
>         Attachments: processing_order_patch.diff
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> Currently FileInstall does not process new files in the load directory in any particular order.
> It would be beneficial to have these artifacts processed in a First-Come-First-Served order.
> That is, in order of increasing file modification time.
> Refer to the following email thread for details
>   http://www.mail-archive.com/users@felix.apache.org/msg06949.html

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


[jira] Updated: (FELIX-2201) [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order

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

Guillaume Nodet updated FELIX-2201:
-----------------------------------

    Fix Version/s:     (was: fileinstall-3.1.0)

> [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order
> -------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2201
>                 URL: https://issues.apache.org/jira/browse/FELIX-2201
>             Project: Felix
>          Issue Type: Improvement
>          Components: File Install
>    Affects Versions: fileinstall-2.0.4
>            Reporter: Peter Gardfjäll
>            Assignee: Guillaume Nodet
>         Attachments: processing_order_patch.diff
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> Currently FileInstall does not process new files in the load directory in any particular order.
> It would be beneficial to have these artifacts processed in a First-Come-First-Served order.
> That is, in order of increasing file modification time.
> Refer to the following email thread for details
>   http://www.mail-archive.com/users@felix.apache.org/msg06949.html

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


[jira] Commented: (FELIX-2201) [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order

Posted by "Peter Gardfjäll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861072#action_12861072 ] 

Peter Gardfjäll commented on FELIX-2201:
----------------------------------------

Right, the patch wasn't foolproof. I guess it could be corrected quite easily by handling the case of equal timestamps:

/**
 * {@link Comparator} that sorts {@link File}s in increasing order of modification time 
 * ("oldest first"). When modification times are equal, artifacts are processed in lexicographical 
 * pathname order. 
 */
 private final class FileModificationTimeComparator implements Comparator {
     public int compare(Object arg0, Object arg1) {
         File lhs = (File) arg0;
         File rhs = (File) arg1;				
         if (lhs.lastModified() == rhs.lastModified()) {
               return lhs.compareTo(rhs);
         }        
         return (int) (lhs.lastModified() - rhs.lastModified());
     }
}

@Martin: the artifact installer I'm writing handles zip file artifacts that group together several bundle jars, allowing them to be deployed as a single unit. This is similar to the Application/Subsystem spec (?) under development in the Aries project. In some cases, when my "subsystems" depend on one another (say bundles in B.zip relies on packages exported by bundles in A.zip), it is nice to know that FileInstall won't change the processing order after a clean restart of the framework. In the current, "no-order" processing, it is possible that, after a restart, FileInstall processes B.zip prior to A.zip, which causes B.zip installation to fail. Introducing a deterministic processing order seemed like a simple way to handle this, without introducing extra logic to my installer (to handle failed artifacts). Does that make any sense?

Anyhow, if this sounds totally unreasonable, it is fine to cancel this issue.
I have a working solution based on a custom-written directory watcher. 
Just thought it'd be nice to reuse the functionality provided by the FileInstall bundle.

> [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order
> -------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2201
>                 URL: https://issues.apache.org/jira/browse/FELIX-2201
>             Project: Felix
>          Issue Type: Improvement
>          Components: File Install
>    Affects Versions: fileinstall-2.0.4
>            Reporter: Peter Gardfjäll
>            Assignee: Guillaume Nodet
>             Fix For: fileinstall-2.0.10
>
>         Attachments: processing_order_patch.diff
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> Currently FileInstall does not process new files in the load directory in any particular order.
> It would be beneficial to have these artifacts processed in a First-Come-First-Served order.
> That is, in order of increasing file modification time.
> Refer to the following email thread for details
>   http://www.mail-archive.com/users@felix.apache.org/msg06949.html

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


[jira] Resolved: (FELIX-2201) [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order

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

Guillaume Nodet resolved FELIX-2201.
------------------------------------

    Resolution: Won't Fix

I'll close the issue as I don't think your requirements can be correctly met by fileinstall.
You may want to have a look at Karaf feature deployer which can handle the same kind of subsystems and dependencies and leverage the deployer to trigger the installation of such feature (without using bundles in the deploy folder directly).

> [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order
> -------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2201
>                 URL: https://issues.apache.org/jira/browse/FELIX-2201
>             Project: Felix
>          Issue Type: Improvement
>          Components: File Install
>    Affects Versions: fileinstall-2.0.4
>            Reporter: Peter Gardfjäll
>            Assignee: Guillaume Nodet
>             Fix For: fileinstall-3.1.0
>
>         Attachments: processing_order_patch.diff
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> Currently FileInstall does not process new files in the load directory in any particular order.
> It would be beneficial to have these artifacts processed in a First-Come-First-Served order.
> That is, in order of increasing file modification time.
> Refer to the following email thread for details
>   http://www.mail-archive.com/users@felix.apache.org/msg06949.html

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


[jira] Commented: (FELIX-2201) [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861041#action_12861041 ] 

Guillaume Nodet commented on FELIX-2201:
----------------------------------------

I don't understand the problem either, but in all cases, I thought having a deterministic order could make sense.  It seems the one proposed can't be used as is anyway.  I've reverted the patch.

> [FileInstall] Make Scanner process artifacts in "oldest-file-modification-time first" order
> -------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2201
>                 URL: https://issues.apache.org/jira/browse/FELIX-2201
>             Project: Felix
>          Issue Type: Improvement
>          Components: File Install
>    Affects Versions: fileinstall-2.0.4
>            Reporter: Peter Gardfjäll
>            Assignee: Guillaume Nodet
>             Fix For: fileinstall-2.0.10
>
>         Attachments: processing_order_patch.diff
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> Currently FileInstall does not process new files in the load directory in any particular order.
> It would be beneficial to have these artifacts processed in a First-Come-First-Served order.
> That is, in order of increasing file modification time.
> Refer to the following email thread for details
>   http://www.mail-archive.com/users@felix.apache.org/msg06949.html

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