Class SlowLoadableComponent<T extends LoadableComponent<T>>

  • Type Parameters:
    T - The type to be returned (normally the subclass' type)

    public abstract class SlowLoadableComponent<T extends LoadableComponent<T>>
    extends LoadableComponent<T>
    A LoadableComponent which might not have finished loading when load() returns. After a call to load(), the isLoaded() method should continue to fail until the component has fully loaded.
     new SlowHypotheticalComponent().get();
     
    • Constructor Summary

      Constructors 
      Constructor Description
      SlowLoadableComponent​(java.time.Clock clock, int timeOutInSeconds)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get()
      Ensure that the component is currently loaded.
      protected void isError()
      Check for well known error cases, which would mean that loading has finished, but an error condition was seen.
      protected long sleepFor()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SlowLoadableComponent

        public SlowLoadableComponent​(java.time.Clock clock,
                                     int timeOutInSeconds)
    • Method Detail

      • isError

        protected void isError()
                        throws java.lang.Error
        Check for well known error cases, which would mean that loading has finished, but an error condition was seen. If an error has occurred throw an Error, possibly by using JUnit's Assert.assert* methods
        Throws:
        java.lang.Error - When a well-known error condition has caused the load to fail
      • sleepFor

        protected long sleepFor()