Making the initialization syncronized, but leaving the retrieval of picture list more flexible
git-svn-id: https://svn.apache.org/repos/asf/incubator/photark/trunk@909972 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/photark-jcr/src/main/java/org/apache/photark/services/album/jcr/AlbumImpl.java b/photark-jcr/src/main/java/org/apache/photark/services/album/jcr/AlbumImpl.java
index a9c76bd..bf0baf0 100644
--- a/photark-jcr/src/main/java/org/apache/photark/services/album/jcr/AlbumImpl.java
+++ b/photark-jcr/src/main/java/org/apache/photark/services/album/jcr/AlbumImpl.java
@@ -59,8 +59,13 @@
this.name = name;
}
+ /**
+ * Initialize the gallery service
+ * - During initialization, check for local images and create a JCR album
+ * which is usefull for sample gallery shiped in the sample application.
+ */
@Init
- public void init() {
+ public synchronized void init() {
System.out.println(">>> Initializing JCR Album");
try {
URL albumURL = this.getClass().getClassLoader().getResource(getLocation());
@@ -131,7 +136,7 @@
this.location = location;
}
- public synchronized String[] getPictures() {
+ public String[] getPictures() {
if (!initialized) {
init();
}