Re: problem with prevayler
Christoph Sturm <[email protected]> Mon, 04 Aug 2003 17:08:06 +0200
| Newsgroups | gmane.comp.java.nanning.devel |
|---|---|
| Message-ID | <[email protected]> |
Ok, I checked it again, and you are correct. The problem is that I have a
testcase that checks if adding the same name twice throws an exception:
it looks like this:
boolean exception = false;
try {
imgDir.add((DirectoryEntry)
ObjectFactory.createDirectory(subdir1));
} catch (RepositoryException e) {
exception = true;
}
assertTrue("Duplicate Name should throw RepositoryException",
exception);
When I run this testcase, the createDirectory method throws an exception (a
RuntimeException, maybe that is the problem), and thus fails. Nevertheless
the method call is serialized, and called again, and I get a stacktrace in
prevayler. I would have expected that the action is not called again when
it throws an exception.
I think there must be some basic thing that I'm missing.
tia
chris
On Mon, 4 Aug 2003 15:43:06 +0100, Jon Tirsen <[email protected]> wrote:
> Yes, but not to the same instance.
> Prevayler maintains two copies of the system in memory for rollback. A
> transaction is first called on the slave system if that fails it will
> automatically restore a new slave from the master. Only if it succeeds on
> the slave it will be executed on the master.
> But it should not be executing it to the same instance. Are you
> accidently
> storing an object in some static field or something?
>
> -----Original Message-----
> From: Christoph Sturm [mailto:[email protected]] Sent: 04
> August 2003 15:39
> To: [email protected]
> Subject: problem with prevayler
>
> Hi Jon!
>
> I have a problem with prevayler: it seems to call every method twice.
>
> look for example at this function:
>
>
> class DirectoryImpl
> {
> Map children;
>
> public void addChild(String name, Object child)
> {
> if (children.contains(name))
> {
> throw new DuplicateEntryException()
> }
> children.put(name, child);
> }
> }
>
> Directory has @entity, and addChild has @transactional. When I try to add
> a child to the directory, the method is called twice with the same
> parameter and throws an exception. What can I do about it? Do all
> methodcalls that are @transactional have to accept being called twice
> with the same parameters?
>
>
> tia
> -chris
>
>
>
>
>
>
>
>
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/