Hi There,
I am new to the GAE environment and was keen to get some project
completed using this environment.
I have a project which should use the Jazzy spell checker to spell
check some text in addition to other actions.
When I run this code locally it runs fine however, when I deploy it,
it hits a HardDeadlineExceededError.
I have done a bit of research in this and was exploring how to
implement a DeferedTask to enusure my program code is executed.
My approach was to call the code containing the spell checker with the
DeferredTask Class (inner-class), however I am stuck on what to do
next after this.
Particularly, how I am getting a serialization which I am unsure of as
I have not seem many example of DeferredTasks.
Any simple step-by-step guide on how to use DeferredTasks would be
helpful.
I should add my code below:
try {
String username = (String)
getRequest().getAttributes().get(
"handle");
@SuppressWarnings("serial")
class MyDeferred implements DeferredTask {
@Override
public void run() {
//Trying to do something like
response = new StringRepresentation("Hi "
+ username.toLowerCase() + ",
hello from the clouds. "+);
}
}
if (null != username) {
setStatus(Status.SUCCESS_OK);
Queue queue = QueueFactory.getDefaultQueue();
TaskOptions taskOptions =
TaskOptions.Builder.withPayload(
new MyDeferred());
queue.add(taskOptions);
response = new StringRepresentation("Hi "
+ username.toLowerCase() + ",
hello from the clouds. ");
} else
throw new Exception("handle was null");
} catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
setStatus(Status.SERVER_ERROR_INTERNAL);
response = new StringRepresentation("ERROR : " +
sw.toString());
}
return response;
--
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.