Re: transactions
Sunil Goyal <[email protected]>
| Newsgroups | gmane.comp.java.ozone.user |
|---|---|
| Organization | Salzburg Research |
| Message-ID | <[email protected]> |
Hello , I was trying to look through the problem and I have been able to track it down. It is caused by call to self() methods within my code. If I disable the call to self() methods, I don't get that stack overflow problem. May be any pointers in that direction will be helpful. Thanks Sunil On Wed, 03 Mar 2004 10:26:02 +0100, Sunil Goyal <[email protected]> wrote: > Hello all, > > My purpose of giving the previous example by writing transactions was > so that I create some database objects , store the objects(persistent), > close the database and when I open the database again , I am able to > retrieve > the object. > > Now this works fine with the Bus and Auto example, there in the samples > directory. I modified the code of the Client.java to check that. > > But when I try to do the same with my defined classes, I get a stack > overflow. > I can try to give a feel of what my class definitions look like and what > I am trying > to do. > > public interface A extends OzoneRemote{ > // getter setter methods > // additional methods > } > > public abstract class AImpl extends OzoneObject implements A{ > //member variables - HashSet, HashMap , Strings .. > > // methods > } > > > public interface B extends A{ > // getter setter methods > // additional methods > } > > public class BImpl extends AImpl implements B{ > //member variables - HashSet, HashMap , Strings .. > > // methods > } > > Now I am trying to store objects of class B , when I get this problem. > These are the operations I am trying to do now.. > > String dbDir = "D:/test/database"; > LocalDatabase db = new LocalDatabase(); > if(!db.exists(dbDir)) > db.create(dbDir); > > db.open(dbDir); > B b = (B)db.createObject(BImpl.class.getName(),0,"bnode"); > b.setName("B node check"); > > db.close(); > // opening database after closing > // check for the "bnode" > db.open(dbDir); > b = (B)db.objectForName("bnode"); > System.out.println("B instance name "+b.getName()); > db.close(); > > And when I do this , I get this > [java] WARN [main] Transaction - ta[id=5102,blocker=null]: > uncaught exception: (java.lang.StackOverflowError) > [java] java.lang.StackOverflowError > [java] WARN [main] Transaction - ta[id=5102,blocker=null]: > uncaught exception: (java.lang.StackOverflowError) > [java] java.lang.StackOverflowError > [java] java.lang.StackOverflowError > [java] at > org.ozoneDB.ExternalDatabase.sendCommand(ExternalDatabase.java:536) > [java] at > org.ozoneDB.ExternalDatabase.sendCommand(ExternalDatabase.java:490) > [java] at > org.ozoneDB.ExternalDatabase.objectForName(ExternalDatabase.java:760) > > From the stack trace, the error is for a call on > b = (B)db.objectForName("bnode"); > > > Any tips for where the error lies will be helpful. > > Thank You > > Regards > Sunil > > > > On 02 Mar 2004 16:57:49 +0100, Leo Mekenkamp <[email protected]> > wrote: > >> While I think using external transactions is overkill in this situation >> (and use of external transactions should be avoided if not explicitly >> needed, implicit transactions are better and produce better readable >> code), I cannot see any reason why this would go wrong. >> >> Maybe one of the other people on this list? >> >> Cheers, >> Leo > -- ===================================================================== Sunil Goyal New Media Lab Salzburg Research Forschungsgesellschft m.b.H. Jakob Haringer-Strasse 5/III | A-5020 Salzburg T: +43.662.2288-414 | F: +43.662.2288-222 [email protected] http://www.salzburgresearch.at ====================================================================== ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click