Commits

Sebastian Sdorra  committed 47974c0

do not synchronize over all configuration entry stores

  • Participants
  • Parent commits ac09cb9
  • Branches issue-405

Comments (0)

Files changed (2)

File scm-dao-xml/src/main/java/sonia/scm/store/JAXBConfigurationEntryStore.java

 {
 
   /** Field description */
-  private static final Object LOCK = new Object();
-
-  /** Field description */
   private static final String TAG_CONFIGURATION = "configuration";
 
   /** Field description */
    * @param file
    * @param type
    */
-  JAXBConfigurationEntryStore(KeyGenerator keyGenerator, File file,
+  JAXBConfigurationEntryStore(File file, KeyGenerator keyGenerator,
     Class<V> type)
   {
+    this.file = file;
     this.keyGenerator = keyGenerator;
-    this.file = file;
     this.type = type;
 
     try
   {
     logger.debug("clear configuration store");
 
-    synchronized (LOCK)
+    synchronized (file)
     {
       entries.clear();
       store();
   {
     logger.debug("put item {} to configuration store", id);
 
-    synchronized (LOCK)
+    synchronized (file)
     {
       entries.put(id, item);
       store();
   {
     logger.debug("remove item {} from configuration store", id);
 
-    synchronized (LOCK)
+    synchronized (file)
     {
       entries.remove(id);
       store();
   //~--- fields ---------------------------------------------------------------
 
   /** Field description */
+  private final File file;
+
+  /** Field description */
   private JAXBContext context;
 
   /** Field description */
   private Map<String, V> entries = Maps.newHashMap();
 
   /** Field description */
-  private File file;
-
-  /** Field description */
   private KeyGenerator keyGenerator;
 
   /** Field description */

File scm-dao-xml/src/main/java/sonia/scm/store/JAXBConfigurationEntryStoreFactory.java

  */
 
 
+
 package sonia.scm.store;
 
 //~--- non-JDK imports --------------------------------------------------------
     logger.debug("create new configuration store for type {} with name {}",
       type, name);
 
-    return new JAXBConfigurationEntryStore<T>(keyGenerator,
-      new File(directory, name.concat(StoreConstants.FILE_EXTENSION)), type);
+    //J-
+    return new JAXBConfigurationEntryStore<T>(
+      new File(directory,name.concat(StoreConstants.FILE_EXTENSION)), 
+      keyGenerator, 
+      type
+    );
+    //J+
   }
 
   //~--- fields ---------------------------------------------------------------