public static void sudoConsumer ( Consumer < ODatabaseDocument > consumer ) { new DBClosure < Void > ( ) { @ Override protected Void execute ( ODatabaseDocument db ) { consumer . accept ( db ) ; return null ; } } . execute ( ) ; }
Simplified consumer to execute under admin