[appengine-java] Re: Pay to Reserve JVM

2009-12-01 Thread ted stockwell

The fact that the feature is called 'Pay to reserve a JVM' is
interesting.
Does it mean that each application runs in it's own JVM?


On Nov 30, 4:57 pm, Jeffrey Goetsch  wrote:
> There is a feature request to allow you to Pay to Reserve a JVM.  They are
> wanting to see if people would be willing to pay, and how much they are will
> to pay.
>
> If you are interested in this feature, please vote on the ticket and comment
> how much you are willing to pay.
>
> http://code.google.com/p/googleappengine/issues/detail?id=2456#makech...
>
> Thanks,
> Jeffrey

--

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-j...@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: Why is it called "Google App Engine for Java" ?

2009-11-28 Thread ted stockwell

Actually, many people had the same reaction when GAE/J was released.
See for instance, 
http://weblogs.java.net/blog/2009/04/16/google-app-engine-java-sucks

Without a doubt if some smaller player created such an incompatible
implementation they would not be allowed to call it 'Java'.

On Nov 27, 7:19 pm, Diana Cruise  wrote:
As far
> as the naming goes, you may be the first to raise this concern in
> GAE's existence (2 years or so).
>

--

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-j...@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: Why is it called "Google App Engine for Java" ?

2009-11-28 Thread ted stockwell


On Nov 27, 7:19 pm, Diana Cruise  wrote:
>
> Ted... java.lang.Thread, you want to launch new processes from within
> your app server...that's a job for URLFetch.
>

Unlike Thread, I can't use URLFetch to perform a task asynchronously
and return a result to the calling thread.


--

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-j...@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: Why is it called "Google App Engine for Java" ?

2009-11-27 Thread ted stockwell
Apologies, I see I didn't read the original e-mail closely.
I was thinking 'shared server environment', not 'shared app server
environment'.
But, come to think of it, I guess whitelist is so large because GAE/J
is a shared app server, not a shared server.


On Nov 27, 4:22 pm, jago  wrote:
> What do you mean with not a problem?
>
> On Nov 27, 10:13 pm, ted stockwell  wrote:
>
> > On Nov 27, 12:17 pm, Diana Cruise  wrote:
>
> > > I'm curious which classes you are referring to that are missing and
> > > are NOT considered a stability risk running under a shared app server
> > > environment.  
>
> > Well, since you asked, java.lang.Thread is NOT a problem in most
> > shared app server environments.
> > The Google App Engine is 'special' in this regard.

--

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-j...@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: Why is it called "Google App Engine for Java" ?

2009-11-27 Thread ted stockwell


On Nov 27, 12:17 pm, Diana Cruise  wrote:
> I'm curious which classes you are referring to that are missing and
> are NOT considered a stability risk running under a shared app server
> environment.  

Well, since you asked, java.lang.Thread is NOT a problem in most
shared app server environments.
The Google App Engine is 'special' in this regard.

--

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-j...@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: Concurrency In Transaction

2009-11-18 Thread ted stockwell


On Nov 17, 10:27 pm, Rusty Wright  wrote:
> Ah, thanks.  So if I knew how many servers my cloud is made of then I should 
> use that number for my MAX_RETRIES.  ;-)
>
> I'm curious about how others are handling the exceptions.  The 
> JDOCanRetryException is subclassed by other exceptions that don't seem like 
> things I'd want to retry, but perhaps I don't understand the subtleties.  
>

You are correct, you don't want to retry on any error, only the
'retry' errors.
I would write the retry method something like this...


  public Object retry(final ProceedingJoinPoint pjp) throws Throwable
{
this.log.debug("called");

int retryCount = 0;

while (true) {
JDOException exception = null;

try {
return (pjp.proceed());
}
catch (final JDOCanRetryException ex) {
exception = ex;
// retry
}
catch (final JDOException ex) {

/**
 * to quote Google's documentation: If any action
 * fails due to the requested entity group being in
 * use by another process, JDO throws a
 * JDODataStoreException or a JDOException, caused by
a
 * java.util.ConcurrentModificationException.
 */
if (!(ex.getCause() instanceof
ConcurrentModificationException))
throw ex; // fail

exception = ex;
// retry
}

this.log.debug("retryCount: {}, exception: {}",
Integer.valueOf(++retryCount),
ExceptionUtils.getFullStackTrace(exception));
}
}

--

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-j...@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=.




[appengine-java] Re: Concurrency In Transaction

2009-11-17 Thread ted stockwell


On Nov 17, 2:59 pm, Rusty Wright  wrote:
> Is there some way to pause before retrying the database transaction?  If you 
> don't, then it seems to me that the processes that are banging into each 
> other are going to keep failing.  I'd like to add a pause for a random amount 
> of time in the catch block.
>

It is not necessary to pause before retrying because if a transaction
fails with a 'RetryException' it is only because some other
transaction was committed and that other transaction made some changes
that are incompatible with the failed transactions changes.

So... suppose you kick off 10 transactions at once.
At *most* only 9 of those transactions will fail with a
RetryException.
If you retry those 9 then at *most* 8 will fail, and so on


--

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-j...@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=.




[appengine-java] Re: Concurrency In Transaction

2009-10-27 Thread ted stockwell



On Oct 27, 1:35 pm, yccheok  wrote:
>
> (Now, I assume there will be only one servlet instance in entire web
> environment. Multiple thread will be spawn to access the code in the
> one servlet instance, for multiple web request.)
>

That is not a valid assumption.
There may be more than one instance of the servlet running on several
different machines.


--~--~-~--~~~---~--~~
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: Java Low Level commit timeout

2009-09-22 Thread ted stockwell



On Sep 21, 1:07 pm, "Jason (Google)"  wrote:
> Since bulk updates to entities in the
> same group are performed sequentially and not in parallel
>
> - Jason
>

Hi Jason,

Question...  If I do a bulk put where the entities are NOT in the same
entity group then would the updates be performed in parallel??

I ask because I could put a parallel put to good use in some
situations
--~--~-~--~~~---~--~~
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: when will BigDecimal be supported in datastore?

2009-09-21 Thread ted stockwell



On Sep 21, 3:05 am, Philippe Marschall 
wrote:
>
> But long is crappy abstraction. Sometimes you need two decimal places,
> sometimes three, sometimes six, sometimes "as many as there are".
> That's all quite cumbersome to do with a long alone. String seems like
> the easier way to go.
>

Well, in case anyone is interested, below I have included the code for
a class that can lexicographically encode BigDecimals as strings (and
I have included JUnit test class).
This class encodes numbers as strings in such a way that the
lexicographic order of the encoded strings is the same as the natural
order of the original numbers.
The length of an encoded number is only slightly larger than the
length of its original number.
Unlike other schemes, there is no limit to the size of numbers which
may be encoded.
This encoding lets you store BigDecimals as Strings and still be able
to do proper range searches in queries.

This code was based on ideas in this paper: www.zanopha.com/docs/elen.ps
, but there are some minor differences.
Feel free to use this code as you wish.




package net.sf.contrail.core.impl;

import java.math.BigDecimal;
import java.text.ParseException;

import net.sf.contrail.core.ContrailException;


/**
 * Encodes numbers as strings in such a way that the lexicographic
order of the
 * encoded strings is the same as the natural order of the original
numbers.
 * The length of an encoded number is only slightly larger than the
length
 * of its original number.
 * Unlike other schemes, there is no limit to the size of numbers
which may be encoded.
 *
 * @author ted stockwell
 *
 */
public class StorageNumberCodec {

public static final String decode(String input) {
try
{
if (input == null)
return null;
if (input.length() <= 0)
return "";
return new Decoder(input)._output;
}
catch (ParseException e) {
throw new ContrailException("Failed to decode 
number:"+input, e);
}
}
public static final BigDecimal decodeAsBigDecimal(String input) {
try
{
if (input == null)
return null;
if (input.length() <= 0)
throw new ContrailException("Internal Error: 
Cannot decode an
empty String");
return new BigDecimal(new Decoder(input)._output);
}
catch (ParseException e) {
throw new ContrailException("Failed to decode 
number:"+input, e);
}
}


public static final String encode(String input) {
try
{
if (input == null)
return null;
if (input.length() <= 0)
return "";
return new Encoder(input)._output;
}
catch (ParseException e)
{
throw new ContrailException("Failed to parse 
number:"+input, e);
}
}
public static final String encode(BigDecimal decimal) {
if (decimal == null)
return null;
return encode(decimal.toPlainString());
}



static public class Encoder {

private String _input;
private int _position= 0;
private int _end;
private String _output= "";
private boolean _isNegative= false;

private Encoder(String input) throws ParseException {
_input= input;
_end= _input.length();

char c= _input.charAt(_position);
if (c == '-') {
_input.charAt(_position++);
_isNegative= true;
}

readNumberBeforeDecimal();
if (readDecimalPoint()) {
readNumber(_end - _position);
}
_output+= _isNegative ? '?' : '*';
}

private boolean readDecimalPoint() throws ParseException {
if (_end <= _position)
return false;
char c= _input.charAt(_position++);
if (c != '.')
throwParseException("Expe

[appengine-java] Re: when will BigDecimal be supported in datastore?

2009-09-20 Thread ted stockwell



On Sep 20, 7:16 am, Philippe Marschall 
wrote:
>
> BigDecimal is the only sane choice for anything that includes monetary
> calculations.
>

True, but just because a number is saved as a long doesn't mean you
can't do calculations using BigDecimal.
I think the CPU cycles it takes to convert a long to a BigDecimal is
trivial.


--~--~-~--~~~---~--~~
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: How to query multivalued properties in low-level Datastore API?

2009-08-25 Thread ted stockwell


Thanks much.
One more question...
If I want to select recipes that have both hamburger and olives should
I just add two filters???
   Query query = new Query("recipe");
   query.addFilter("ingredients", Query.FilterOperator.EQUAL,
"hamburger");
   query.addFilter("ingredients", Query.FilterOperator.EQUAL,
"olives");





--~--~-~--~~~---~--~~
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] How to query multivalued properties in low-level Datastore API?

2009-08-25 Thread ted stockwell

Hi All,

I am using the low-level Datastore API in my application.
Suppose I store a bunch of 'Recipe' entities, where each entity has a
multivalued property named 'ingredients", and the ingredients property
is a set of Strings.
For instance:
Entity recipe= new Entity("recipe", "tater tot casserole");
recipe.setProperty("ingredients", new HashSet() {{
 add("Tater Tots");
 add("peas");
 add("Cream of Celery Soup");
 add("hamburger");
}});

Can I create a Query in the low-level API that will select all recipes
that include 'hamburger" in the ingredients???

I'm thinking that it's possible since it's supported in the JDO API,
but I cannot see how it should be done.

Thanks in advance,
-ted stockwell


--~--~-~--~~~---~--~~
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: aggregate functions implementation in Google App Engine

2009-08-19 Thread ted stockwell

On Aug 19, 5:00 am, PSL  wrote:
> Hi,
> I want to implement aggregate functions like sum and avg in Java in
> Google App Engine.

I don't know a good way to acomplish this in GAE right now.
I think that having Asychronous URL fetches is one way that this could
be done (this is a feature in the Python GAE API but not in the Java
API).
This feature would allow you to create a servlet that will calculate
functions over a range of records.
Then your method could break the job of calculating the function into
jobs of 1 records each.
For example, for 5 rows your method wouold issue 5 asychronous
calls to the servlet that calculates the function, each call specifies
a range a rows.
Then the method would collection the result from each call and return
the total.


I have created a feature request for adding the Asychronous URL fetch
to the Java API.
Please go and 'star' this issue
http://code.google.com/p/googleappengine/issues/detail?id=1899


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