I'm using this modified PMF class now and it seems to fix this
problem, with the caveat that I haven't done any heavy load testing
yet.
public final class PMF
{
private static final PersistenceManagerFactory pmfInstance =
JDOHelper.getPersistenceManagerFactory("transactions-
optional");
private PMF()
{
}
public synchronized static PersistenceManagerFactory get()
{
return pmfInstance;
}
public synchronized static PersistenceManager
getPersistenceManagerInstance()
{
return pmfInstance.getPersistenceManager();
}
}
Aaron Shepherd
OnFast.com
On May 13, 11:13 am, Juha K <[email protected]> wrote:
> No, but I have single global instance of PersistenceManagerFactory, and from
> it I call getPersistenceManager() every time I need it.
>
> perjantaina 13. toukokuuta 2011 18.07.22 UTC+3 Ikai L (Google) kirjoitti:
>
>
>
>
>
> > Do you just have a single global instance of persistence manager, or do you
> > use the factory method?
>
> > Ikai Lan
> > Developer Programs Engineer, Google App Engine
> > Blog:http://googleappengine.blogspot.com
> > Twitter:http://twitter.com/app_engine
> > Reddit:http://www.reddit.com/r/appengine
>
> > On Thu, May 12, 2011 at 1:47 AM, Juha K <[email protected]> wrote:
>
> >> I've been running an application successfully for some time on the app
> >> engine. During last week I've couple of times tried enabling threadsafe in
> >> my app. It seems to randomly cause issues with retrieving or storing data
> >> with JDO. What I see when I start to get these issues is this (I've
> >> replaced
> >> my apps class names with ---):
> >> java.lang.UnsupportedOperationException
> >> at
> >> org.datanucleus.store.appengine.EntityUtils.getPropertyName(EntityUtils.jav
> >> a:62)
> >> at
> >> org.datanucleus.store.appengine.DatastoreFieldManager.storeObjectField(Data
> >> storeFieldManager.java:839)
> >> at
> >> org.datanucleus.store.appengine.DatastoreFieldManager.storeStringField(Data
> >> storeFieldManager.java:474)
> >> at
> >> org.datanucleus.state.AbstractStateManager.providedStringField(AbstractStat
> >> eManager.java:1023)
> >> at ---.jdoProvideField(VAJDO.java)
> >> at ---.jdoProvideFields(VAJDO.java)
> >> at
> >> org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl
> >> .java:2715)
> >> at
> >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProces
> >> s(DatastorePersistenceHandler.java:341)
> >> at
> >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(D
> >> atastorePersistenceHandler.java:251)
> >> at
> >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject(Da
> >> tastorePersistenceHandler.java:240)
> >> at
> >> org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(JDOStateMa
> >> nagerImpl.java:3185)
> >> at
> >> org.datanucleus.state.JDOStateManagerImpl.makePersistent(JDOStateManagerImp
> >> l.java:3161)
> >> at
> >> org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.j
> >> ava:1298)
> >> at
> >> org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1175
> >> )
> >> at
> >> org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceM
> >> anager.java:669)
> >> at
> >> org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceMana
> >> ger.java:694)
>
> >> I've seen the same exception also when calling
> >> PersistenceManager.getObjectById(). The call to these methods comes
> >> directly
> >> from servlet requests.
>
> >> The error doesn't always happen, sometimes (especially for writes) when it
> >> starts to happen, it seems to happen to all writes. I've set threadsafe to
> >> false in my appengine-web.xml and the error goes away. But especially now
> >> knowing the upcoming change in the pricing, I'd like to be able to run my
> >> app multithreaded. My question is that is this a bug in the app engine, or
> >> should I be synchronizing JDO use in my app in order to run it with
> >> threadsafe=true?
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Google App Engine for Java" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected].
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-appengine-java?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.