List Info

Thread: XmlContainer.putDocument problem - invokation makes system hang on




XmlContainer.putDocument problem - invokation makes system hang on
user name
2006-06-26 14:01:43
Dariusz,

See below...

> Hi,
>
> I have something like that in my code:
>
>
>                         EnvironmentConfig ec = new
EnvironmentConfig 
> ();
>                         ec.setAllowCreate(true);
>
>                         ec.setInitializeCache(true);
>                         ec.setInitializeLocking(true);
>                         ec.setInitializeLogging(true);
>                         ec.setTransactional(true);
>
>                         XmlManagerConfig mc = new
XmlManagerConfig();
>                         mc.setAllowAutoOpen(true);
>                         mc.setAdoptEnvironment(true);
>
>                         mgr = new XmlManager(env, mc);
>                         mgr.setDefaultContainerType 
> (XmlContainer.WholedocContainer);
>                         trans =
mgr.createTransaction();
>
>                         container = openContainer();
//opens  
> container with
> setTransactional(true)

When opening a container, the safest thing is to
simply pass an XmlContainerConfig with
setTransactional(true), and
*not* pass an explicit transaction.  The reason is that
the transaction used to open a container must be committed
immediately, and not used for further operations.

This means your createTransaction() call above should be
moved
down, after the openContainer().

This may be the source of your problem -- I'm not certain.

>
>                         XmlDocument doc =
> container.getDocument(trans,"foo.xml");
>
>                         (...)
>                         XmlQueryContext lxqc =  
> mgr.createQueryContext();
>
> /* there I prepare some additional xQuery script
against my  
> container called
> 'container' */
>                         (...)
>                         XmlQueryExpression lxqe =
mgr.prepare(lsQuery,
> lxqc);

You should pass trans to prepare().

>                         XmlResults lxr =
lxqe.execute(trans,lxqc);
>                         String con =
"<a>aa</a>";
>                         XmlUpdateContext lxq =  
> mgr.createUpdateContext();
>                         container.putDocument(trans,
"another.xml",  
> con,
> lxq);
>
>
> and execution hangs in the last method
"putDocument" invokation and
> system goes suspended...
>
>
> It's strange that when I comment line with:
> XmlResults lxr = lxqe.execute(trans,lxqc);
> everything goes right and no suspension occurs...
>
>
> Does anybody know what do I wrong in above code that
make my program
> hangs ?

Let me know if changing the container open and
transaction sequence fixes things for you.

Regards,

George




------------------------------------------
To remove yourself from this list, send an
email to xml-unsubscribesleepycat.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )