public static void reloadData ( IAsyncHandler < Void > doneHandler ) { synchronized ( URILoadingRegistry . class ) { if ( instance == null ) { doneHandler . handle ( ( Void ) null ) ; return ; } Map < URILoadingRegistry , IAsyncResultHandler < Void > > regs = instance . handlers ; Vertx vertx = instance . vertx ; URI uri = instance . uri ; Map < String , String > config = instance . config ; AtomicInteger ctr = new AtomicInteger ( regs . size ( ) ) ; OneShotURILoader newLoader = new OneShotURILoader ( vertx , uri , config ) ; regs . entrySet ( ) . stream ( ) . forEach ( pair -> { // Clear the registrys' internal maps to prepare for reload. // NB: If we add production hot reloading, we'll need to work around this (e.g. clone?). pair . getKey ( ) . getMap ( ) . clear ( ) ; // Re-subscribe the registry. newLoader . subscribe ( pair . getKey ( ) , result -> { checkAndFlip ( ctr . decrementAndGet ( ) , newLoader , doneHandler ) ; } ) ; } ) ; checkAndFlip ( ctr . get ( ) , newLoader , doneHandler ) ; } }
For testing only . Reloads rather than full restart .