-
-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance / concurrency / MediaInfoParser #4635
Performance / concurrency / MediaInfoParser #4635
Conversation
… thread) / unblock JNI access
Good idea! |
@ik666 Each renderer has its own store under On I think synchronized members for Maybe it is too much synchronized members on But, JUPnP was locking the entire service on serving requests. |
@SurfaceS Thanks for comments and your code review. I'm not such a fan of static code access, but I can live with it and will merge your changes. Let's investigate the blocking thing when we run into issues. I'm working on blocking/waiting on requests for the same objectID and renderer. The synchronized methods synchronize agains the class, and this is IMHO far to much (block all renderer). Usually - in the current design - there is very little concurrency, because, as you mentioned, mediaStores are held for each renderer. |
The synchronized methods synchronize against the associated instance of the class => |
yes ... |
…anner in time, a folder is presented to the user telling him to wait and rescan.
Added user responsiveness. In case a requested folder cannot be scanned in time (2 seconds), a folder is presented to the user telling him to wait and rescan. If a request takes always longer than 2 second this implementation will actually fail. In that case, we could cache the result for later use (maybe should be implemented anyways). |
@@ -90,7 +91,7 @@ public class MediaInfo implements Cloneable { | |||
|
|||
private long lastExternalLookup = 0; | |||
private final Object parsingLock = new Object(); | |||
private boolean parsing = false; | |||
private AtomicBoolean parsing = new AtomicBoolean(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AtomicBoolean
mean volatile int, but why not.
@ik666
@ik666 Move this part under a separate PR as I don't think it will be merged, so it will late your PR. |
This PR makes UMS significantly more responsive in the initial scan phase after startup. Main blocking point was actually the
MediaInfoParser
, which is now multi threading aware.There is still some blocking in the
MediaStore.getResource
andMediaStore.getResources
methods, which causes acontrol point
to block initially for some seconds (in my case up to 20). However, every consecutive browse request is going through without any blocks. I'll have a look at that later.