Author: andreas
Date: Fri Oct 26 03:16:46 2007
New Revision: 588596
URL: http://svn.apache.org/viewvc?rev=588596&view=rev
Log:
Avoid event queuing only while session is being committed. This fixes the ObservationTest.
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java?rev=588596&r1=588595&r2=588596&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java Fri Oct 26 03:16:46 2007
@@ -122,7 +122,7 @@
return this.unitOfWork;
}
- private boolean committed = false;
+ private boolean committing = false;
/**
* Commits the transaction.
@@ -134,6 +134,8 @@
savePersistables();
+ this.committing = true;
+
try {
synchronized (TransactionLock.LOCK) {
@@ -146,8 +148,6 @@
throw new RepositoryException(e);
}
- this.committed = true;
-
for (Iterator i = this.events.iterator(); i.hasNext();) {
RepositoryEvent event = (RepositoryEvent) i.next();
for (Iterator l = this.listeners.iterator(); l.hasNext();) {
@@ -156,6 +156,7 @@
}
}
this.events.clear();
+ this.committing = false;
}
/**
@@ -263,9 +264,9 @@
if (!isModifiable()) {
throw new RuntimeException("Can't enqueue event in unmodifiable session!");
}
- if (committed) {
+ if (committing) {
throw new RuntimeException(
- "No events can be queued after the session has been committed. Event: ["
+ "No events can be queued while the session is being committed. Event: ["
+ event.getDescriptor() + "]");
}
Assert.isTrue("event belongs to session", event.getSession() == this);
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.