More Related Content
Similar to Appengine Java Night #2b
Similar to Appengine Java Night #2b (20)
Appengine Java Night #2b
- 3. AppEngine
AppEngine
ApiProxy#getDelegate()
Delegate
Web Delegate
Web
ApiProxy
#getCurrentEnvironment()
Environment
(ApplicationID, versionID )
- 4. AppEngine
JUnit SDK Web
ApiProy
• Environment
ApiProxy#setEnvironmentForCurrentThread()
• Delegate ApiProxyLocalImpl
ApiProxy#setDelegate()
- 5. Environment
•
• ApplicationID, versionID,
• Web SingleThread
•
ApiProxy#setEnvironmentForCurrentThread()
- 6. Delegate : ApiProxyLocalImpl
• Delegate
Delegate
•
• WEB-INF/queue.xml
datastore-indexes.xml
- 7. Delegate
•
Delegate
• … /
• ApiProxy#getDelegate()
AOP
- 8. Delegate
class MyDelegate implements Delegate {
Delegate original = ApiProxy.getDelegate();
public byte[] makeSyncCall(
Environment environment,
String service, String method,
byte[] request) throws ApiProxyException {
System.out.println(service+”:”+method);
return original.makeSyncCall(
environment, service, method, requst);
}
}
- 11. makeSyncCall()
• datastore_v3#GET
• : DatastorePb.GetRequest
• new GetRequest().mergeFrom(byte[])
• GetRequest#keyIterator() Key
Iterator
• : DatastorePb.GetResponse
• new GetResponse().mergeFrom(byte[])
• GetResponse#entityIterator()
Entity Iterator
- 12. • Mail
• MailService
Delegate#makeSyncCall() Stub
• makeSyncCall() byte[]
MailServicePb.MailMessage
MailMessage#getCC()...
assert
- 14. • …
• datastore_v3#GET
• memcache#GET datastore
mamcache#GET
• datastore_v3#PUT/DELETE
• memcache#DELETE datastore