Author: areshetnyak
Date: 2009-11-10 12:03:59 -0500 (Tue, 10 Nov 2009)
New Revision: 552
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-201 : The JDBCCacheLoader was changed.
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-10
16:49:51 UTC (rev 551)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-10
17:03:59 UTC (rev 552)
@@ -29,6 +29,8 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
@@ -56,6 +58,8 @@
*/
public class JDBCCacheLoader extends AbstractCacheLoader
{
+ protected static final Log LOG =
ExoLogger.getLogger("jcr.JDBCCacheLoader");
+
private IndividualCacheLoaderConfig config;
private WorkspaceDataContainer dataContainer;
@@ -132,8 +136,15 @@
}
}
- if (jdbcConnection != null)
+ if (jdbcConnection != null) {
jdbcConnection.commit();
+ jdbcConnection = null;
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Can not put data to DB", e);
+ throw e;
}
finally
{
@@ -246,9 +257,7 @@
for (int i = 0; i < modifications.size(); i++)
{
- if (modifications.get(i).getType() == ModificationType.PUT_KEY_VALUE
- &&
- modifications.get(i).getValue() instanceof ItemData)
+ if (modifications.get(i).getType() == ModificationType.PUT_KEY_VALUE)
{
ItemData itemData = null;
@@ -262,7 +271,10 @@
{
PropertyData propertyData = (PropertyData)
modifications.get(i).getValue();
itemData = jdbcConnection.getItemData(propertyData.getIdentifier());
- } else
+ } else {
+ modifications.set(i, new ModificationEx(modifications.get(i)));
+ continue;
+ }
// Set ModificationEx to list with type UPDATE or ADD.
if (itemData == null)
Show replies by date