[appengine-java] Get execution duration of an asynchronous urlfetch

2011-01-29 Thread Fabrizio Accatino
Hello,

I'm playing with async urlfetch. My ispiration was Ikai at
http://ikaisays.com/2010/06/29/using-asynchronous-urlfetch-on-java-app-engine/

I run some request in parallel. All works fine. But now I'd like to get info
about execution time of each request. The target URLs I call are different
so the response time are very different.
I read the documentation but HTTPResponse does not expose a execution
duration or similar value.

Any idea?


Fabrizio

-- 
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: Creation of owned one-to-many problem

2011-01-29 Thread Louis H.
Thank you prabu, that worked :)
I knew it is something silly.

Problem solved.

-- 
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] Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread arturad
In my application an embedded device (no public IP) should connect to
the GAE in order to obtain some data from it. The data are provided by
the web browser.

The whole data-passing process looks like:

  web browser - GAE -
embedded standalone device



I developed a servlet the device connects to. It issues the HTTP GET.
On the other side the web browser sends data using standard GWT
RemoteServiceServlet.


In case there is no data for the device the doGet method in the
servlet should stop for some seconds until user enters data or time
out expires.

I'm trying to use LinkedBlockingQueue  to pass data between two
servlets. It does not work unfortunately. Seems like the GAE launches
new JVM for concurrent requests... I pushed the LinkedBlockingQueue
into memcache and get it by name from concurrent requests. Still does
not work. Memcache returns NOTnull. But there are no data in the
queue.

In order to investigate my issue I've made some tests with the
semaphore. Pushed the semaphore to the memcache and made some
concurrent operations ... - does not work - one process does not
release the other...

The problem occurs on GAE only. The whole mechanism works on the
development server.


Is there any way to stop/freeze one process (in the doGet method in
servlet) and unblock it by another one ?

Or... Is there any other way to solve my problem ?
Thank you for any suggestions.
Artur

-- 
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: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Didier Durand
Hi,

LinkedBlokingQueue is part of JRE WhiteList:
http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
can use it.

But, I dont see the need. Why don't you just from on the datastore on
1 side and read from it on the other. It would be very simple and rely
on the most basic (i.e solid) mechanism of gae. (I would recommend
Objectify for ds read/ write)

As you have network round-trips, the read / write time will be
negligible even it can seem high compared to an in-memory mechanism
like a Queue.

regards

didier

On Jan 29, 1:51 pm, arturad artur.dow...@googlemail.com wrote:
 In my application an embedded device (no public IP) should connect to
 the GAE in order to obtain some data from it. The data are provided by
 the web browser.

 The whole data-passing process looks like:

                                               web browser - GAE -
 embedded standalone device

 I developed a servlet the device connects to. It issues the HTTP GET.
 On the other side the web browser sends data using standard GWT
 RemoteServiceServlet.

 In case there is no data for the device the doGet method in the
 servlet should stop for some seconds until user enters data or time
 out expires.

 I'm trying to use LinkedBlockingQueue  to pass data between two
 servlets. It does not work unfortunately. Seems like the GAE launches
 new JVM for concurrent requests... I pushed the LinkedBlockingQueue
 into memcache and get it by name from concurrent requests. Still does
 not work. Memcache returns NOTnull. But there are no data in the
 queue.

 In order to investigate my issue I've made some tests with the
 semaphore. Pushed the semaphore to the memcache and made some
 concurrent operations ... - does not work - one process does not
 release the other...

 The problem occurs on GAE only. The whole mechanism works on the
 development server.

 Is there any way to stop/freeze one process (in the doGet method in
 servlet) and unblock it by another one ?

 Or... Is there any other way to solve my problem ?
 Thank you for any suggestions.
 Artur

-- 
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: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Didier Durand
Hi,

Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
part of the JRE)

regards

didier

On Jan 29, 3:35 pm, Didier Durand durand.did...@gmail.com wrote:
 Hi,

 LinkedBlokingQueue is part of JRE 
 WhiteList:http://code.google.com/appengine/docs/java/jrewhitelist.html. So, 
 you
 can use it.

 But, I dont see the need. Why don't you just from on the datastore on
 1 side and read from it on the other. It would be very simple and rely
 on the most basic (i.e solid) mechanism of gae. (I would recommend
 Objectify for ds read/ write)

 As you have network round-trips, the read / write time will be
 negligible even it can seem high compared to an in-memory mechanism
 like a Queue.

 regards

 didier

 On Jan 29, 1:51 pm, arturad artur.dow...@googlemail.com wrote:

  In my application an embedded device (no public IP) should connect to
  the GAE in order to obtain some data from it. The data are provided by
  the web browser.

  The whole data-passing process looks like:

                                                web browser - GAE -
  embedded standalone device

  I developed a servlet the device connects to. It issues the HTTP GET.
  On the other side the web browser sends data using standard GWT
  RemoteServiceServlet.

  In case there is no data for the device the doGet method in the
  servlet should stop for some seconds until user enters data or time
  out expires.

  I'm trying to use LinkedBlockingQueue  to pass data between two
  servlets. It does not work unfortunately. Seems like the GAE launches
  new JVM for concurrent requests... I pushed the LinkedBlockingQueue
  into memcache and get it by name from concurrent requests. Still does
  not work. Memcache returns NOTnull. But there are no data in the
  queue.

  In order to investigate my issue I've made some tests with the
  semaphore. Pushed the semaphore to the memcache and made some
  concurrent operations ... - does not work - one process does not
  release the other...

  The problem occurs on GAE only. The whole mechanism works on the
  development server.

  Is there any way to stop/freeze one process (in the doGet method in
  servlet) and unblock it by another one ?

  Or... Is there any other way to solve my problem ?
  Thank you for any suggestions.
  Artur



-- 
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: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Artur Downar
The external device polls for data from GAE.
It is not specified when the data arrives. To describe it more clearly. The
device is a GSM modem device that sends an SMS on the user request.

The user launches a web browser and writes a mobile phone number. The
browser sends data to the GAE and the sms should be send immediately

So I cannot specify how long I can wait in Thread.sleep().



You mention about Objectify. I use that library but I'm quite new to it.

 Does it have the mechanism that works like:

 process A waits for data until data into database arrives or timeout
expires
 process B puts the data into database
 process a continues processing the data inserted by process B

?






On Sat, Jan 29, 2011 at 3:59 PM, Didier Durand durand.did...@gmail.comwrote:

 Hi,

 Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
 part of the JRE)

 regards

 didier

 On Jan 29, 3:35 pm, Didier Durand durand.did...@gmail.com wrote:
  Hi,
 
  LinkedBlokingQueue is part of JRE WhiteList:
 http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
  can use it.
 
  But, I dont see the need. Why don't you just from on the datastore on
  1 side and read from it on the other. It would be very simple and rely
  on the most basic (i.e solid) mechanism of gae. (I would recommend
  Objectify for ds read/ write)
 
  As you have network round-trips, the read / write time will be
  negligible even it can seem high compared to an in-memory mechanism
  like a Queue.
 
  regards
 
  didier
 
  On Jan 29, 1:51 pm, arturad artur.dow...@googlemail.com wrote:
 
   In my application an embedded device (no public IP) should connect to
   the GAE in order to obtain some data from it. The data are provided by
   the web browser.
 
   The whole data-passing process looks like:
 
 web browser - GAE -
   embedded standalone device
 
   I developed a servlet the device connects to. It issues the HTTP GET.
   On the other side the web browser sends data using standard GWT
   RemoteServiceServlet.
 
   In case there is no data for the device the doGet method in the
   servlet should stop for some seconds until user enters data or time
   out expires.
 
   I'm trying to use LinkedBlockingQueue  to pass data between two
   servlets. It does not work unfortunately. Seems like the GAE launches
   new JVM for concurrent requests... I pushed the LinkedBlockingQueue
   into memcache and get it by name from concurrent requests. Still does
   not work. Memcache returns NOTnull. But there are no data in the
   queue.
 
   In order to investigate my issue I've made some tests with the
   semaphore. Pushed the semaphore to the memcache and made some
   concurrent operations ... - does not work - one process does not
   release the other...
 
   The problem occurs on GAE only. The whole mechanism works on the
   development server.
 
   Is there any way to stop/freeze one process (in the doGet method in
   servlet) and unblock it by another one ?
 
   Or... Is there any other way to solve my problem ?
   Thank you for any suggestions.
   Artur
 
 

 --
 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.comgoogle-appengine-java%2bunsubscr...@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.



Re: [appengine-java] Re: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Stephen Johnson
Sounds like you need more of a Push style. Checkout the Channel API or the
XMPP api.

On Sat, Jan 29, 2011 at 1:47 PM, Artur Downar
artur.dow...@googlemail.comwrote:

 The external device polls for data from GAE.
 It is not specified when the data arrives. To describe it more clearly. The
 device is a GSM modem device that sends an SMS on the user request.

 The user launches a web browser and writes a mobile phone number. The
 browser sends data to the GAE and the sms should be send immediately

 So I cannot specify how long I can wait in Thread.sleep().



 You mention about Objectify. I use that library but I'm quite new to it.

  Does it have the mechanism that works like:

  process A waits for data until data into database arrives or timeout
 expires
  process B puts the data into database
  process a continues processing the data inserted by process B

 ?







 On Sat, Jan 29, 2011 at 3:59 PM, Didier Durand durand.did...@gmail.comwrote:

 Hi,

 Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
 part of the JRE)

 regards

 didier

 On Jan 29, 3:35 pm, Didier Durand durand.did...@gmail.com wrote:
  Hi,
 
  LinkedBlokingQueue is part of JRE WhiteList:
 http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
  can use it.
 
  But, I dont see the need. Why don't you just from on the datastore on
  1 side and read from it on the other. It would be very simple and rely
  on the most basic (i.e solid) mechanism of gae. (I would recommend
  Objectify for ds read/ write)
 
  As you have network round-trips, the read / write time will be
  negligible even it can seem high compared to an in-memory mechanism
  like a Queue.
 
  regards
 
  didier
 
  On Jan 29, 1:51 pm, arturad artur.dow...@googlemail.com wrote:
 
   In my application an embedded device (no public IP) should connect to
   the GAE in order to obtain some data from it. The data are provided by
   the web browser.
 
   The whole data-passing process looks like:
 
 web browser - GAE -
   embedded standalone device
 
   I developed a servlet the device connects to. It issues the HTTP GET.
   On the other side the web browser sends data using standard GWT
   RemoteServiceServlet.
 
   In case there is no data for the device the doGet method in the
   servlet should stop for some seconds until user enters data or time
   out expires.
 
   I'm trying to use LinkedBlockingQueue  to pass data between two
   servlets. It does not work unfortunately. Seems like the GAE launches
   new JVM for concurrent requests... I pushed the LinkedBlockingQueue
   into memcache and get it by name from concurrent requests. Still does
   not work. Memcache returns NOTnull. But there are no data in the
   queue.
 
   In order to investigate my issue I've made some tests with the
   semaphore. Pushed the semaphore to the memcache and made some
   concurrent operations ... - does not work - one process does not
   release the other...
 
   The problem occurs on GAE only. The whole mechanism works on the
   development server.
 
   Is there any way to stop/freeze one process (in the doGet method in
   servlet) and unblock it by another one ?
 
   Or... Is there any other way to solve my problem ?
   Thank you for any suggestions.
   Artur
 
 

 --
 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.comgoogle-appengine-java%2bunsubscr...@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.comgoogle-appengine-java%2bunsubscr...@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.



Re: [appengine-java] Re: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Artur Downar
I forgot to ask something:

You said that the LinkedBlokingQueue is on the whitelist and should work on
GAE.
What is the way to pass the object betwean the JVMs/processes ?
I use the memcache and it does not solve my problem.


Cache cache;
try {
cache =
CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());


Semaphore toModemSem = (Semaphore)cache.get(toModemSem);
if (toModemSem == null) {
log.info(memcache returns null);
toModemSem = new Semaphore(0);
cache.put(toModemSem, toModemSem);
}



toModemSem.release();
...

Sorry my example is about the Semaphore. But I do the same with
LinkedBlokingQueue the queue. And both does not work.

Do I use the memcache correctly ?


On Sat, Jan 29, 2011 at 9:47 PM, Artur Downar
artur.dow...@googlemail.comwrote:

 The external device polls for data from GAE.
 It is not specified when the data arrives. To describe it more clearly. The
 device is a GSM modem device that sends an SMS on the user request.

 The user launches a web browser and writes a mobile phone number. The
 browser sends data to the GAE and the sms should be send immediately

 So I cannot specify how long I can wait in Thread.sleep().



 You mention about Objectify. I use that library but I'm quite new to it.

  Does it have the mechanism that works like:

  process A waits for data until data into database arrives or timeout
 expires
  process B puts the data into database
  process a continues processing the data inserted by process B

 ?







 On Sat, Jan 29, 2011 at 3:59 PM, Didier Durand durand.did...@gmail.comwrote:

 Hi,

 Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
 part of the JRE)

 regards

 didier

 On Jan 29, 3:35 pm, Didier Durand durand.did...@gmail.com wrote:
  Hi,
 
  LinkedBlokingQueue is part of JRE WhiteList:
 http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
  can use it.
 
  But, I dont see the need. Why don't you just from on the datastore on
  1 side and read from it on the other. It would be very simple and rely
  on the most basic (i.e solid) mechanism of gae. (I would recommend
  Objectify for ds read/ write)
 
  As you have network round-trips, the read / write time will be
  negligible even it can seem high compared to an in-memory mechanism
  like a Queue.
 
  regards
 
  didier
 
  On Jan 29, 1:51 pm, arturad artur.dow...@googlemail.com wrote:
 
   In my application an embedded device (no public IP) should connect to
   the GAE in order to obtain some data from it. The data are provided by
   the web browser.
 
   The whole data-passing process looks like:
 
 web browser - GAE -
   embedded standalone device
 
   I developed a servlet the device connects to. It issues the HTTP GET.
   On the other side the web browser sends data using standard GWT
   RemoteServiceServlet.
 
   In case there is no data for the device the doGet method in the
   servlet should stop for some seconds until user enters data or time
   out expires.
 
   I'm trying to use LinkedBlockingQueue  to pass data between two
   servlets. It does not work unfortunately. Seems like the GAE launches
   new JVM for concurrent requests... I pushed the LinkedBlockingQueue
   into memcache and get it by name from concurrent requests. Still does
   not work. Memcache returns NOTnull. But there are no data in the
   queue.
 
   In order to investigate my issue I've made some tests with the
   semaphore. Pushed the semaphore to the memcache and made some
   concurrent operations ... - does not work - one process does not
   release the other...
 
   The problem occurs on GAE only. The whole mechanism works on the
   development server.
 
   Is there any way to stop/freeze one process (in the doGet method in
   servlet) and unblock it by another one ?
 
   Or... Is there any other way to solve my problem ?
   Thank you for any suggestions.
   Artur
 
 

 --
 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.comgoogle-appengine-java%2bunsubscr...@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.



Re: [appengine-java] Re: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Artur Downar
Thank you.

I took a brief look on channel API and it seems I it is the thing I need.

I have a small question.

The modem device is a java embedded device and it has no public IP. There is
no javascript on it. Only java.

Is it enough for GAE channel API to communicate with it ?







On Sat, Jan 29, 2011 at 9:49 PM, Stephen Johnson onepagewo...@gmail.comwrote:

 Sounds like you need more of a Push style. Checkout the Channel API or the
 XMPP api.




 On Sat, Jan 29, 2011 at 1:47 PM, Artur Downar artur.dow...@googlemail.com
  wrote:

 The external device polls for data from GAE.
 It is not specified when the data arrives. To describe it more clearly.
 The device is a GSM modem device that sends an SMS on the user request.

 The user launches a web browser and writes a mobile phone number. The
 browser sends data to the GAE and the sms should be send immediately

 So I cannot specify how long I can wait in Thread.sleep().



 You mention about Objectify. I use that library but I'm quite new to it.

  Does it have the mechanism that works like:

  process A waits for data until data into database arrives or timeout
 expires
  process B puts the data into database
  process a continues processing the data inserted by process B

 ?







 On Sat, Jan 29, 2011 at 3:59 PM, Didier Durand 
 durand.did...@gmail.comwrote:

 Hi,

 Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
 part of the JRE)

 regards

 didier

 On Jan 29, 3:35 pm, Didier Durand durand.did...@gmail.com wrote:
  Hi,
 
  LinkedBlokingQueue is part of JRE WhiteList:
 http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
  can use it.
 
  But, I dont see the need. Why don't you just from on the datastore on
  1 side and read from it on the other. It would be very simple and rely
  on the most basic (i.e solid) mechanism of gae. (I would recommend
  Objectify for ds read/ write)
 
  As you have network round-trips, the read / write time will be
  negligible even it can seem high compared to an in-memory mechanism
  like a Queue.
 
  regards
 
  didier
 
  On Jan 29, 1:51 pm, arturad artur.dow...@googlemail.com wrote:
 
   In my application an embedded device (no public IP) should connect to
   the GAE in order to obtain some data from it. The data are provided
 by
   the web browser.
 
   The whole data-passing process looks like:
 
 web browser - GAE -
   embedded standalone device
 
   I developed a servlet the device connects to. It issues the HTTP GET.
   On the other side the web browser sends data using standard GWT
   RemoteServiceServlet.
 
   In case there is no data for the device the doGet method in the
   servlet should stop for some seconds until user enters data or time
   out expires.
 
   I'm trying to use LinkedBlockingQueue  to pass data between two
   servlets. It does not work unfortunately. Seems like the GAE launches
   new JVM for concurrent requests... I pushed the LinkedBlockingQueue
   into memcache and get it by name from concurrent requests. Still does
   not work. Memcache returns NOTnull. But there are no data in the
   queue.
 
   In order to investigate my issue I've made some tests with the
   semaphore. Pushed the semaphore to the memcache and made some
   concurrent operations ... - does not work - one process does not
   release the other...
 
   The problem occurs on GAE only. The whole mechanism works on the
   development server.
 
   Is there any way to stop/freeze one process (in the doGet method in
   servlet) and unblock it by another one ?
 
   Or... Is there any other way to solve my problem ?
   Thank you for any suggestions.
   Artur
 
 

 --
 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.comgoogle-appengine-java%2bunsubscr...@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.comgoogle-appengine-java%2bunsubscr...@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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 

Re: [appengine-java] Re: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Stephen Johnson
At the moment the Channel API is javascript only. There are a lot of people
that would like it to be open to other languages for things just like you
want to do. You might be able to use something like Rhino to run the
javascript in Java but not sure if that will work. You should take a look at
XMPP, it's very simple to have the server send instant messages. I did a
quick search for XMPP libraries in Java and here is one I found. I'm sure
there are many others. Check out
http://twit88.com/blog/2009/02/17/java-xmpp-client-library/
On Sat, Jan 29, 2011 at 2:07 PM, Artur Downar
artur.dow...@googlemail.comwrote:

 Thank you.

 I took a brief look on channel API and it seems I it is the thing I need.

 I have a small question.

 The modem device is a java embedded device and it has no public IP. There
 is no javascript on it. Only java.

 Is it enough for GAE channel API to communicate with it ?







   On Sat, Jan 29, 2011 at 9:49 PM, Stephen Johnson onepagewo...@gmail.com
  wrote:

 Sounds like you need more of a Push style. Checkout the Channel API or the
 XMPP api.




On Sat, Jan 29, 2011 at 1:47 PM, Artur Downar 
 artur.dow...@googlemail.com wrote:

  The external device polls for data from GAE.
 It is not specified when the data arrives. To describe it more clearly.
 The device is a GSM modem device that sends an SMS on the user request.

 The user launches a web browser and writes a mobile phone number. The
 browser sends data to the GAE and the sms should be send immediately

 So I cannot specify how long I can wait in Thread.sleep().



 You mention about Objectify. I use that library but I'm quite new to it.

  Does it have the mechanism that works like:

  process A waits for data until data into database arrives or timeout
 expires
  process B puts the data into database
  process a continues processing the data inserted by process B

 ?







 On Sat, Jan 29, 2011 at 3:59 PM, Didier Durand 
 durand.did...@gmail.comwrote:

 Hi,

 Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
 part of the JRE)

 regards

 didier

 On Jan 29, 3:35 pm, Didier Durand durand.did...@gmail.com wrote:
  Hi,
 
  LinkedBlokingQueue is part of JRE WhiteList:
 http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
  can use it.
 
  But, I dont see the need. Why don't you just from on the datastore on
  1 side and read from it on the other. It would be very simple and rely
  on the most basic (i.e solid) mechanism of gae. (I would recommend
  Objectify for ds read/ write)
 
  As you have network round-trips, the read / write time will be
  negligible even it can seem high compared to an in-memory mechanism
  like a Queue.
 
  regards
 
  didier
 
  On Jan 29, 1:51 pm, arturad artur.dow...@googlemail.com wrote:
 
   In my application an embedded device (no public IP) should connect
 to
   the GAE in order to obtain some data from it. The data are provided
 by
   the web browser.
 
   The whole data-passing process looks like:
 
 web browser - GAE -
   embedded standalone device
 
   I developed a servlet the device connects to. It issues the HTTP
 GET.
   On the other side the web browser sends data using standard GWT
   RemoteServiceServlet.
 
   In case there is no data for the device the doGet method in the
   servlet should stop for some seconds until user enters data or time
   out expires.
 
   I'm trying to use LinkedBlockingQueue  to pass data between two
   servlets. It does not work unfortunately. Seems like the GAE
 launches
   new JVM for concurrent requests... I pushed the LinkedBlockingQueue
   into memcache and get it by name from concurrent requests. Still
 does
   not work. Memcache returns NOTnull. But there are no data in the
   queue.
 
   In order to investigate my issue I've made some tests with the
   semaphore. Pushed the semaphore to the memcache and made some
   concurrent operations ... - does not work - one process does not
   release the other...
 
   The problem occurs on GAE only. The whole mechanism works on the
   development server.
 
   Is there any way to stop/freeze one process (in the doGet method in
   servlet) and unblock it by another one ?
 
   Or... Is there any other way to solve my problem ?
   Thank you for any suggestions.
   Artur
 
 

 --
 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.comgoogle-appengine-java%2bunsubscr...@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 

[appengine-java] pass parameters through login service

2011-01-29 Thread WillSpecht
I recently made it so most of my pages require a user to be logged in
to view.  The only problem I'm having is, if a user tries to come
directly from a link

myapp.appspot.com/page.jsp?pageId=aoSCuanjFAVoasDmNlkadf

they are asked to login, then forwarded to myapp.appspot.com/page.jsp

How do I make it so they are forwarded to myapp.appspot.com/page.jsp?
pageId=aoSCuanjFAVoasDmNlkadf

Is this possible?

Should I not be showing users addresses like myapp.appspot.com/
page.jsp?pageId=aoSCuanjFAVoasDmNlkadf

-- 
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] pass parameters through login service

2011-01-29 Thread Ben Carlson
You should pick up any parameters passed to the page, send them to the login 
page, and then use that as the successURL for a successful login.

-Ben

Sent from my iPhone

On Jan 29, 2011, at 5:06 PM, WillSpecht willspe...@gmail.com wrote:

 I recently made it so most of my pages require a user to be logged in
 to view.  The only problem I'm having is, if a user tries to come
 directly from a link
 
 myapp.appspot.com/page.jsp?pageId=aoSCuanjFAVoasDmNlkadf
 
 they are asked to login, then forwarded to myapp.appspot.com/page.jsp
 
 How do I make it so they are forwarded to myapp.appspot.com/page.jsp?
 pageId=aoSCuanjFAVoasDmNlkadf
 
 Is this possible?
 
 Should I not be showing users addresses like myapp.appspot.com/
 page.jsp?pageId=aoSCuanjFAVoasDmNlkadf
 
 -- 
 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: pass parameters through login service

2011-01-29 Thread WillSpecht
I am using the Google authorization services with security-
constraint.  How do I specify the successURL.  It seems to
automatically pass the URL the user was trying to access before
needing to log in, only it cuts off all the parameters.  Do I need a
filter of some kind that is run before each request and saves
parameters?

On Jan 29, 6:38 pm, Ben Carlson bencarl...@gmail.com wrote:
 You should pick up any parameters passed to the page, send them to the login 
 page, and then use that as the successURL for a successful login.

 -Ben

 Sent from my iPhone

 On Jan 29, 2011, at 5:06 PM, WillSpecht willspe...@gmail.com wrote:

  I recently made it so most of my pages require a user to be logged in
  to view.  The only problem I'm having is, if a user tries to come
  directly from a link

  myapp.appspot.com/page.jsp?pageId=aoSCuanjFAVoasDmNlkadf

  they are asked to login, then forwarded to myapp.appspot.com/page.jsp

  How do I make it so they are forwarded to myapp.appspot.com/page.jsp?
  pageId=aoSCuanjFAVoasDmNlkadf

  Is this possible?

  Should I not be showing users addresses like myapp.appspot.com/
  page.jsp?pageId=aoSCuanjFAVoasDmNlkadf

  --
  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 
  athttp://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: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Didier Durand
Hi,

To answer your questions:

a) yes, you can say how long you waits Thread.sleep(millis) where
millis says how many milliseconds you want to wait

b) why don't you do something like this

do {
read new data from ds;

}

On Jan 29, 10:38 pm, Stephen Johnson onepagewo...@gmail.com wrote:
 At the moment the Channel API is javascript only. There are a lot of people
 that would like it to be open to other languages for things just like you
 want to do. You might be able to use something like Rhino to run the
 javascript in Java but not sure if that will work. You should take a look at
 XMPP, it's very simple to have the server send instant messages. I did a
 quick search for XMPP libraries in Java and here is one I found. I'm sure
 there are many others. Check 
 outhttp://twit88.com/blog/2009/02/17/java-xmpp-client-library/
 On Sat, Jan 29, 2011 at 2:07 PM, Artur Downar
 artur.dow...@googlemail.comwrote:

  Thank you.

  I took a brief look on channel API and it seems I it is the thing I need.

  I have a small question.

  The modem device is a java embedded device and it has no public IP. There
  is no javascript on it. Only java.

  Is it enough for GAE channel API to communicate with it ?

    On Sat, Jan 29, 2011 at 9:49 PM, Stephen Johnson onepagewo...@gmail.com
   wrote:

  Sounds like you need more of a Push style. Checkout the Channel API or the
  XMPP api.

     On Sat, Jan 29, 2011 at 1:47 PM, Artur Downar 
  artur.dow...@googlemail.com wrote:

   The external device polls for data from GAE.
  It is not specified when the data arrives. To describe it more clearly.
  The device is a GSM modem device that sends an SMS on the user request.

  The user launches a web browser and writes a mobile phone number. The
  browser sends data to the GAE and the sms should be send immediately

  So I cannot specify how long I can wait in Thread.sleep().

  You mention about Objectify. I use that library but I'm quite new to it.

   Does it have the mechanism that works like:

   process A waits for data until data into database arrives or timeout
  expires
   process B puts the data into database
   process a continues processing the data inserted by process B

  ?

  On Sat, Jan 29, 2011 at 3:59 PM, Didier Durand 
  durand.did...@gmail.comwrote:

  Hi,

  Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
  part of the JRE)

  regards

  didier

  On Jan 29, 3:35 pm, Didier Durand durand.did...@gmail.com wrote:
   Hi,

   LinkedBlokingQueue is part of JRE WhiteList:
 http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
   can use it.

   But, I dont see the need. Why don't you just from on the datastore on
   1 side and read from it on the other. It would be very simple and rely
   on the most basic (i.e solid) mechanism of gae. (I would recommend
   Objectify for ds read/ write)

   As you have network round-trips, the read / write time will be
   negligible even it can seem high compared to an in-memory mechanism
   like a Queue.

   regards

   didier

   On Jan 29, 1:51 pm, arturad artur.dow...@googlemail.com wrote:

In my application an embedded device (no public IP) should connect
  to
the GAE in order to obtain some data from it. The data are provided
  by
the web browser.

The whole data-passing process looks like:

                                              web browser - GAE -
embedded standalone device

I developed a servlet the device connects to. It issues the HTTP
  GET.
On the other side the web browser sends data using standard GWT
RemoteServiceServlet.

In case there is no data for the device the doGet method in the
servlet should stop for some seconds until user enters data or time
out expires.

I'm trying to use LinkedBlockingQueue  to pass data between two
servlets. It does not work unfortunately. Seems like the GAE
  launches
new JVM for concurrent requests... I pushed the LinkedBlockingQueue
into memcache and get it by name from concurrent requests. Still
  does
not work. Memcache returns NOTnull. But there are no data in the
queue.

In order to investigate my issue I've made some tests with the
semaphore. Pushed the semaphore to the memcache and made some
concurrent operations ... - does not work - one process does not
release the other...

The problem occurs on GAE only. The whole mechanism works on the
development server.

Is there any way to stop/freeze one process (in the doGet method in
servlet) and unblock it by another one ?

Or... Is there any other way to solve my problem ?
Thank you for any suggestions.
Artur

  --
  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
  

[appengine-java] Re: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Didier Durand
Sorry,

hit send too quicly

b) why don't you do something like this

Side reading data:
==

do {
read new data from ds;
if (new data) {
 mark data as read in ds
do what you need
return;
} else {
  Thread.sleep(100)
}
} until (running time near 30s)
if (no new data) {
give error message to waiting user
}

Side writing data
==

write new data to datastore (with corresponding status showing that
it's new and not read yet)


N.B: the 30s is a hard limit imposed by gae. You've to check for it
and end gracefully else your servlet will be killed by GAE.

regards

didier

On Jan 30, 8:15 am, Didier Durand durand.did...@gmail.com wrote:
 Hi,

 To answer your questions:

 a) yes, you can say how long you waits Thread.sleep(millis) where
 millis says how many milliseconds you want to wait

 b) why don't you do something like this

 do {
     read new data from ds;

 }

 On Jan 29, 10:38 pm, Stephen Johnson onepagewo...@gmail.com wrote:

  At the moment the Channel API is javascript only. There are a lot of people
  that would like it to be open to other languages for things just like you
  want to do. You might be able to use something like Rhino to run the
  javascript in Java but not sure if that will work. You should take a look at
  XMPP, it's very simple to have the server send instant messages. I did a
  quick search for XMPP libraries in Java and here is one I found. I'm sure
  there are many others. Check 
  outhttp://twit88.com/blog/2009/02/17/java-xmpp-client-library/
  On Sat, Jan 29, 2011 at 2:07 PM, Artur Downar
  artur.dow...@googlemail.comwrote:

   Thank you.

   I took a brief look on channel API and it seems I it is the thing I need.

   I have a small question.

   The modem device is a java embedded device and it has no public IP. There
   is no javascript on it. Only java.

   Is it enough for GAE channel API to communicate with it ?

     On Sat, Jan 29, 2011 at 9:49 PM, Stephen Johnson onepagewo...@gmail.com
wrote:

   Sounds like you need more of a Push style. Checkout the Channel API or 
   the
   XMPP api.

      On Sat, Jan 29, 2011 at 1:47 PM, Artur Downar 
   artur.dow...@googlemail.com wrote:

    The external device polls for data from GAE.
   It is not specified when the data arrives. To describe it more clearly.
   The device is a GSM modem device that sends an SMS on the user request.

   The user launches a web browser and writes a mobile phone number. The
   browser sends data to the GAE and the sms should be send immediately

   So I cannot specify how long I can wait in Thread.sleep().

   You mention about Objectify. I use that library but I'm quite new to it.

    Does it have the mechanism that works like:

    process A waits for data until data into database arrives or timeout
   expires
    process B puts the data into database
    process a continues processing the data inserted by process B

   ?

   On Sat, Jan 29, 2011 at 3:59 PM, Didier Durand 
   durand.did...@gmail.comwrote:

   Hi,

   Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
   part of the JRE)

   regards

   didier

   On Jan 29, 3:35 pm, Didier Durand durand.did...@gmail.com wrote:
Hi,

LinkedBlokingQueue is part of JRE WhiteList:
  http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
can use it.

But, I dont see the need. Why don't you just from on the datastore on
1 side and read from it on the other. It would be very simple and 
rely
on the most basic (i.e solid) mechanism of gae. (I would recommend
Objectify for ds read/ write)

As you have network round-trips, the read / write time will be
negligible even it can seem high compared to an in-memory mechanism
like a Queue.

regards

didier

On Jan 29, 1:51 pm, arturad artur.dow...@googlemail.com wrote:

 In my application an embedded device (no public IP) should connect
   to
 the GAE in order to obtain some data from it. The data are provided
   by
 the web browser.

 The whole data-passing process looks like:

                                               web browser - GAE -
 embedded standalone device

 I developed a servlet the device connects to. It issues the HTTP
   GET.
 On the other side the web browser sends data using standard GWT
 RemoteServiceServlet.

 In case there is no data for the device the doGet method in the
 servlet should stop for some seconds until user enters data or time
 out expires.

 I'm trying to use LinkedBlockingQueue  to pass data between two
 servlets. It does not work unfortunately. Seems like the GAE
   launches
 new JVM for concurrent requests... I pushed the LinkedBlockingQueue
 into memcache and get it by name from concurrent requests. Still
   does
 not work. Memcache returns NOTnull. But there are no data in the
 queue.

 In order to investigate my issue I've 

[appengine-java] Re: Get execution duration of an asynchronous urlfetch

2011-01-29 Thread Didier Durand
Hi,

You're right: async url fetch doesn't seem to provide any way to
measure fetch time.

Then, I have a proposal: why don't you schedule a task per fetch, this
task will then do a regular synchronous url fetch for which measuring
will be easy.

So, your original servlet / task will schedule as many tasks as you
have fetches and wait via a loop of Thread.sleep() until all fetches
are done and their results (incl fetch time) written somewhere
(datastore / memcache) that the original servlet / task can access to
complete the work.

The only question though: can the application afford to launch those
tasks as they will incurr some overhead : some tenths of milliseconds
of cpu to schedule a task and run it + cpu time to write result to
cacche or ds in order to be shareable with originator.

If not acceptable, I hope it will at least give you some other ideas
to follow

regards

didier

On Jan 29, 9:50 am, Fabrizio Accatino fht...@gmail.com wrote:
 Hello,

 I'm playing with async urlfetch. My ispiration was Ikai 
 athttp://ikaisays.com/2010/06/29/using-asynchronous-urlfetch-on-java-ap...

 I run some request in parallel. All works fine. But now I'd like to get info
 about execution time of each request. The target URLs I call are different
 so the response time are very different.
 I read the documentation but HTTPResponse does not expose a execution
 duration or similar value.

 Any idea?

 Fabrizio

-- 
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.