test that if we try and execute a command with a cache key without initializing request variable that it gives an error

public void test cache key execution requires request variable ( ) throws exception { / * force the request variable to not be initialized * / hystrix request context set context on current thread ( null ) ; test circuit breaker circuit breaker = new test circuit breaker ( ) ; successful cacheable command command = new successful cacheable command < string > ( circuit breaker , true , " one " ) ; assert equals ( " one " , command execute ( ) ) ; successful cacheable command command 2 = new successful cacheable command < string > ( circuit breaker , true , " two " ) ; assert equals ( " two " , command 2 queue ( ) get ( ) ) ; }


a given grammar t , return the visitor name such as t visitor java , if we ' re using the java target

public string get visitor file name ( boolean header ) { code generator gen = get code generator ( ) ; grammar g = gen g ; assert g name ! = null ; return g name to lower case ( ) + " visitor go " ; }


return the name of this type : the fully qualified class name

public string get name ( ) { return class utils get qualified name ( get type ( ) ) ; }


returns the old value associated with the specified key , or the specified default value

public float put ( k key , float value , float default value ) { int i = locate key ( key ) ; if ( i > = 0 ) { / / existing key was found float old value = value table [ i ] ; value table [ i ] = value ; return old value ; } i = - ( i + 1 ) ; / / empty space was found key table [ i ] = key ; value table [ i ] = value ; if ( + + size > = threshold ) resize ( key table length < < 1 ) ; return default value ; }


public void put ( string path , router quota usage quota usage ) { write lock lock ( ) ; try { this cache put ( path , quota usage ) ; } finally { write lock unlock ( ) ; } }


sets the array size , leaving any values beyond the current size undefined

public boolean [ ] set size ( int new size ) { if ( new size < 0 ) throw new illegal argument exception ( " new size must be > = 0 : " + new size ) ; if ( new size > items length ) resize ( math max ( 8 , new size ) ) ; size = new size ; return items ; }


customizes { @ link service instance the service instance }

void customize ( service instance service instance ) ;


get the closure of this item , caching the result

public set < assembly parse state item > get closure ( ) { if ( closure ! = null ) { return closure ; } closure = new linked hash set < > ( kernel ) ; set < assembly parse state item > new items = new linked hash set < > ( ) ; do { new items clear ( ) ; for ( assembly parse state item item : closure ) { new items add all ( item get closure ( grammar ) ) ; } } while ( closure add all ( new items ) ) ; return closure ; }


public void int 6 4 test ( ) { / / todo : test int 6 4 }


some exceptions that happen off the test thread are not serious enough to fail the test for example , some exceptions happen on the headless test server due more to environmental issues rather than real problems this method is intended to ignore these less - than - serious issues

private static boolean is known test machine timing bug ( throwable t ) { string message = t get message ( ) ; if ( message = = null ) { return false ; } return string utils contains any ( message , ignorable error messages ) ; }


we are checking here that we are resilient to a race condition in which a value that is checking its children for dirtiness is signaled by all of its children , putting it in a ready state , before the thread has terminated optionally , one of its children may throw an error , shutting down the threadpool the essential race is that a child about to throw signals its parent and the parent ' s builder restarts itself before the exception is thrown here , the signaling happens while dirty dependencies are being checked we control the timing by blocking " top " ' s registering itself on its deps

private void dirty child enqueues parent during check dependencies ( final boolean throw error ) throws exception { / / value to be built it will be signaled to rebuild before it has finished checking its deps final sky key top = graph tester to sky key ( " a top " ) ; / / other top is alphabetically after top sky key other top = sky key ( " z other top " ) ; / / dep that blocks before it acknowledges being added as a dep by top , so the first key value has / / time to signal top ( importantly its key is alphabetically after ' first key ' ) final sky key slow adding dep = graph tester to sky key ( " slow dep " ) ; / / value that is modified on the second build its thread won ' t finish until it signals top , / / which will wait for the signal before it enqueues its next dep we prevent the thread from / / finishing by having the graph listener block on the second reverse dep to signal sky key first key = graph tester non hermetic key ( " first " ) ; tester set ( first key , new string value ( " biding " ) ) ; / / don ' t perform any blocking on the first build final atomic boolean delay top signaling = new atomic boolean ( false ) ; final count down latch top signaled = new count down latch ( 1 ) ; final count down latch top requested dep or restarted build = new count down latch ( 1 ) ; final count down latch parents requested = new count down latch ( 2 ) ; inject graph listener for testing ( ( key , type , order , context ) - > { if ( ! delay top signaling get ( ) ) { return ; } if ( key equals ( other top ) & & type = = event type signal ) { tracking awaiter instance await latch and track exceptions ( top requested dep or restarted build , " top ' s builder did not start in time " ) ; return ; } if ( key equals ( first key ) & & type = = event type add reverse dep & & order = = order after ) { parents requested count down ( ) ; return ; } if ( key equals ( first key ) & & type = = event type check if done & & order = = order after ) { parents requested count down ( ) ; if ( throw error ) { top requested dep or restarted build count down ( ) ; } return ; } if ( key equals ( top ) & & type = = event type signal & & order = = order after ) { / / top is signaled by first key ( since slow adding dep is blocking ) , so slow adding dep / / is now free to acknowledge top as a parent top signaled count down ( ) ; return ; } if ( key equals ( first key ) & & type = = event type set value & & order = = order before ) { / / make sure both parents add themselves as rdeps tracking awaiter instance await latch and track exceptions ( parents requested , " parents did not request dep in time " ) ; } if ( key equals ( slow adding dep ) & & type = = event type check if done & & top equals ( context ) & & order = = order before ) { / / if top is trying to declare a dep on slow adding dep , wait until first key has / / signaled top then this add dep will return done and top will be signaled , / / making it ready , so it will be enqueued tracking awaiter instance await latch and track exceptions ( top signaled , " first key didn ' t signal top in time " ) ; } } , / * deterministic = * / true ) ; tester set ( slow adding dep , new string value ( " dep " ) ) ; final atomic integer num top invocations = new atomic integer ( 0 ) ; tester get or create ( top ) set builder ( new no extractor function ( ) { @ override public sky value compute ( sky key key , sky function environment env ) throws interrupted exception { num top invocations increment and get ( ) ; if ( delay top signaling get ( ) ) { / / the graph listener will block on first key ' s signaling of other top above until / / this thread starts running top requested dep or restarted build count down ( ) ; } / / top ' s builder just requests both deps in a group env get values or throw ( immutable list of ( first key , slow adding dep ) , some error exception class ) ; return env values missing ( ) ? null : new string value ( " top " ) ; } } ) ; / / first build : just prime the graph evaluation result < string value > result = tester eval ( / * keep going = * / false , top ) ; assert that ( result has error ( ) ) is false ( ) ; assert that ( result get ( top ) ) is equal to ( new string value ( " top " ) ) ; assert that ( num top invocations get ( ) ) is equal to ( 2 ) ; / / now dirty the graph , and maybe have first key throw an error if ( throw error ) { tester get or create ( first key , / * mark as modified = * / true ) set constant value ( null ) set builder ( new no extractor function ( ) { @ nullable @ override public sky value compute ( sky key sky key , environment env ) throws sky function exception { tracking awaiter instance await latch and track exceptions ( parents requested , " both parents didn ' t request in time " ) ; throw new generic function exception ( new some error exception ( first key to string ( ) ) , transience persistent ) ; } } ) ; } else { tester get or create ( first key , / * mark as modified = * / true ) set constant value ( new string value ( " new " ) ) ; } tester get or create ( other top ) add dependency ( first key ) set computed value ( concatenate ) ; tester invalidate ( ) ; delay top signaling set ( true ) ; result = tester eval ( / * keep going = * / false , top , other top ) ; if ( throw error ) { assert that evaluation result ( result ) has error ( ) ; assert that ( result key names ( ) ) is empty ( ) ; / / no successfully evaluated values assert that evaluation result ( result ) has error entry for key that ( top ) ; assert with message ( " on the incremental build , top ' s builder should have only been used in error " + " bubbling " ) that ( num top invocations get ( ) ) is equal to ( 3 ) ; } else { assert that evaluation result ( result ) has entry that ( top ) is equal to ( new string value ( " top " ) ) ; assert that evaluation result ( result ) has no error ( ) ; assert with message ( " on the incremental build , top ' s builder should have only been executed once in " + " normal evaluation " ) that ( num top invocations get ( ) ) is equal to ( 3 ) ; } assert that ( top signaled get count ( ) ) is equal to ( 0 ) ; assert that ( top requested dep or restarted build get count ( ) ) is equal to ( 0 ) ; }


returns the number of block pending for the given node by adding those blocks in pending rep and out of service node blocks

private int get pending count for node ( datanode descriptor dn ) { int count = 0 ; hash map < block info , integer > blocks = out of service node blocks get ( dn ) ; if ( blocks ! = null ) { count + = blocks size ( ) ; } list < block info > pending blocks = pending rep get ( dn ) ; if ( pending blocks ! = null ) { count + = pending blocks size ( ) ; } return count ; }


return the number of address ranges in this set

public int get num address ranges ( ) { return address set get num address ranges ( ) ; }


returns { @ code true } if the content of both { @ link char sequence } ' s are equals this only supports 8 - bit ascii

public static boolean content equals ( char sequence a , char sequence b ) { if ( a = = null | | b = = null ) { return a = = b ; } if ( a instanceof ascii string ) { return ( ( ascii string ) a ) content equals ( b ) ; } if ( b instanceof ascii string ) { return ( ( ascii string ) b ) content equals ( a ) ; } if ( a length ( ) ! = b length ( ) ) { return false ; } for ( int i = 0 ; i < a length ( ) ; + + i ) { if ( a char at ( i ) ! = b char at ( i ) ) { return false ; } } return true ; }


gets the maximum degree of parallelism defined for the program the maximum degree of parallelism specifies the upper limit for dynamic scaling it also defines the number of key groups used for partitioned state

public int get max parallelism ( ) { return config get max parallelism ( ) ; }


gets the class file field { @ code minor version } , but without doing any checks or parsing first

public int get minor version 0 ( ) { return bytes get unsigned short ( 4 ) ; }


public format test integer ( integer integer ) { this integer = integer ; return this ; }


public boolean equals ( object o ) { if ( this = = o ) { return true ; } if ( o = = null | | get class ( ) ! = o get class ( ) ) { return false ; } login that = ( login ) o ; return objects equals ( user , that user ) & & objects equals ( password , that password ) ; }


retuns whether unknown length is simulated

public boolean is simulating unknown length ( ) { return simulate unknown length ; }


public static < k , v > multimap < k , v > unmodifiable multimap ( immutable multimap < k , v > delegate ) { return check not null ( delegate ) ; }


public int get index ( ) { return index ; }


return configuration name ( which will be used to set ordering policy )


{ @ inherit doc } this implementation composes a string by iterating over its mappings

public string to string ( ) { if ( size ( ) < = 0 ) { return " { } " ; } string builder buffer = new string builder ( m size * 28 ) ; buffer append ( ' { ' ) ; for ( int i = 0 ; i < m size ; i + + ) { if ( i > 0 ) { buffer append ( " , " ) ; } int key = key at ( i ) ; buffer append ( key ) ; buffer append ( ' = ' ) ; boolean value = value at ( i ) ; buffer append ( value ) ; } buffer append ( ' } ' ) ; return buffer to string ( ) ; }


this match method will go through all the provided matchers and call their match method , if all match we return true

public boolean match ( variable context variables ) { for ( mapping rule matcher matcher : matchers ) { if ( ! matcher match ( variables ) ) { return false ; } } return true ; }


public synchronized void clear ( ) { package roots = null ; source artifact cache clear ( ) ; }


find the fields constant that matches field id , throwing an exception if it is not found

public static fields find by thrift id or throw ( int field id ) { fields fields = find by thrift id ( field id ) ; if ( fields = = null ) throw new illegal argument exception ( " field " + field id + " doesn ' t exist ! " ) ; return fields ; }


determine a corresponding interface method for the given method handle , if possible this is particularly useful for arriving at a public exported type on jigsaw which can be reflectively invoked without an illegal access warning

public static method get interface method if possible ( method method ) { if ( ! modifier is public ( method get modifiers ( ) ) | | method get declaring class ( ) is interface ( ) ) { return method ; } return interface method cache compute if absent ( method , key - > { class < ? > current = key get declaring class ( ) ; while ( current ! = null & & current ! = object class ) { class < ? > [ ] ifcs = current get interfaces ( ) ; for ( class < ? > ifc : ifcs ) { try { return ifc get method ( key get name ( ) , key get parameter types ( ) ) ; } catch ( no such method exception ex ) { / / ignore } } current = current get superclass ( ) ; } return key ; } ) ; }


returns the first { @ link channel handler } in this pipeline


populates the attributes table of the new { @ link rule } with the values in the { @ code attribute values } map and with default values provided by this { @ link rule class } and the { @ code pkg builder } errors are reported on { @ code event handler }

private < t > void populate rule attribute values ( rule rule , package builder pkg builder , attribute values < t > attribute values , event handler event handler ) throws interrupted exception , cannot precompute defaults exception { bit set defined attr indices = populate defined rule attribute values ( rule , pkg builder get repository mapping ( ) , attribute values , pkg builder get list interner ( ) , pkg builder get converted labels in package ( ) , event handler ) ; populate default rule attribute values ( rule , pkg builder , defined attr indices , event handler ) ; / / now that all attributes are bound to values , collect and store configurable attribute keys populate config dependencies attribute ( rule ) ; }


creates a new async stub that supports all call types for the service

public static resource sink stub new stub ( io grpc channel channel ) { return new resource sink stub ( channel ) ; }


override to add additional { @ link network service custom name resolver } s this can be handy if you want to provide your own network interface name like mycard and implement by yourself the logic to get an actual ip addresshostname based on this name for example : you could call a third party service ( an api ) to resolve mycard then you could define in elasticsearch yml settings like : { @ code network host : mycard }

default network service custom name resolver get custom name resolver ( settings settings ) { return null ; }


getter for the list of byte viewer components

public list < byte viewer component > get view list ( ) { return view list ; }


public string read string lenenc ( ) { int length = ( int ) read int lenenc ( ) ; byte [ ] result = new byte [ length ] ; byte buf read bytes ( result ) ; return new string ( result ) ; }


emits pcode to call a void black - box pcodeop

public void emit void pcode op call ( string pcodeop , string args ) { symbol userop sym = language get symbol table ( ) find global symbol ( pcodeop ) ; varnode [ ] in = new varnode [ args length + 1 ] ; in [ 0 ] = get constant ( ( ( userop symbol ) userop sym ) get index ( ) , 4 ) ; for ( int i = 0 ; i < args length ; + + i ) { in [ i + 1 ] = constant or register ( args [ i ] ) ; } pcode op op = new pcode op ( op address , seqnum + + , pcode op callother , in ) ; op list add ( op ) ; }


if there is no job running , no need to keep redundant task managers and release the timeout task managers this may happen in session mode without jobs running

public void test task manager timeout with redundant task manager ( ) throws exception { check task manager timeout ( 1 ) ; }


returns the block file name for the block

public string get block name ( ) { return block get block name ( ) ; }


get the full set of requirements for a tester class

public static tester requirements get tester requirements ( method tester method ) throws conflicting requirements exception { synchronized ( method tester requirements cache ) { tester requirements requirements = method tester requirements cache get ( tester method ) ; if ( requirements = = null ) { requirements = build tester requirements ( tester method ) ; method tester requirements cache put ( tester method , requirements ) ; } return requirements ; } }


creates and registers a dispatch query with the query tracker this method will never fail to register a query with the query tracker if an error occurs while , creating a dispatch query a failed dispatch will be created and registered

private < c > void create query internal ( query id query id , string slug , session context session context , string query , resource group manager < c > resource group manager ) { session session = null ; prepared query prepared query ; try { if ( query length ( ) > max query length ) { int query length = query length ( ) ; query = query substring ( 0 , max query length ) ; throw new presto exception ( query text too large , format ( " query text length ( % s ) exceeds the maximum length ( % s ) " , query length , max query length ) ) ; } / / decode session session = session supplier create session ( query id , session context ) ; / / prepare query warning collector warning collector = warning collector factory create ( get warning handling level ( session ) ) ; prepared query = query preparer prepare query ( session , query , warning collector ) ; / / select resource group optional < query type > query type = get query type ( prepared query get statement ( ) get class ( ) ) ; selection context < c > selection context = resource group manager select group ( new selection criteria ( session context get identity ( ) get principal ( ) is present ( ) , session context get identity ( ) get user ( ) , optional of nullable ( session context get source ( ) ) , session context get client tags ( ) , session context get resource estimates ( ) , query type map ( enum : : name ) ) ) ; / / apply system default session properties ( does not override user set properties ) session = session property defaults new session with default properties ( session , query type map ( enum : : name ) , optional of ( selection context get resource group id ( ) ) ) ; / / mark existing transaction as active transaction manager activate transaction ( session , is transaction control statement ( prepared query get statement ( ) ) , access control ) ; dispatch query dispatch query = dispatch query factory create dispatch query ( session , query , prepared query , slug , selection context get resource group id ( ) , query type , warning collector ) ; boolean query added = query created ( dispatch query ) ; if ( query added & & ! dispatch query is done ( ) ) { try { resource group manager submit ( prepared query get statement ( ) , dispatch query , selection context , query executor ) ; } catch ( throwable e ) { / / dispatch query has already been registered , so just fail it directly dispatch query fail ( e ) ; } } } catch ( throwable throwable ) { / / creation must never fail , so register a failed query in this case if ( session = = null ) { session = session builder ( new session property manager ( ) ) set query id ( query id ) set identity ( session context get identity ( ) ) set source ( session context get source ( ) ) build ( ) ; } dispatch query failed dispatch query = failed dispatch query factory create failed dispatch query ( session , query , optional empty ( ) , throwable ) ; query created ( failed dispatch query ) ; } }


gets the output quality of a video of the given {

public quality get target quality ( long duration , int input total bit rate ) { int max video bit rate = math min ( maximum target video bitrate , input total bit rate - audio bitrate ) ; int min video bit rate = math min ( minimum target video bitrate , max video bit rate ) ; int target video bit rate = math max ( min video bit rate , math min ( get target video bit rate ( upper file size limit with margin , duration ) , max video bit rate ) ) ; int bit rate range = max video bit rate - min video bit rate ; double quality = bit rate range = = 0 ? 1 : ( target video bit rate - min video bit rate ) / ( double ) bit rate range ; return new quality ( target video bit rate , audio bitrate , quality , duration ) ; }


gets an unsigned 16 - bit short integer at the specified absolute { @ code index } in this buffer in little endian byte order this method does not modify { @ code reader index } or { @ code writer index } of this buffer

public abstract int get unsigned short l e ( int index ) ;


whether the layout params set on the view stub for the given model should be carried over to the model ' s view default is true set this to false if you want the layout params on the model ' s layout resource to be kept

protected boolean use view stub layout params ( epoxy model < ? > model , int model position ) { return true ; }


register member ( nested ) classes that happen to be configuration classes themselves

private void process member classes ( configuration class config class , source class source class , predicate < string > filter ) throws i o exception { collection < source class > member classes = source class get member classes ( ) ; if ( ! member classes is empty ( ) ) { list < source class > candidates = new array list < > ( member classes size ( ) ) ; for ( source class member class : member classes ) { if ( configuration class utils is configuration candidate ( member class get metadata ( ) ) & & ! member class get metadata ( ) get class name ( ) equals ( config class get metadata ( ) get class name ( ) ) ) { candidates add ( member class ) ; } } order comparator sort ( candidates ) ; for ( source class candidate : candidates ) { if ( this import stack contains ( config class ) ) { this problem reporter error ( new circular import problem ( config class , this import stack ) ) ; } else { this import stack push ( config class ) ; try { process configuration class ( candidate as config class ( config class ) , filter ) ; } finally { this import stack pop ( ) ; } } } } }


find a single { @ link annotation } of { @ code annotation type } on the supplied { @ link annotated element } meta - annotations will be searched if the annotation is not directly present on the supplied element warning : this method operates generically on annotated elements in other words , this method does not execute specialized search algorithms for classes or methods if you require the more specific semantics of { @ link # find annotation ( class , class ) } or { @ link # find annotation ( method , class ) } , invoke one of those methods instead

public static < a extends annotation > a find annotation ( annotated element annotated element , @ nullable class < a > annotation type ) { if ( annotation type = = null ) { return null ; } / / shortcut : directly present on the element , with no merging needed ? if ( annotation filter plain matches ( annotation type ) | | annotations scanner has plain java annotations only ( annotated element ) ) { return annotated element get declared annotation ( annotation type ) ; } / / exhaustive retrieval of merged annotations return merged annotations from ( annotated element , search strategy inherited annotations , repeatable containers none ( ) ) get ( annotation type ) with non merged attributes ( ) synthesize ( merged annotation : : is present ) or else ( null ) ; }


returns a view of this range map as an unmodifiable { @ code map < range < k > , v > } modifications to this range map are guaranteed to read through to the returned { @ code map } the returned { @ code map } iterates over entries in ascending order of the bounds of the { @ code range } entries it is guaranteed that no empty ranges will be in the returned { @ code map }

map < range < k > , v > as map of ranges ( ) ;


the name of this entry this corresponds to the ' entry ' part of a full resource name of the form package : typeentry < code > optional string name = 2 ; < code >

public java lang string get name ( ) { return name ; }


public expression parsing context parse ( ) { try ( expression parsing context ctx = expression parsing context create ( ) ) { result r = run ( immutable map of ( ) ) ; if ( ! r is success ( ) & & r is throwable ( ) ) { throw new expression parsing exception ( " failed to parse expression : " + literal + " , error : " + r get error ( ) ) ; } if ( log is debug enabled ( ) ) { log debug ( " \ " { } \ " is parsed " , literal ) ; } ctx validate ( literal ) ; return ctx ; } }


returns number of immutable memtables that have not yet been flushed

public void enable num immutable mem table ( ) { this properties add ( rocks d b property num immutable mem table get rocks d b property ( ) ) ; }


we have two running opportunistic containers , neither of which is out of limit we should kill the later one

public void test no opportunistic container over limit o o m ( ) throws exception { concurrent hash map < container id , container > containers = new concurrent hash map < > ( ) ; container c 1 = create container ( 1 , false , 1l , true ) ; containers put ( c 1 get container id ( ) , c 1 ) ; container c 2 = create container ( 2 , false , 2l , true ) ; containers put ( c 2 get container id ( ) , c 2 ) ; container executor ex = create container executor ( containers ) ; context context = mock ( context class ) ; when ( context get containers ( ) ) then return ( containers ) ; when ( context get container executor ( ) ) then return ( ex ) ; c groups handler c groups handler = mock ( c groups handler class ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , " " , cgroup param memory oom control ) ) then return ( " under oom 1 " ) then return ( " under oom 0 " ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 1 get container id ( ) to string ( ) , cgroup procs file ) ) then return ( " 1234 " ) then return ( " " ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 1 get container id ( ) to string ( ) , cgroup param memory usage bytes ) ) then return ( get m b ( 9 ) ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 1 get container id ( ) to string ( ) , cgroup param memory memsw usage bytes ) ) then return ( get m b ( 9 ) ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 2 get container id ( ) to string ( ) , cgroup procs file ) ) then return ( " 1235 " ) then return ( " " ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 2 get container id ( ) to string ( ) , cgroup param memory usage bytes ) ) then return ( get m b ( 9 ) ) ; when ( c groups handler get c group param ( c groups handler c group controller memory , c 2 get container id ( ) to string ( ) , cgroup param memory memsw usage bytes ) ) then return ( get m b ( 9 ) ) ; default o o m handler handler = new default o o m handler ( context , false ) { @ override protected c groups handler get c groups handler ( ) { return c groups handler ; } } ; handler run ( ) ; verify ( ex , times ( 1 ) ) signal container ( new container signal context builder ( ) set pid ( " 1235 " ) set container ( c 2 ) set signal ( container executor signal kill ) build ( ) ) ; verify ( ex , times ( 1 ) ) signal container ( any ( ) ) ; }


public boolean get namespace boolean ( ) { return namespace boolean ; }


checks the given runtime dependencies , and emits errors if there is a problem also called by { @ link # init common ( ) } for the current target ' s runtime dependencies

public static void check runtime deps ( rule context rule context , list < transitive info collection > runtime dep info ) { for ( transitive info collection c : runtime dep info ) { java info java info = ( java info ) c get ( java info provider get key ( ) ) ; if ( java info = = null ) { continue ; } boolean report error = ! rule context get fragment ( java configuration class ) get allow runtime deps on never link ( ) ; if ( java info is neverlink ( ) ) { string msg = string format ( " neverlink dep % s not allowed in runtime deps " , c get label ( ) ) ; if ( report error ) { rule context attribute error ( " runtime deps " , msg ) ; } else { rule context attribute warning ( " runtime deps " , msg ) ; } } } }


return an upper bound of the maximum bucket ordinal seen so far

public final long max bucket ord ( ) { return doc counts size ( ) ; }


called when the surface is created or recreated called when the rendering thread starts and whenever the egl context is lost the egl context will typically be lost when the android device awakes after going to sleep since this method is called at the beginning of rendering , as well as every time the egl context is lost , this method is a convenient place to put code to create resources that need to be created when the rendering starts , and that need to be recreated when the egl context is lost textures are an example of a resource that you might want to create here note that when the egl context is lost , all open g l resources associated with that context will be automatically deleted you do not need to call the corresponding " gl delete " methods such as gl delete textures to manually delete these lost resources

void on surface created ( gl10 gl , e g l config config ) ;


returns the given output option keys for this transition the transition implementation function must return a dictionary where the options exactly match the elements of this list

public immutable list < string > get outputs ( ) { return outputs ; }


indicates if an audit message should be written when on finish is called for the given checkpoint we audit the first checkpoint , and then every 10 checkpoints until completed checkpoint = = 99 then we audit every 100 , until completed checkpoint = = 999 then we always audit every 1 000 checkpoints

protected boolean should audit on finish ( long completed checkpoint ) { if ( + + log count % log every ! = 0 ) { return false ; } if ( completed checkpoint = = 0 ) { return true ; } int log 1 0 checkpoint = ( int ) math floor ( math log 1 0 ( completed checkpoint ) ) ; log every = log 1 0 checkpoint > = 3 ? 1 000 : ( int ) math pow ( 10 0 , log 1 0 checkpoint ) ; log count = 0 ; return true ; }


report a test has been skipped for some reason

public static void skip ( string message ) { log info ( " skipping : { } " , message ) ; throw new assumption violated exception ( message ) ; }


returns a synchronized ( thread - safe ) queue backed by the specified queue in order to guarantee serial access , it is critical that < b > all < b > access to the backing queue is accomplished through the returned queue it is imperative that the user manually synchronize on the returned queue when accessing the queue ' s iterator : { @ code queue < e > queue = queues synchronized queue ( min max priority queue < e > create ( ) ) ; queue add ( element ) ; needn ' t be in synchronized block synchronized ( queue ) { must synchronize on queue ! iterator < e > i = queue iterator ( ) ; must be in synchronized block while ( i has next ( ) ) { foo ( i next ( ) ) ; } } } failure to follow this advice may result in non - deterministic behavior the returned queue will be serializable if the specified queue is serializable

public static < e > queue < e > synchronized queue ( queue < e > queue ) { return synchronized queue ( queue , null ) ; }


public long get tinker rom space ( ) { share tinker log e ( tag , " [ - ] ignore this invocation since i ' m no - op version " ) ; return 0 ; }


returns true if we ' ve parsed a complete frame

public boolean is complete ( ) { return is complete ; }


create a default view to be used for tabs this is called if a custom tab view is not set via { @ link # set custom tab view ( int , int ) }

protected text view create default tab view ( context context ) { text view text view = new text view ( context ) ; text view set gravity ( gravity center ) ; text view set text size ( typed value complex unit sp , tab view text size sp ) ; text view set typeface ( typeface default bold ) ; text view set layout params ( new linear layout layout params ( view group layout params wrap content , view group layout params wrap content ) ) ; typed value out value = new typed value ( ) ; get context ( ) get theme ( ) resolve attribute ( android r attr selectable item background , out value , true ) ; text view set background resource ( out value resource id ) ; text view set all caps ( true ) ; int padding = ( int ) ( tab view padding dips * get resources ( ) get display metrics ( ) density ) ; text view set padding ( padding , padding , padding , padding ) ; return text view ; }


public int count ( ) { int count = 0 ; for ( list < consumer record < k , v > > recs : this records values ( ) ) count + = recs size ( ) ; return count ; }


create a new instance of a class with a defined factory

public static writable new instance ( class < ? extends writable > c ) { return new instance ( c , null ) ; }


convert an rest request method array to a string array , so it can be compared with the expected ' allow ' header string array

private list < string > get method name string array ( list < rest request method > method array ) { return method array stream ( ) map ( method - > method to string ( ) ) collect ( collectors to list ( ) ) ; }


test fail all the datanodes except first in the pipeline

public void test with only first datanode is alive ( ) throws exception { test write file and verify after d n stop ( 1 , 1 , 1 , true ) ; }


wrap a class name this is the same as calling < code > on ( class for name ( name ) ) < code >

public static reflect on ( string name ) throws reflect exception { return on ( for name ( name ) ) ; }


tests that it can get the task manager location in an execution

public void test get task manager location when scheduled ( ) throws exception { final job vertex job vertex = execution graph test utils create no op vertex ( 1 ) ; final testing logical slot testing logical slot = new testing logical slot builder ( ) create testing logical slot ( ) ; final execution graph eg = execution graph test utils create simple test graph ( job vertex ) ; final execution graph to inputs locations retriever adapter inputs locations retriever = new execution graph to inputs locations retriever adapter ( eg ) ; final execution vertex only execution vertex = eg get all execution vertices ( ) iterator ( ) next ( ) ; only execution vertex deploy to slot ( testing logical slot ) ; execution vertex i d execution vertex id = new execution vertex i d ( job vertex get i d ( ) , 0 ) ; optional < completable future < task manager location > > task manager location optional = inputs locations retriever get task manager location ( execution vertex id ) ; assert true ( task manager location optional is present ( ) ) ; final completable future < task manager location > task manager location future = task manager location optional get ( ) ; assert that ( task manager location future get ( ) , is ( testing logical slot get task manager location ( ) ) ) ; }


adds the given toolchains as requirements for this aspect

public builder add required toolchains ( label toolchain labels ) { iterables add all ( this required toolchains , lists new array list ( toolchain labels ) ) ; return this ; }


takes an input set of argument values and converts them to the types specified as the required parameter types the arguments are converted ' in - place ' in the input array

static boolean convert arguments ( type converter converter , object [ ] arguments , executable executable , @ nullable integer varargs position ) throws evaluation exception { boolean conversion occurred = false ; if ( varargs position = = null ) { for ( int i = 0 ; i < arguments length ; i + + ) { type descriptor target type = new type descriptor ( method parameter for executable ( executable , i ) ) ; object argument = arguments [ i ] ; arguments [ i ] = converter convert value ( argument , type descriptor for object ( argument ) , target type ) ; conversion occurred | = ( argument ! = arguments [ i ] ) ; } } else { / / convert everything up to the varargs position for ( int i = 0 ; i < varargs position ; i + + ) { type descriptor target type = new type descriptor ( method parameter for executable ( executable , i ) ) ; object argument = arguments [ i ] ; arguments [ i ] = converter convert value ( argument , type descriptor for object ( argument ) , target type ) ; conversion occurred | = ( argument ! = arguments [ i ] ) ; } method parameter method param = method parameter for executable ( executable , varargs position ) ; if ( varargs position = = arguments length - 1 ) { / / if the target is varargs and there is just one more argument / / then convert it here type descriptor target type = new type descriptor ( method param ) ; object argument = arguments [ varargs position ] ; type descriptor source type = type descriptor for object ( argument ) ; arguments [ varargs position ] = converter convert value ( argument , source type , target type ) ; / / three outcomes of that previous line : / / 1 ) the input argument was already compatible ( ie array of valid type ) and nothing was done / / 2 ) the input argument was correct type but not in an array so it was made into an array / / 3 ) the input argument was the wrong type and got converted and put into an array if ( argument ! = arguments [ varargs position ] & & ! is first entry in array ( argument , arguments [ varargs position ] ) ) { conversion occurred = true ; / / case 3 } } else { / / convert remaining arguments to the varargs element type type descriptor target type = new type descriptor ( method param ) get element type descriptor ( ) ; assert state ( target type ! = null , " no element type " ) ; for ( int i = varargs position ; i < arguments length ; i + + ) { object argument = arguments [ i ] ; arguments [ i ] = converter convert value ( argument , type descriptor for object ( argument ) , target type ) ; conversion occurred | = ( argument ! = arguments [ i ] ) ; } } } return conversion occurred ; }


output directory structure to a file , each line of the file contains the directory name only empty directory names are printed

private void output ( file out file ) throws file not found exception { system out println ( " printing to " + out file to string ( ) ) ; print stream out = new print stream ( out file ) ; root output ( out , null ) ; out close ( ) ; }


test serialization of object with outer number type

public void fake outer composite serialize test ( ) throws api exception { outer composite body = null ; outer composite response = api fake outer composite serialize ( body ) ; / / todo : test validations }


required the hosts associated with the service entry could be a dns name with wildcard prefix 1 the hosts field is used to select matching hosts in virtual services and destination rules 2 for http traffic the http host authority header will be matched against the hosts field 3 for h t t ps or tls traffic containing server name indication ( sni ) , the sni value will be matched against the hosts field note that when resolution is set to type dns and no endpoints are specified , the host field will be used as the dns name of the endpoint to route traffic to < code > repeated string hosts = 1 ; < code >

public builder add all hosts ( java lang iterable < java lang string > values ) { ensure hosts is mutable ( ) ; com google protobuf abstract message lite builder add all ( values , hosts ) ; on changed ( ) ; return this ; }


return { @ code true } if http header validation should be performed

protected boolean is validate http headers ( ) { return validate http headers ; }


copies the contents of src to dst , starting from src [ src offset ] , copying num elements elements the { @ link buffer } instance ' s { @ link buffer # position ( ) } is used to define the offset into the buffer itself the position and limit will stay the same < b > the buffer must be a direct buffer with native byte order no error checking is performed < b >

public static void copy ( char [ ] src , int src offset , int num elements , buffer dst ) { char buffer buffer = null ; if ( dst instanceof byte buffer ) buffer = ( ( byte buffer ) dst ) as char buffer ( ) ; else if ( dst instanceof char buffer ) buffer = ( char buffer ) dst ; if ( buffer = = null ) throw new gdx runtime exception ( " dst must be a byte buffer or char buffer " ) ; int old position = buffer position ( ) ; buffer put ( src , src offset , num elements ) ; buffer position ( old position ) ; }


check the cache for an entry if it does not exist , add the request as in progress

public cache entry check or add to cache ( inet address client id , int xid ) { client request req = new client request ( client id , xid ) ; cache entry e ; synchronized ( map ) { e = map get ( req ) ; if ( e = = null ) { / / add an inprogress cache entry map put ( req , new cache entry ( ) ) ; } } return e ; }


parses bodies of the kind < code > { " fieldname 1 " : { " origin " : " some value " , " scale " : " some value " } , " multi value mode " : " min " } < code >

public dfb from x content ( x content parser parser ) throws i o exception , parsing exception { string current field name ; x content parser token token ; multi value mode multi value mode = decay function builder default multi value mode ; string field name = null ; bytes reference function bytes = null ; while ( ( token = parser next token ( ) ) = = x content parser token field name ) { current field name = parser current name ( ) ; token = parser next token ( ) ; if ( token = = x content parser token start object ) { field name = current field name ; x content builder builder = x content factory json builder ( ) ; builder copy current structure ( parser ) ; function bytes = bytes reference bytes ( builder ) ; } else if ( multi value mode match ( current field name , parser get deprecation handler ( ) ) ) { multi value mode = multi value mode from string ( parser text ( ) ) ; } else { throw new parsing exception ( parser get token location ( ) , " malformed score function score parameters " ) ; } } if ( field name = = null | | function bytes = = null ) { throw new parsing exception ( parser get token location ( ) , " malformed score function score parameters " ) ; } dfb function builder = create from bytes apply ( field name , function bytes ) ; function builder set multi value mode ( multi value mode ) ; return function builder ; }


since snapshots need to be uniquely named , this method will resolve any date math used in the provided name , as well as appending a unique identifier so expressions that may overlap still result in unique snapshot names

public static string generate snapshot name ( string name ) { return generate snapshot name ( name , new resolver context ( ) ) ; }


public container id get container id ( ) { return container id from string ( datum get container id ( ) to string ( ) ) ; }


returns the mask and value for all instructions , combined into one binary string

public string get combined string ( ) { return get all masks ( ) to binary string ( ) ; }


creates a change of type update as a result of this change the { @ link component } c substitute the current component rendered at index in the context of the { @ link diff section spec } creating this change

static change update ( int index , render info render info , @ nullable object prev data , @ nullable object next data ) { return acquire singular change ( update , index , render info , prev data , next data ) ; }


get the pitch euler angle in degrees , which is the rotation around the x axis requires that this quaternion is normalized

public float get pitch ( ) { return get pitch rad ( ) * math utils radians to degrees ; }


subclasses can use this to add information that isn ' t always in the capabilities map

protected int amend hash code ( ) { return 0 ; }


derive a temporary directory path based on the path to the output jar , to avoid breaking fragile assumptions made by the implementation of javahotswap

static path derive directory ( string label , string output jar , string suffix ) throws i o exception { check argument ( label ! = null , " - - target label is required " ) ; check argument ( output jar ! = null , " - - output is required " ) ; check argument ( label contains ( " : " ) , " - - target label must be a canonical label ( containing a ` : ` ) " ) ; path path = paths get ( output jar ) ; string name = more files get name without extension ( path ) ; string base = label substring ( label last index of ( ' : ' ) + 1 ) ; return path resolve sibling ( " javac " ) resolve ( base ) resolve ( name + suffix ) ; }


public string get property class ( ) { return property class ; }


return the actual data length of the blob with the specified properties if it is a page blob , you can ' t rely on the length from the properties argument and you must get it from the file otherwise , you can

private long get data length ( cloud blob wrapper blob , blob properties properties ) throws azure exception { if ( blob instanceof cloud page blob wrapper ) { try { return page blob input stream get page blob data size ( ( cloud page blob wrapper ) blob , get instrumented context ( is concurrent o o b append allowed ( ) ) ) ; } catch ( exception e ) { throw new azure exception ( " unexpected exception getting page blob actual data size " , e ) ; } } return properties get length ( ) ; }


public boolean is constant ( ) { return false ; }


public void write to ( annotated output out , dalv insn insn ) { register spec list regs = insn get registers ( ) ; long value = ( ( cst literal 6 4 ) ( ( cst insn ) insn ) get constant ( ) ) get long bits ( ) ; write ( out , opcode unit ( insn , regs get ( 0 ) get reg ( ) ) , value ) ; }


return the { @ code data } field of this event , if available

public t data ( ) { return this data ; }


current size of { @ link blocking queue } used by the thread - pool

public number get current queue size ( ) { return thread pool get queue ( ) size ( ) ; }


verifies that { @ code key } and { @ code value } are non - null , and returns a new immutable entry with those values a call to { @ link entry # set value } on the returned entry will always throw { @ link unsupported operation exception }

static < k , v > entry < k , v > entry of ( k key , v value ) { check entry not null ( key , value ) ; return new abstract map simple immutable entry < > ( key , value ) ; }


calculates and returns the measured value


attempts to merge all tag changes between my and latest any conflicts will be stored in { @ link # tag conflicts } for later resolution

private void auto merge ( ) throws i o exception { / / / / get the tag managers for each of the program versions / / function manager d b my function manager d b = ( function manager d b ) my program get function manager ( ) ; function tag manager d b tag manager m y = ( function tag manager d b ) my function manager d b get function tag manager ( ) ; function manager d b latest function manager d b = ( function manager d b ) latest program get function manager ( ) ; function tag manager d b tag manager l a t e s t = ( function tag manager d b ) latest function manager d b get function tag manager ( ) ; function manager d b result function manager d b = ( function manager d b ) result program get function manager ( ) ; function tag manager d b tag manager r e s u l t = ( function tag manager d b ) result function manager d b get function tag manager ( ) ; function manager d b original function manager d b = ( function manager d b ) original program get function manager ( ) ; function tag manager d b tag manager o r i g i n a l = ( function tag manager d b ) original function manager d b get function tag manager ( ) ; / / get the i ds for all changes ( adds / edits / deletes ) we have to process note that / / the ' change ' lists contain both edits and deletes ; so we have to separate them / / into their own lists below long [ ] my addition i ds = my changes get tag creations ( ) ; long [ ] my change i ds = my changes get tag changes ( ) ; long [ ] latest addition i ds = latest changes get tag creations ( ) ; long [ ] latest change i ds = latest changes get tag changes ( ) ; list < long > my edited i ds = get edits ( my change i ds , tag manager m y , tag manager o r i g i n a l ) ; list < long > latest edited i ds = get edits ( latest change i ds , tag manager l a t e s t , tag manager o r i g i n a l ) ; list < long > my deleted i ds = get deletes ( my change i ds , tag manager m y , tag manager o r i g i n a l ) ; list < long > latest deleted i ds = get deletes ( latest change i ds , tag manager l a t e s t , tag manager o r i g i n a l ) ; / / now do the actual merging int transaction i d = result program start transaction ( get description ( ) ) ; try { merge additions ( tag manager m y , tag manager l a t e s t , tag manager r e s u l t , my addition i ds , latest addition i ds ) ; merge deletions ( tag manager r e s u l t , my edited i ds , latest edited i ds , my deleted i ds , latest deleted i ds ) ; merge edits ( tag manager m y , tag manager l a t e s t , tag manager r e s u l t , my edited i ds , latest edited i ds , latest deleted i ds ) ; } finally { result program end transaction ( transaction i d , true ) ; } }


find the type of the < code > target col < code > if the target col not exist , return null

public static type information < ? > find col type ( table schema table schema , string target col ) { int index = find col index ( table schema get field names ( ) , target col ) ; return index = = - 1 ? null : table schema get field types ( ) [ index ] ; }


public void clear ( ) { classes clear ( ) ; }


adds a start tag and end tag around the entire text

public final void wrap by ( string start tag , string end tag ) { add markup ( 0 , length ( ) , start tag , end tag ) ; }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


public void test json form data test ( ) { string param = null ; string param 2 = null ; / / api test json form data ( param , param 2 ) ; / / todo : test validations }


verify that access acl does not get inherited on newly created subdirfile

public void test access acl not inherited ( ) throws i o exception { path parent = new path ( " / test access acl not inherited " ) ; hdfs mkdirs ( parent ) ; / / parent have both access acl and default acl list < acl entry > acls = lists new array list ( acl entry ( default , user , " foo " , read execute ) , acl entry ( access , user , read write ) , acl entry ( access , group , read ) , acl entry ( access , other , read ) , acl entry ( access , user , " bar " , all ) ) ; hdfs set acl ( parent , acls ) ; path child dir = new path ( parent , " child dir " ) ; hdfs mkdirs ( child dir ) ; / / subdirectory should only have the default acl inherited acl entry [ ] child dir expected acl = new acl entry [ ] { acl entry ( access , user , " foo " , read execute ) , acl entry ( access , group , read ) , acl entry ( default , user , read write ) , acl entry ( default , user , " foo " , read execute ) , acl entry ( default , group , read ) , acl entry ( default , mask , read execute ) , acl entry ( default , other , read ) } ; acl status child dir acl = hdfs get acl status ( child dir ) ; assert array equals ( child dir expected acl , child dir acl get entries ( ) to array ( ) ) ; path child file = new path ( parent , " child file " ) ; hdfs create ( child file ) close ( ) ; / / sub file should only have the default acl inherited acl entry [ ] child file expected acl = new acl entry [ ] { acl entry ( access , user , " foo " , read execute ) , acl entry ( access , group , read ) } ; acl status child file acl = hdfs get acl status ( child file ) ; assert array equals ( child file expected acl , child file acl get entries ( ) to array ( ) ) ; hdfs delete ( parent , true ) ; }


create a kafka topic with given partition and a replication factor of 1

public void create topic ( string topic , int partitions ) { create topic ( topic , partitions , 1 , new hash map < > ( ) ) ; }


prepares for a check that the subject is deadline within the given tolerance of an expected value that will be provided in the next call in the fluent chain

public tolerant deadline comparison is within ( final long delta , final time unit time unit ) { return new tolerant deadline comparison ( ) { @ override public void of ( deadline expected ) { deadline actual = deadline subject this actual ; check not null ( actual , " actual value cannot be null expected = % s " , expected ) ; / / this is probably overkill , but easier than thinking about overflow big integer actual time remaining = big integer value of ( actual time remaining ( nanoseconds ) ) ; big integer expected time remaining = big integer value of ( expected time remaining ( nanoseconds ) ) ; big integer delta nanos = big integer value of ( time unit to nanos ( delta ) ) ; if ( actual time remaining subtract ( expected time remaining ) abs ( ) compare to ( delta nanos ) > 0 ) { fail without actual ( fact ( " expected " , expected ) , fact ( " but was " , actual ) , fact ( " outside tolerance in ns " , delta nanos ) ) ; } } } ; } / / todo ( carl - mastrangelo ) : add a is not within method once there is need for one currently there / / is no such method since there is no code that uses it , and would lower our coverage numbers


returns number of parameters in { @ link parameter tool }

public int get number of parameters ( ) { return data size ( ) ; }


returns { @ code true } if and only if the specified message can be encoded by this codec

public boolean accept outbound message ( object msg ) throws exception { return outbound msg matcher match ( msg ) ; }


returns the { @ code type information } for the elements of the input

public type information < in > get input type ( ) { return input get output type ( ) ; }


the name of the resource ( in the form package : typename ) < code > optional string resource name = 1 ; < code >

private void clear resource name ( ) { bit field 0 = ( bit field 0 & ~ 0x 0 0 0 0 0 0 0 1 ) ; resource name = get default instance ( ) get resource name ( ) ; }


returns the local checkpoint of the safe commit this value is used to calculate the min required generation for recovery

public synchronized long get local checkpoint of safe commit ( ) { return local checkpoint of safe commit ; }


test " read ops " ( e g list , list status ) on internal dirs of mount table these operations should succeed

public void test list on internal dirs of mount table ( ) throws i o exception { / / list on slash file status [ ] dir paths = fc view util ( ) list status ( new path ( " / " ) ) ; file status fs ; assert assert equals ( 7 , dir paths length ) ; fs = file context test helper contains path ( fc view , " / user " , dir paths ) ; assert assert not null ( fs ) ; assert assert true ( " a mount should appear as symlink " , fs is symlink ( ) ) ; fs = file context test helper contains path ( fc view , " / data " , dir paths ) ; assert assert not null ( fs ) ; assert assert true ( " a mount should appear as symlink " , fs is symlink ( ) ) ; fs = file context test helper contains path ( fc view , " / internal dir " , dir paths ) ; assert assert not null ( fs ) ; assert assert true ( " internal dirs should appear as dir " , fs is directory ( ) ) ; fs = file context test helper contains path ( fc view , " / dangling link " , dir paths ) ; assert assert not null ( fs ) ; assert assert true ( " a mount should appear as symlink " , fs is symlink ( ) ) ; fs = file context test helper contains path ( fc view , " / link to a file " , dir paths ) ; assert assert not null ( fs ) ; assert assert true ( " a mount should appear as symlink " , fs is symlink ( ) ) ; / / list on internal dir dir paths = fc view util ( ) list status ( new path ( " / internal dir " ) ) ; assert assert equals ( 2 , dir paths length ) ; fs = file context test helper contains path ( fc view , " / internal dir / internal dir 2 " , dir paths ) ; assert assert not null ( fs ) ; assert assert true ( " internal dirs should appear as dir " , fs is directory ( ) ) ; fs = file context test helper contains path ( fc view , " / internal dir / link to dir 2 " , dir paths ) ; assert assert not null ( fs ) ; assert assert true ( " a mount should appear as symlink " , fs is symlink ( ) ) ; }


this test also serves to test { @ link h a util # get proxies for all name nodes in nameservice ( configuration , string ) } and { @ link d f s util # get rpc addresses for nameservice id ( configuration , string , string ) } by virtue of the fact that it wouldn ' t work properly if the proxies returned were not for the correct n ns

public void test is at least one active ( ) throws exception { mini d f s cluster cluster = new mini d f s cluster builder ( new hdfs configuration ( ) ) nn topology ( mini d f s n n topology simple h a topology ( ) ) num data nodes ( 0 ) build ( ) ; try { configuration conf = new hdfs configuration ( ) ; h a test util set failover configurations ( cluster , conf ) ; list < client protocol > namenodes = h a util get proxies for all name nodes in nameservice ( conf , h a test util get logical hostname ( cluster ) ) ; assert equals ( 2 , namenodes size ( ) ) ; assert false ( h a util is at least one active ( namenodes ) ) ; cluster transition to active ( 0 ) ; assert true ( h a util is at least one active ( namenodes ) ) ; cluster transition to standby ( 0 ) ; assert false ( h a util is at least one active ( namenodes ) ) ; cluster transition to active ( 1 ) ; assert true ( h a util is at least one active ( namenodes ) ) ; cluster transition to standby ( 1 ) ; assert false ( h a util is at least one active ( namenodes ) ) ; } finally { if ( cluster ! = null ) { cluster shutdown ( ) ; } } }


public void delete pet ( long pet id , string api key ) throws api exception { object local var post body = null ; / / verify the required parameter ' pet id ' is set if ( pet id = = null ) { throw new api exception ( 400 , " missing the required parameter ' pet id ' when calling delete pet " ) ; } / / create path and map variables string local var path = " / pet / { pet id } " replace all ( " \ \ { " + " pet id " + " \ \ } " , api client escape string ( pet id to string ( ) ) ) ; / / query params list < pair > local var query params = new array list < pair > ( ) ; list < pair > local var collection query params = new array list < pair > ( ) ; map < string , string > local var header params = new hash map < string , string > ( ) ; map < string , string > local var cookie params = new hash map < string , string > ( ) ; map < string , object > local var form params = new hash map < string , object > ( ) ; if ( api key ! = null ) local var header params put ( " api key " , api client parameter to string ( api key ) ) ; final string [ ] local var accepts = { } ; final string local var accept = api client select header accept ( local var accepts ) ; final string [ ] local var content types = { } ; final string local var content type = api client select header content type ( local var content types ) ; string [ ] local var auth names = new string [ ] { " petstore auth " } ; api client invoke a p i ( local var path , " delete " , local var query params , local var collection query params , local var post body , local var header params , local var cookie params , local var form params , local var accept , local var content type , local var auth names , null ) ; }


this is a regression test for bug # 1013874 , in which the temp artifacts ( ii and s ) were not being reported as having been created within a failing target it ' s possible that one or more temps were successfully created , even if the compilation failed

public void test failed target with save temps ( ) throws exception { write ( " bad clib / build " , " cc library ( name = ' bad clib ' , srcs = [ ' badlib cc ' ] ) \ n " ) ; / / trigger a warning to make the build fail : / / " control reaches end of non - void function [ - werror , - wreturn - type ] " write ( " bad clib / badlib cc " , " int f ( ) { } " ) ; / / we need to set - - keep going so that the temps get built even though the compilation fails add options ( " - - save temps " , " - - keep going " ) ; build ( true , " compilation of rule ' / / bad clib : bad clib ' failed " , " / / bad clib " ) ; string stderr = rec out err err as latin 1 ( ) ; assert that ( stderr ) contains ( " target / / bad clib : bad clib failed to build " ) ; assert that ( stderr ) contains ( " see temp at blaze - bin / bad clib / objs / bad clib / badlib pic ii \ n " ) ; }


determine whether the given two { @ link connection } s are equal , asking the target { @ link connection } in case of a proxy used to detect equality even if the user passed in a raw target connection while the held one is a proxy

private static boolean connection equals ( connection holder con holder , connection passed in con ) { if ( ! con holder has connection ( ) ) { return false ; } connection held con = con holder get connection ( ) ; / / explicitly check for identity too : for connection handles that do not implement / / " equals " properly ) return ( held con = = passed in con | | held con equals ( passed in con ) | | get target connection ( held con ) equals ( passed in con ) ) ; }


creates a { @ link table function } instance

table function < t > create table function ( ) ;


public collection < type handler < ? > > get type handlers ( ) { return collections unmodifiable collection ( all type handlers map values ( ) ) ; }


sets the image on which the filter should be applied

public void set image ( final bitmap bitmap ) { current bitmap = bitmap ; renderer set image bitmap ( bitmap , false ) ; request render ( ) ; }


public void set naming policy ( naming policy naming policy ) { if ( naming policy = = null ) naming policy = default naming policy instance ; this naming policy = naming policy ; }


submits a flink sql update statement such as insert into

program target descriptor execute update ( string session id , string statement ) throws sql execution exception ;


public void prefix string test ( ) { / / todo : test prefix string }


returns { @ link symbol records } component for this database interface

public symbol records get symbol records ( ) { return symbol records ; }


computes the new instruction offset for the instruction at the given offset

private int new instruction offset ( int old instruction offset ) { if ( old instruction offset < 0 | | old instruction offset > code length ) { throw new illegal argument exception ( " invalid instruction offset [ " + old instruction offset + " ] in code with length [ " + code length + " ] " ) ; } return new instruction offsets [ old instruction offset ] ; }


synchronously gets all the ephemeral nodes created by this session

public list < string > get ephemerals ( ) throws keeper exception , interrupted exception { return get ephemerals ( " / " ) ; }


specify the parallelism level default is { @ link runtime # available processors ( ) }

public void set parallelism ( int parallelism ) { this parallelism = parallelism ; }


handle the case of a saveable property type

public void visit ( saveable value 1 ) { throw new runtime exception ( ) ; }


decodes lzw image data into pixel array adapted from john cristy ' s bitmap magick

private void decode bitmap data ( gif frame frame ) { if ( frame ! = null ) { / / jump to the frame start position raw data position ( frame buffer frame start ) ; } int npix = ( frame = = null ) ? header width * header height : frame iw * frame ih ; int available , clear , code mask , code size , end of information , in code , old code , bits , code , count , i , datum , data size , first , top , bi , pi ; if ( main pixels = = null | | main pixels length < npix ) { / / allocate new pixel array main pixels = bitmap provider obtain byte array ( npix ) ; } byte [ ] main pixels = this main pixels ; if ( prefix = = null ) { prefix = new short [ max stack size ] ; } short [ ] prefix = this prefix ; if ( suffix = = null ) { suffix = new byte [ max stack size ] ; } byte [ ] suffix = this suffix ; if ( pixel stack = = null ) { pixel stack = new byte [ max stack size + 1 ] ; } byte [ ] pixel stack = this pixel stack ; / / initialize gif data stream decoder data size = read byte ( ) ; clear = 1 < < data size ; end of information = clear + 1 ; available = clear + 2 ; old code = null code ; code size = data size + 1 ; code mask = ( 1 < < code size ) - 1 ; for ( code = 0 ; code < clear ; code + + ) { / / xxx array index out of bounds exception prefix [ code ] = 0 ; suffix [ code ] = ( byte ) code ; } byte [ ] block = this block ; / / decode gif pixel stream i = datum = bits = count = first = top = pi = bi = 0 ; while ( i < npix ) { / / read a new data block if ( count = = 0 ) { count = read block ( ) ; if ( count < = 0 ) { status = status partial decode ; break ; } bi = 0 ; } datum + = ( ( ( int ) block [ bi ] ) & mask int lowest byte ) < < bits ; bits + = 8 ; + + bi ; - - count ; while ( bits > = code size ) { / / get the next code code = datum & code mask ; datum > > = code size ; bits - = code size ; / / interpret the code if ( code = = clear ) { / / reset decoder code size = data size + 1 ; code mask = ( 1 < < code size ) - 1 ; available = clear + 2 ; old code = null code ; continue ; } else if ( code = = end of information ) { break ; } else if ( old code = = null code ) { main pixels [ pi ] = suffix [ code ] ; + + pi ; + + i ; old code = code ; first = code ; continue ; } in code = code ; if ( code > = available ) { pixel stack [ top ] = ( byte ) first ; + + top ; code = old code ; } while ( code > = clear ) { pixel stack [ top ] = suffix [ code ] ; + + top ; code = prefix [ code ] ; } first = ( ( int ) suffix [ code ] ) & mask int lowest byte ; main pixels [ pi ] = ( byte ) first ; + + pi ; + + i ; while ( top > 0 ) { / / pop a pixel off the pixel stack main pixels [ pi ] = pixel stack [ - - top ] ; + + pi ; + + i ; } / / add a new string to the string table if ( available < max stack size ) { prefix [ available ] = ( short ) old code ; suffix [ available ] = ( byte ) first ; + + available ; if ( ( ( available & code mask ) = = 0 ) & & ( available < max stack size ) ) { + + code size ; code mask + = available ; } } old code = in code ; } } / / clear missing pixels arrays fill ( main pixels , pi , npix , ( byte ) color transparent black ) ; }


allows to choose a method when stubbing in do throw ( ) | do answer ( ) | do nothing ( ) | do return ( ) style example : < pre class = " code " > < code class = " java " > do throw ( new runtime exception ( ) ) when ( mocked list ) clear ( ) ; following throws runtime exception : mocked list clear ( ) ; < code > read more about those methods : { @ link mockito # do throw ( throwable [ ] ) } { @ link mockito # do answer ( answer ) } { @ link mockito # do nothing ( ) } { @ link mockito # do return ( object ) } see examples in javadoc for { @ link mockito }


litho handles addingremoving views automatically using mountunmount calls manually adding removing views will mess up litho ' s bookkeeping of added views and cause weird crashes down the line

public void remove all views in layout ( ) { throw new unsupported operation exception ( " removing views manually within litho views is not supported " ) ; }


gets the remaining splits that this assigner has pending


public mongo client get mongo client ( ) { return mongo client ; }


compares the keys , values , headers , and timestamp of two { @ link producer record } ' s and throws an { @ link assertion error } if the keys , values , headers , or timestamps are not equal to each other

public static < k , v > void compare key value headers timestamp ( final producer record < k , v > record , final producer record < k , v > expected record ) throws assertion error { objects require non null ( expected record ) ; compare key value headers timestamp ( record , expected record key ( ) , expected record value ( ) , expected record headers ( ) , expected record timestamp ( ) ) ; }


public void add next value ( object val ) { if ( this num items < = this max num items ) { uniq items put ( val to string ( ) , " 1 " ) ; this num items = this uniq items size ( ) ; } }


specify a custom prefix to use for this view ' s json output default is none

public void set json prefix ( string json prefix ) { this json prefix = json prefix ; }


public list < list < big decimal > > get array array number ( ) { return array array number ; }


public i ttl time provider get time provider ( ) { return time provider ; }


check if a node is in the current view with static membership , the result of this check will never change ; only when dynamic membership is introduced will this be more useful

public boolean view contains ( long sid ) { return this get view ( ) contains key ( sid ) ; }


is cas authentication old for max age authorization request boolean

public static boolean is cas authentication old for max age authorization request ( final web context context , final zoned date time authentication date ) { val max age = get oidc max age from authorization request ( context ) ; if ( max age is present ( ) & & max age get ( ) > 0 ) { val now = zoned date time now ( zone offset utc ) to epoch second ( ) ; val auth time = authentication date to epoch second ( ) ; val diff in seconds = now - auth time ; if ( diff in seconds > max age get ( ) ) { logger info ( " authentication is too old : [ { } ] and was created [ { } ] seconds ago " , auth time , diff in seconds ) ; return true ; } } return false ; }


sets { @ link { @ link collector component builder # sampler ( collector sampler ) } }

public builder sampler ( collector sampler sampler ) { if ( sampler = = null ) throw new null pointer exception ( " sampler = = null " ) ; this sampler = sampler ; return this ; }


initialize the cluster , wait for it to become active , and get file system

private void init cluster ( boolean format , boolean acls enabled ) throws exception { configuration conf = new configuration ( ) ; conf set boolean ( d f s config keys dfs namenode acls enabled key , acls enabled ) ; cluster = new mini d f s cluster builder ( conf ) num data nodes ( 1 ) format ( format ) build ( ) ; cluster wait active ( ) ; fs = cluster get file system ( ) ; }


helper function that verified blocks of a file are placed on the expected storage type

public static boolean verify file replicas on storage type ( file system fs , d f s client client , path path , storage type storage type ) throws i o exception { if ( ! fs exists ( path ) ) { log info ( " verify file replicas on storage type : file " + path + " does not exist " ) ; return false ; } long file length = client get file info ( path to string ( ) ) get len ( ) ; located blocks located blocks = client get located blocks ( path to string ( ) , 0 , file length ) ; for ( located block located block : located blocks get located blocks ( ) ) { if ( located block get storage types ( ) [ 0 ] ! = storage type ) { log info ( " verify file replicas on storage type : for file " + path + " expect blk " + located block + " on type : " + storage type + " actual type : " + located block get storage types ( ) [ 0 ] ) ; return false ; } } return true ; }


computes the upcean checksum on a string of digits , and reports whether the checksum is correct or not

static boolean check standard u p c e a n checksum ( char sequence s ) throws format exception { int length = s length ( ) ; if ( length = = 0 ) { return false ; } int check = character digit ( s char at ( length - 1 ) , 10 ) ; return get standard u p c e a n checksum ( s sub sequence ( 0 , length - 1 ) ) = = check ; }


register a listener that will be called when this model visibility has changed the listener will contribute to this model ' s hash code state per the { @ link com airbnb epoxy epoxy attribute option # do not hash } rules

public test field prop generate string overloads option view model on visibility changed ( on model visibility changed listener < test field prop generate string overloads option view model , test field prop generate string overloads option view > listener ) { on mutation ( ) ; this on model visibility changed listener epoxy generated model = listener ; return this ; }


verify whether quota usage cache in router quota manager is updated properly { @ link router quota update service # periodic invoke ( ) } should be able to update the cache even if the destination directory for some mount entry is not present in the filesystem

public void test quota refresh when destination not present ( ) throws exception { long ns quota = 5 ; long ss quota = 3 * block size ; final file system nn fs = nn context 1 get file system ( ) ; / / add three mount tables : / / / setdir 1 - - > ns 0 - - - testdir 1 3 / / / setdir 2 - - > ns 0 - - - testdir 1 4 / / create destination directory nn fs mkdirs ( new path ( " / testdir 1 3 " ) ) ; nn fs mkdirs ( new path ( " / testdir 1 4 " ) ) ; mount table mount table = mount table new instance ( " / setdir 1 " , collections singleton map ( " ns 0 " , " / testdir 1 3 " ) ) ; mount table set quota ( new router quota usage builder ( ) quota ( ns quota ) space quota ( ss quota ) build ( ) ) ; add mount table ( mount table ) ; mount table = mount table new instance ( " / setdir 2 " , collections singleton map ( " ns 0 " , " / testdir 1 4 " ) ) ; mount table set quota ( new router quota usage builder ( ) quota ( ns quota ) space quota ( ss quota ) build ( ) ) ; add mount table ( mount table ) ; final d f s client router client = router context get client ( ) ; / / create file router client create ( " / setdir 1 / file 1 " , true ) close ( ) ; router client create ( " / setdir 2 / file 2 " , true ) close ( ) ; / / append data to the file append data ( " / setdir 1 / file 1 " , router client , block size ) ; append data ( " / setdir 2 / file 2 " , router client , block size ) ; router quota update service update service = router context get router ( ) get quota cache update service ( ) ; / / update quota cache update service periodic invoke ( ) ; / / reload the router cache resolver load cache ( true ) ; client protocol client 1 = nn context 1 get client ( ) get namenode ( ) ; router quota manager quota manager = router context get router ( ) get quota manager ( ) ; quota usage quota 1 = client 1 get quota usage ( " / testdir 1 3 " ) ; quota usage quota 2 = client 1 get quota usage ( " / testdir 1 4 " ) ; quota usage cache quota 1 = quota manager get quota usage ( " / setdir 1 " ) ; quota usage cache quota 2 = quota manager get quota usage ( " / setdir 2 " ) ; / / get quota details in mount table mount table updated mount table = get mount table ( " / setdir 1 " ) ; router quota usage mount quota 1 = updated mount table get quota ( ) ; updated mount table = get mount table ( " / setdir 2 " ) ; router quota usage mount quota 2 = updated mount table get quota ( ) ; / / verify quota usage assert equals ( 2 , quota 1 get file and directory count ( ) ) ; assert equals ( 2 , cache quota 1 get file and directory count ( ) ) ; assert equals ( 2 , mount quota 1 get file and directory count ( ) ) ; assert equals ( 2 , quota 2 get file and directory count ( ) ) ; assert equals ( 2 , cache quota 2 get file and directory count ( ) ) ; assert equals ( 2 , mount quota 2 get file and directory count ( ) ) ; assert equals ( block size , quota 1 get space consumed ( ) ) ; assert equals ( block size , cache quota 1 get space consumed ( ) ) ; assert equals ( block size , mount quota 1 get space consumed ( ) ) ; assert equals ( block size , quota 2 get space consumed ( ) ) ; assert equals ( block size , cache quota 2 get space consumed ( ) ) ; assert equals ( block size , mount quota 2 get space consumed ( ) ) ; file system router fs = router context get file system ( ) ; / / remove file in setdir 1 the target directory still exists router fs delete ( new path ( " / setdir 1 / file 1 " ) , true ) ; / / create file router client create ( " / setdir 2 / file 3 " , true ) close ( ) ; / / append data to the file append data ( " / setdir 2 / file 3 " , router client , block size ) ; int updated space = block size + block size ; / / update quota cache update service periodic invoke ( ) ; quota 2 = client 1 get quota usage ( " / testdir 1 4 " ) ; cache quota 1 = quota manager get quota usage ( " / setdir 1 " ) ; cache quota 2 = quota manager get quota usage ( " / setdir 2 " ) ; / / get quota details in mount table updated mount table = get mount table ( " / setdir 1 " ) ; mount quota 1 = updated mount table get quota ( ) ; updated mount table = get mount table ( " / setdir 2 " ) ; mount quota 2 = updated mount table get quota ( ) ; / / the quota usage should be reset assert equals ( 1 , cache quota 1 get file and directory count ( ) ) ; assert equals ( 1 , mount quota 1 get file and directory count ( ) ) ; assert equals ( 0 , cache quota 1 get space consumed ( ) ) ; assert equals ( 0 , mount quota 1 get space consumed ( ) ) ; / / verify current quota usage for other mount entries assert equals ( 3 , quota 2 get file and directory count ( ) ) ; assert equals ( 3 , cache quota 2 get file and directory count ( ) ) ; assert equals ( 3 , mount quota 2 get file and directory count ( ) ) ; assert equals ( updated space , quota 2 get space consumed ( ) ) ; assert equals ( updated space , cache quota 2 get space consumed ( ) ) ; assert equals ( updated space , mount quota 2 get space consumed ( ) ) ; }


public int read bits ( int num bits ) { int temp byte offset = byte offset ; int bits read = min ( num bits , 8 - bit offset ) ; int return value = ( ( data [ temp byte offset + + ] & 0x f f ) > > bit offset ) & ( 0x f f > > ( 8 - bits read ) ) ; while ( bits read < num bits ) { return value | = ( data [ temp byte offset + + ] & 0x f f ) < < bits read ; bits read + = 8 ; } return value & = 0x f f f f f f f f > > > ( 32 - num bits ) ; skip bits ( num bits ) ; return return value ; }


parse { @ link metric node } from thin string , see { @ link # to thin string ( ) }

public static metric node from thin string ( string line ) { metric node node = new metric node ( ) ; string [ ] strs = line split ( " \ \ | " ) ; node set timestamp ( long parse long ( strs [ 0 ] ) ) ; node set resource ( strs [ 1 ] ) ; node set pass qps ( long parse long ( strs [ 2 ] ) ) ; node set block qps ( long parse long ( strs [ 3 ] ) ) ; node set success qps ( long parse long ( strs [ 4 ] ) ) ; node set exception qps ( long parse long ( strs [ 5 ] ) ) ; node set rt ( long parse long ( strs [ 6 ] ) ) ; if ( strs length > = 8 ) { node set occupied pass qps ( long parse long ( strs [ 7 ] ) ) ; } if ( strs length > = 9 ) { node set concurrency ( integer parse int ( strs [ 8 ] ) ) ; } if ( strs length = = 10 ) { node set classification ( integer parse int ( strs [ 9 ] ) ) ; } return node ; }


returns whether the device time offset has already been loaded if { @ code false } , use { @ link # initialize ( loader , initialization callback ) } to start the initialization

public static boolean is initialized ( ) { synchronized ( value lock ) { return is initialized ; } }


public void remove ( node node ) { if ( node previous ! = null ) { node previous next = node next ; } else { head = node next ; } if ( node next ! = null ) { node next previous = node previous ; } else { end = node previous ; } }


public static void require non nulls ( final object objects ) { if ( objects = = null ) throw new null pointer exception ( ) ; for ( object object : objects ) { if ( object = = null ) throw new null pointer exception ( ) ; } }


test for behavior reported in https : github comelasticelasticsearchissues 3 4 7 0 8 unmapped field can lead to match no docs querys in disjunction queries if tokens are eliminated ( e g because the tokenizer removed them as punctuation ) on regular fields , this can leave only match no docs querys in the disjunction clause instead those disjunctions should be eliminated completely

public void test unmapped field no token with and operator ( ) throws i o exception { query query = new simple query string builder ( " first & second " ) field ( text field name ) field ( " unmapped " ) field ( " another unmapped " ) default operator ( operator and ) to query ( create shard context ( ) ) ; boolean query expected = new boolean query builder ( ) add ( new term query ( new term ( text field name , " first " ) ) , boolean clause occur must ) add ( new term query ( new term ( text field name , " second " ) ) , boolean clause occur must ) build ( ) ; assert equals ( expected , query ) ; query = new simple query string builder ( " first & second " ) field ( " unmapped " ) field ( " another unmapped " ) default operator ( operator and ) to query ( create shard context ( ) ) ; expected = new boolean query builder ( ) add ( new match no docs query ( ) , boolean clause occur must ) add ( new match no docs query ( ) , boolean clause occur must ) add ( new match no docs query ( ) , boolean clause occur must ) build ( ) ; assert equals ( expected , query ) ; }


set the priority ( " x - priority " header ) of the message

public void set priority ( int priority ) throws messaging exception { this mime message set header ( header priority , integer to string ( priority ) ) ; }


order by tenant id ( needs to be followed by { @ link # asc ( ) } or { @ link # desc ( ) } )

dead letter job query order by tenant id ( ) ;


public void show scrubber ( ) { show scrubber ( / * show animation duration ms = * / 0 ) ; }


filterer < ? extends probabilistic threat aware system , ? extends probable threat > filtered ( ) ;


returns the type from super class ' s type parameter in { @ link $ gson $ types # canonicalize canonical form }

static type get superclass type parameter ( class < ? > subclass ) { type superclass = subclass get generic superclass ( ) ; if ( superclass instanceof class ) { throw new runtime exception ( " missing type parameter " ) ; } parameterized type parameterized = ( parameterized type ) superclass ; return $ gson $ types canonicalize ( parameterized get actual type arguments ( ) [ 0 ] ) ; }


returns a declared provider provided by this target only meant to use from starlark

public final info get ( provider key provider key ) { if ( provider key equals ( default info provider get key ( ) ) ) { return get default provider ( ) ; } return raw get starlark provider ( provider key ) ; }


{ @ inherit doc } < b > note : < b > this method ignores how often any element might appear in { @ code c } , and only cares whether or not an element appears at all if you wish to remove one occurrence in this multiset for every occurrence in { @ code c } , see { @ link multisets # retain occurrences ( multiset , multiset ) } this method refines { @ link collection # retain all } to further specify that it < b > may not < b > throw an exception in response to any of { @ code elements } being null or of the wrong type

boolean retain all ( collection < ? > c ) ;


get the number of occurrences of the pattern

public int get num occurrences ( ) { return num occurrences ; }


creates a { @ link bloom filter } with the expected number of insertions and a default expected false positive probability of 3 % note that overflowing a { @ code bloom filter } with significantly more elements than specified , will result in its saturation , and a sharp deterioration of its false positive probability the constructed { @ code bloom filter } will be serializable if the provided { @ code funnel < t > } is it is recommended that the funnel be implemented as a java enum this has the benefit of ensuring proper serialization and deserialization , which is important since { @ link # equals } also relies on object identity of funnels

public static < t > bloom filter < t > create ( funnel < ? super t > funnel , int expected insertions ) { return create ( funnel , ( long ) expected insertions ) ; }


use this server setup to test one { @ code @ controller } at a time this option loads the default configuration of { @ link org springframework web reactive config enable web flux @ enable web flux } there are builder methods to customize the java config the resulting web flux application will be tested without an http server using a mock request and response

static controller spec bind to controller ( object controllers ) { return new default controller spec ( controllers ) ; }


set whether to lazily start a database resource transaction within a spring - managed eclipse link transaction by default , read - only transactions are started lazily but regular non - read - only transactions are started early this allows for reusing the same jdbc connection throughout an entire eclipse link transaction , for enforced isolation and consistent visibility with jdbc access code working on the same data source switch this flag to " true " to enforce a lazy database transaction begin even for non - read - only transactions , allowing access to eclipse link ' s shared cache and following eclipse link ' s connection mode configuration , assuming that isolation and visibility at the jdbc level are less important

public void set lazy database transaction ( boolean lazy database transaction ) { this lazy database transaction = lazy database transaction ; }


sets the configuration properties for the kafka consumer resets previously set properties

public kafka properties ( properties properties ) { preconditions check not null ( properties ) ; if ( this kafka properties = = null ) { this kafka properties = new hash map < > ( ) ; } this kafka properties clear ( ) ; properties for each ( ( k , v ) - > this kafka properties put ( ( string ) k , ( string ) v ) ) ; return this ; }


decodes a byte array into a purgeable bitmap

protected bitmap decode byte array as purgeable ( closeable reference < pooled byte buffer > bytes ref , bitmap factory options options ) { final pooled byte buffer pooled byte buffer = bytes ref get ( ) ; final int length = pooled byte buffer size ( ) ; final closeable reference < byte [ ] > encoded bytes array ref = m flex byte array pool get ( length ) ; try { final byte [ ] encoded bytes array = encoded bytes array ref get ( ) ; pooled byte buffer read ( 0 , encoded bytes array , 0 , length ) ; bitmap bitmap = bitmap factory decode byte array ( encoded bytes array , 0 , length , options ) ; return preconditions check not null ( bitmap , " bitmap factory returned null " ) ; } finally { closeable reference close safely ( encoded bytes array ref ) ; } }


public void add listener ( runnable listener , executor executor ) { check not null ( listener , " runnable was null " ) ; check not null ( executor , " executor was null " ) ; / / checking is done and listeners ! = tombstone may seem redundant , but our contract for / / add listener says that listeners execute ' immediate ' if the future is done ( ) however , our / / protocol for completing a future is to assign the value field ( which sets is done to true ) and / / then to release waiters , followed by executing after done ( ) , followed by releasing listeners / / that means that it is possible to observe that the future is done and that your listeners / / don ' t execute ' immediately ' by checking is done here we avoid that / / a corollary to all that is that we don ' t need to check is done inside the loop because if we / / get into the loop we know that we weren ' t done when we entered and therefore we aren ' t under / / an obligation to execute ' immediately ' if ( ! is done ( ) ) { listener old head = listeners ; if ( old head ! = listener tombstone ) { listener new node = new listener ( listener , executor ) ; do { new node next = old head ; if ( atomic helper cas listeners ( this , old head , new node ) ) { return ; } old head = listeners ; / / re - read } while ( old head ! = listener tombstone ) ; } } / / if we get here then the listener tombstone was set , which means the future is done , call / / the listener execute listener ( listener , executor ) ; }


register web - specific scopes ( " request " , " session " , " global session " , " application " ) with the given bean factory , as used by the web application context

public static void register web application scopes ( configurable listable bean factory bean factory , @ nullable servlet context sc ) { bean factory register scope ( web application context scope request , new request scope ( ) ) ; bean factory register scope ( web application context scope session , new session scope ( ) ) ; if ( sc ! = null ) { servlet context scope app scope = new servlet context scope ( sc ) ; bean factory register scope ( web application context scope application , app scope ) ; / / register as servlet context attribute , for context cleanup listener to detect it sc set attribute ( servlet context scope class get name ( ) , app scope ) ; } bean factory register resolvable dependency ( servlet request class , new request object factory ( ) ) ; bean factory register resolvable dependency ( servlet response class , new response object factory ( ) ) ; bean factory register resolvable dependency ( http session class , new session object factory ( ) ) ; bean factory register resolvable dependency ( web request class , new web request object factory ( ) ) ; if ( jsf present ) { faces dependency registrar register faces dependencies ( bean factory ) ; } }


returns true if the task supports cancellation

public boolean is cancellable ( ) { return cancellable ; }


public void test user ( ) { / / todo : test user }


public void service start ( ) throws i o exception { start storage ( ) ; }


public void test resend ( ) throws exception { final atomic integer flush count = new atomic integer ( ) ; final embedded channel channel = new channel ( flush count , true ) ; channel write and flush ( 1l ) add listener ( new generic future listener < future < ? super void > > ( ) { @ override public void operation complete ( future < ? super void > future ) throws exception { channel write and flush ( 1l ) ; } } ) ; channel flush outbound ( ) ; assert equals ( 1l , channel read outbound ( ) ) ; assert equals ( 1l , channel read outbound ( ) ) ; assert null ( channel read outbound ( ) ) ; assert false ( channel finish ( ) ) ; }


public void date time test ( ) { / / todo : test date time }


helper method to set access token for the first o auth 2 authentication

public void set access token ( string access token ) { for ( authentication auth : authentications values ( ) ) { if ( auth instanceof o auth ) { ( ( o auth ) auth ) set access token ( access token ) ; return ; } } throw new runtime exception ( " no o auth 2 authentication configured ! " ) ; }


get a local file under a directory named by dirs prop with the given path if dirs prop contains multiple directories , then one is chosen based on path ' s hash code if the selected directory does not exist , an attempt is made to create it

public path get local path ( string dirs prop , string path ) throws i o exception { string [ ] dirs = get trimmed strings ( dirs prop ) ; int hash code = path hash code ( ) ; file system fs = file system get local ( this ) ; for ( int i = 0 ; i < dirs length ; i + + ) { / / try each local dir int index = ( hash code + i & integer max value ) % dirs length ; path file = new path ( dirs [ index ] , path ) ; path dir = file get parent ( ) ; if ( fs mkdirs ( dir ) | | fs exists ( dir ) ) { return file ; } } log warn ( " could not make " + path + " in local directories from " + dirs prop ) ; for ( int i = 0 ; i < dirs length ; i + + ) { int index = ( hash code + i & integer max value ) % dirs length ; log warn ( dirs prop + " [ " + index + " ] = " + dirs [ index ] ) ; } throw new i o exception ( " no valid local directories in property : " + dirs prop ) ; }


t deserialize ( byte [ ] message ) throws i o exception ;


create a name from the full kerberos principal name

public static kerberos name parse ( string principal name ) { matcher match = name parser matcher ( principal name ) ; if ( ! match matches ( ) ) { if ( principal name contains ( " @ " ) ) { throw new illegal argument exception ( " malformed kerberos name : " + principal name ) ; } else { return new kerberos name ( principal name , null , null ) ; } } else { return new kerberos name ( match group ( 1 ) , match group ( 3 ) , match group ( 4 ) ) ; } }


writes an info log message containing the parameters only the first 4 elements of the state array are included in the message

void log ( string label , int num dirs , int test case num , boolean [ ] state ) { log info ( " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " ) ; log info ( " * * * test " + ( test counter + + ) + " * * * " + label + " : " + " num dirs = " + num dirs + " test case = " + test case num + " current = " + state [ current exists ] + " previous = " + state [ previous exists ] + " previous tmp = " + state [ previous tmp exists ] + " removed tmp = " + state [ removed tmp exists ] + " should recover = " + state [ should recover ] + " current exists after = " + state [ current should exist after recover ] + " previous exists after = " + state [ previous should exist after recover ] ) ; }


patch another - fakedummy : to test special tags to test special tags and operation id starting with number

response entity < client > call 1 2 3test special tags ( client body ) ;


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


tests that ( un ) chaining affects the node hash ( for intermediate nodes ) a ( chained ) : [ ( src 0 ) - > ( map ) - > ( filter ) - > ( sink ) ] b ( unchained ) : [ ( src 0 ) ] - > [ ( map ) - > ( filter ) - > ( sink ) ] the hashes for the single vertex in a and the source vertex in b need to be different

public void test node hash after intermediate unchaining ( ) throws exception { stream execution environment env = stream execution environment create local environment ( ) ; env set parallelism ( 4 ) ; env add source ( new no op source function ( ) ) map ( new no op map function ( ) ) name ( " map " ) start new chain ( ) filter ( new no op filter function ( ) ) add sink ( new discarding sink < > ( ) ) ; job graph job graph = env get stream graph ( ) get job graph ( ) ; job vertex chained map = job graph get vertices sorted topologically from sources ( ) get ( 1 ) ; assert true ( chained map get name ( ) starts with ( " map " ) ) ; job vertex i d chained map id = chained map get i d ( ) ; env = stream execution environment create local environment ( ) ; env set parallelism ( 4 ) ; env add source ( new no op source function ( ) ) map ( new no op map function ( ) ) name ( " map " ) start new chain ( ) filter ( new no op filter function ( ) ) start new chain ( ) add sink ( new discarding sink < > ( ) ) ; job graph = env get stream graph ( ) get job graph ( ) ; job vertex unchained map = job graph get vertices sorted topologically from sources ( ) get ( 1 ) ; assert equals ( " map " , unchained map get name ( ) ) ; job vertex i d unchained map id = unchained map get i d ( ) ; assert not equals ( chained map id , unchained map id ) ; }


if this project is configured to be always built on this node , return that { @ link node } otherwise null

public @ check for null label get assigned label ( ) { if ( can roam ) return null ; if ( assigned node = = null ) return jenkins get ( ) get self label ( ) ; return jenkins get ( ) get label ( assigned node ) ; }


private insn list convert insns ( array list < ssa insn > ssa insns ) { int insn count = ssa insns size ( ) ; insn list result = new insn list ( insn count ) ; for ( int i = 0 ; i < insn count ; i + + ) { result set ( i , ssa insns get ( i ) to rop insn ( ) ) ; } result set immutable ( ) ; return result ; }


sets the { @ link menu data } to be used to put this action in the tool ' s popup menu

public void set popup menu data ( menu data new menu data ) { popup menu data old data = popup menu data ; popup menu data new data copy = new menu data = = null ? null : new popup menu data ( this , new menu data ) ; popup menu data = new data copy ; fire property changed ( popup menu data property , old data , new data copy ) ; }


makes a user choice on a primary symbol conflict as indicated by option this is equivalent to the user clicking a mouse on a radio button indicating which version ' s primary symbol is desired it can also be used to press the cancel button on the merge

protected void choose radio button ( final string component name , final class < ? extends container > conflict panel class ) throws exception { choose radio button ( component name , conflict panel class , true ) ; }


default boolean send ( final string from , final string to , final string message ) { return false ; }


public boolean get attribute boolean ( ) { return attribute boolean ; }