[libbluray-devel] BDJAppsDatabase: use dedicated lock object
hpi1
git at videolan.org
Wed Mar 23 14:12:47 CET 2016
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Mar 23 13:57:16 2016 +0200| [f9d5a3e678820ae55eee4a64fa55ba5eda1542e5] | committer: hpi1
BDJAppsDatabase: use dedicated lock object
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=f9d5a3e678820ae55eee4a64fa55ba5eda1542e5
---
src/libbluray/bdj/java/org/videolan/BDJAppsDatabase.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/libbluray/bdj/java/org/videolan/BDJAppsDatabase.java b/src/libbluray/bdj/java/org/videolan/BDJAppsDatabase.java
index ca39f12..8fea525 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJAppsDatabase.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJAppsDatabase.java
@@ -39,8 +39,10 @@ public class BDJAppsDatabase extends AppsDatabase {
}
}
+ private static final Object appTableLock = new Object();
+
public int size() {
- synchronized (this) {
+ synchronized (appTableLock) {
if (appTable == null)
return 0;
return appTable.length;
@@ -49,7 +51,7 @@ public class BDJAppsDatabase extends AppsDatabase {
public Enumeration getAppIDs(AppsDatabaseFilter filter) {
Vector ids = new Vector();
- synchronized (this) {
+ synchronized (appTableLock) {
if (appTable != null)
for (int i = 0; i < appTable.length; i++)
if (filter.accept(appTable[i].getIdentifier()))
@@ -60,7 +62,7 @@ public class BDJAppsDatabase extends AppsDatabase {
public Enumeration getAppAttributes(AppsDatabaseFilter filter) {
Vector attributes = new Vector();
- synchronized (this) {
+ synchronized (appTableLock) {
if (appTable != null)
for (int i = 0; i < size(); i++)
if (filter.accept(appTable[i].getIdentifier()))
@@ -70,7 +72,7 @@ public class BDJAppsDatabase extends AppsDatabase {
}
public AppAttributes getAppAttributes(AppID key) {
- synchronized (this) {
+ synchronized (appTableLock) {
if (appTable != null)
for (int i = 0; i < size(); i++)
if (key.equals(appTable[i].getIdentifier()))
@@ -80,7 +82,7 @@ public class BDJAppsDatabase extends AppsDatabase {
}
public AppProxy getAppProxy(AppID key) {
- synchronized (this) {
+ synchronized (appTableLock) {
if ((appTable != null) && (appProxys != null))
for (int i = 0; i < size(); i++)
if (key.equals(appTable[i].getIdentifier()))
@@ -94,7 +96,7 @@ public class BDJAppsDatabase extends AppsDatabase {
}
protected void newDatabase(Bdjo bdjo, BDJAppProxy[] appProxys) {
- synchronized (this) {
+ synchronized (appTableLock) {
this.bdjo = bdjo;
this.appProxys = appProxys;
this.appTable = (bdjo != null) ? bdjo.getAppTable() : null;
More information about the libbluray-devel
mailing list