Re: [appengine-java] Re: GAE implementation of java.util.concurrent....

2011-03-31 Thread dilbert
Thank you Don for sharing valuable information.

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Re: GAE implementation of java.util.concurrent....

2011-03-31 Thread Don Schwarz
I believe that we follow the servlet spec here -- concurrent requests will
share the same instance of the servlet.

We may or may not support the SingleThreadModel interface, but it is
deprecated in Servlet 2.5 so I would strongly suggest doing your own
synchronization rather than depending on it.

On Thu, Mar 31, 2011 at 11:55 AM, dilbert  wrote:

> Thanks Don for the quick answer. I was also wandering about the GAE servlet
> container implementation. If two requests arrive to the same JVM instance
> will they be processed by the same servlet (object) or will the runtime
> spawn two servlet objects? This is important because in the first case I
> need to secure the servlet's member variables.
>
> Thank You for your time.
>
>  --
> 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
> google-appengine-java@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> 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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: GAE implementation of java.util.concurrent....

2011-03-31 Thread dilbert
I do not think You are wrong. However, sometimes You do not need 
application-wide but instance-wide locking. For example let's assume this:

class SomeClass{
  static SomeObject someObject = null;
  SomeObject getSomeObject(){
if(someObject == null){
  //Long Initialization
  someObject = ...;
}
return someObject;
  }
}
If the initialization is long it is possible that many threads will enter 
the if(someObject == null) block. I'd like to avoid that. After all long 
processing can cost me money.

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Re: GAE implementation of java.util.concurrent....

2011-03-31 Thread dilbert
Thanks Don for the quick answer. I was also wandering about the GAE servlet 
container implementation. If two requests arrive to the same JVM instance 
will they be processed by the same servlet (object) or will the runtime 
spawn two servlet objects? This is important because in the first case I 
need to secure the servlet's member variables.

Thank You for your time.

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Re: GAE implementation of java.util.concurrent....

2011-03-31 Thread Don Schwarz
All of the atomic and locking primitives and data structures should work
normally.

The thread-related classes (e.g. ExecutorService) will not work because you
are still not allowed to do your own thread creation/manipulation.

On Thu, Mar 31, 2011 at 6:28 AM, Thomas Visser wrote:

> The GAE SDK uses java.util.concurrent classes internally so I guess
> they do work. However, I've never used them because when I need
> locking, it should be application-wide. With java.util.concurrent you
> can only achieve locking within an instance. Or am I wrong here?
>
> On Mar 31, 12:55 pm, dilbert  wrote:
> > I see that the java.util.concurrent... classes are on the whitelist (
> http://code.google.com/intl/hr/appengine/docs/java/jrewhitelist.html). Are
> > they implemented properly or as empty (do nothing) implementations. With
> the
> > new *Concurrent Requests* feature I might need some locking classes.
> >
> > Thanks for Your time.
>
> --
> 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
> google-appengine-java@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> 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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: GAE implementation of java.util.concurrent....

2011-03-31 Thread Thomas Visser
The GAE SDK uses java.util.concurrent classes internally so I guess
they do work. However, I've never used them because when I need
locking, it should be application-wide. With java.util.concurrent you
can only achieve locking within an instance. Or am I wrong here?

On Mar 31, 12:55 pm, dilbert  wrote:
> I see that the java.util.concurrent... classes are on the whitelist 
> (http://code.google.com/intl/hr/appengine/docs/java/jrewhitelist.html). Are
> they implemented properly or as empty (do nothing) implementations. With the
> new *Concurrent Requests* feature I might need some locking classes.
>
> Thanks for Your time.

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.