Class LoadMenuItemsJob

java.lang.Object
edu.ucsb.cs156.dining.jobs.LoadMenuItemsJob
All Implemented Interfaces:
edu.ucsb.cs156.jobs.services.JobContextConsumer

public class LoadMenuItemsJob extends Object implements edu.ucsb.cs156.jobs.services.JobContextConsumer
Downloads the menus for every dining commons and meal on each day in [startDate, endDate] from the UCSB Dining API, and saves any MenuItems not already in the database. Backs off exponentially when the API responds with 429 Too Many Requests.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Abstraction over Thread.sleep so tests don't have to actually wait.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(edu.ucsb.cs156.jobs.services.JobContext ctx)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface edu.ucsb.cs156.jobs.services.JobContextConsumer

    getJobName, getScopeId, getScopeType
  • Constructor Details

    • LoadMenuItemsJob

      public LoadMenuItemsJob()
  • Method Details

    • accept

      public void accept(edu.ucsb.cs156.jobs.services.JobContext ctx) throws Exception
      Specified by:
      accept in interface edu.ucsb.cs156.jobs.services.JobContextConsumer
      Throws:
      Exception