Comp150CPA: Clouds and Power-Aware Computing
Classroom Exercise 3
Asynchronous behavior
Spring 2011

group member 1: ____________________________ login: ______________

group member 2: ____________________________ login: ______________

group member 3: ____________________________ login: ______________

group member 4: ____________________________ login: ______________

group member 5: ____________________________ login: ______________

In class we have studied the concept of asynchronous client-server interactions, in which the client schedules page updates that occur later in time. Let's explore a bit more about these interactions.

  1. In the examples, why is the asynchronous callback class defined inside the client method, rather than in another class?







  2. Suppose the user in the SimplePersistence example presses the "Save" button twice in rapid succession. What does the user see?
  3. Suppose you want to do real-time updates of, e.g., stock quotes. GWT allows the client to regularly request data asynchronously. For requesting one stock's quote, what should the argument and return value to the service look like? Hint: can you tell quotes apart?











  4. Suppose you want to make one request of a server for a bundle of loosely related data items to be scattered around a web page in various places. How would you approach designing the clientside and serverside code so that there is no confusion as to what data goes where from the (asynchronous) return value?











  5. (Advanced) Why is the asynchronous version of a service class created through a factory-like construction:
     
    PersistentThingServiceAsync thingService = 
        (PersistentThingServiceAsync) 
    	 GWT.create(PersistentThingService.class);
    
    rather than being pre-defined through inheritance? (It actually isn't a factory; it just looks like one.)