awaits the specified amount of time or until this { @ code test observer } { @ code test subscriber } receives an { @ code on error } or { @ code on complete } events , whichever happens first

public final boolean await ( long time , @ non null time unit unit ) throws interrupted exception { boolean d = done get count ( ) = = 0 | | ( done await ( time , unit ) ) ; timeout = ! d ; return d ; } / / assertion methods


determine the current read - only flag : by default , the transaction ' s read - only hint

protected boolean get current read only flag ( ) { boolean tx read only = transaction synchronization manager is current transaction read only ( ) ; return ( tx read only ? boolean true : null ) ; }


set the location of a single hibernate xml config file , for example as classpath resource " classpath : hibernate cfg xml " note : can be omitted when all necessary properties and mapping resources are specified locally via this bean

public void set config location ( resource config location ) { this config locations = new resource [ ] { config location } ; }


equivalent to { @ code microseconds convert ( duration , this ) }

public long to micros ( long duration ) { throw new abstract method error ( ) ; }


returns the last { @ code number of builds } builds with a build result ≥ { @ code threshold }

public list < run t > get last builds over threshold ( int number of builds , result threshold ) { run t r = get last build ( ) ; return r get builds over threshold ( number of builds , threshold ) ; }


create a new { @ code k table } by transforming the value of each record in this { @ code k table } into a new value ( with possibly a new type ) in the new { @ code k table } , with the { @ link serde key serde } , { @ link serde value serde } , and the underlying { @ link key value store materialized state storage } configured in the { @ link materialized } instance for each { @ code k table } update the provided { @ link value mapper with key } is applied to the value of the update record and computes a new value for it , resulting in an updated record for the result { @ code k table } thus , an input record { @ code < k , v > } can be transformed into an output record { @ code < k : v ' > } this is a stateless record - by - record operation the example below counts the number of token of value and key strings { @ code k table < string , string > input table = builder table ( " topic " ) ; k table < string , integer > output table = input table map value ( new value mapper with key < string , string , integer > { integer apply ( string read only key , string value ) { return read only key split ( " " ) length + value split ( " " ) length ; } } ) ; } to query the local { @ link key value store } representing output table above it must be obtained via { @ link kafka streams # store ( store query parameters ) } kafka streams # store ( ) } : for non - local keys , a custom rpc mechanism must be implemented using { @ link kafka streams # all metadata ( ) } to query the value of the key on a parallel running instance of your kafka streams application the store name to query with is specified by { @ link materialized # as ( string ) } or { @ link materialized # as ( key value bytes store supplier ) } note that the key is read - only and should not be modified , as this can lead to corrupt partitioning this operation preserves data co - location with respect to the key thus , no internal data redistribution is required if a key based operator ( like a join ) is applied to the result { @ code k table } note that { @ code map values } for a changelog stream works differently than { @ link k stream # map values ( value mapper ) record stream filters } , because { @ link key value records } with { @ code null } values ( so - called tombstone records ) have delete semantics thus , for tombstones the provided value - mapper is not evaluated but the tombstone record is forwarded directly to delete the corresponding record in the result { @ code k table }

< vr > k table < k , vr > map values ( final value mapper with key < ? super k , ? super v , ? extends vr > mapper , final materialized < k , vr , key value store < bytes , byte [ ] > > materialized ) ;


public < response extends action response > void store result ( task task , exception error , action listener < response > listener ) { discovery node local node = last discovery nodes get local node ( ) ; if ( local node = = null ) { / / too early to store anything , shouldn ' t really be here - just pass the error along listener on failure ( error ) ; return ; } final task result task result ; try { task result = task result ( local node , error ) ; } catch ( i o exception ex ) { logger warn ( ( ) - > new parameterized message ( " couldn ' t store error { } " , exceptions helper stack trace ( error ) ) , ex ) ; listener on failure ( ex ) ; return ; } task results service store result ( task result , new action listener < void > ( ) { @ override public void on response ( void a void ) { listener on failure ( error ) ; } @ override public void on failure ( exception e ) { logger warn ( ( ) - > new parameterized message ( " couldn ' t store error { } " , exceptions helper stack trace ( error ) ) , e ) ; listener on failure ( e ) ; } } ) ; }


get the composite caret location , omitting the given separator

public int get global caret ( int omit sep ) { int caret = 0 ; for ( int i = 0 ; i < which focus ; i + + ) { if ( i > 0 & & omit sep ! = i - 1 ) { caret + = linked fields get ( i - 1 ) sep length ( ) ; } caret + = field states get ( i ) text length ( ) ; } if ( which focus > 0 & & omit sep ! = which focus - 1 ) { caret + = linked fields get ( which focus - 1 ) sep length ( ) ; } field state fs = field states get ( which focus ) ; caret + = fs clamped caret ( ) ; return caret ; }


test exports adds dependencies to java compilation args provider

public void build helper create java info export provider exports deps added ( ) throws exception { rule builder ( ) build ( ) ; scratch file ( " foo / build " , " load ( ' : extension bzl ' , ' my rule ' ) " , " java library ( name = ' my java lib exports ' , srcs = [ ' java / a java ' ] ) " , " my rule ( name = ' my starlark rule ' , " , " output jar = ' my starlark rule lib jar ' , " , " dep exports = [ ' : my java lib exports ' ] " , " ) " ) ; assert no events ( ) ; java info java info = fetch java info ( ) ; java exports provider exports provider = java info get provider ( java exports provider class ) ; assert that ( exports provider get transitive exports ( ) to list ( ) ) is empty ( ) ; java source jars provider java source jars provider = java info get provider ( java source jars provider class ) ; assert that ( java source jars provider get source jars ( ) ) is empty ( ) ; java compilation args provider java compilation args provider = java info get provider ( java compilation args provider class ) ; assert that ( pretty artifact names ( java compilation args provider get direct compile time jars ( ) ) ) contains exactly ( " foo / my starlark rule lib jar " , " foo / libmy java lib exports - hjar jar " ) ; assert that ( pretty artifact names ( java compilation args provider get direct full compile time jars ( ) ) ) contains exactly ( " foo / my starlark rule lib jar " , " foo / libmy java lib exports jar " ) ; assert that ( pretty artifact names ( java compilation args provider get runtime jars ( ) ) ) contains exactly ( " foo / my starlark rule lib jar " , " foo / libmy java lib exports jar " ) ; assert that ( pretty artifact names ( java compilation args provider get transitive compile time jars ( ) ) ) contains exactly ( " foo / my starlark rule lib jar " , " foo / libmy java lib exports - hjar jar " ) ; }


testing one of the errors reported in zookeeper - 2164 , when some servers can not rejoin to the quorum after restarting the current leader multiple times

public void test restarting leader multiple times ( ) throws exception { for ( int restart count = 1 ; restart count < = 3 ; restart count + + ) { int leader id = qu get leader server ( ) ; log info ( " * * * * * new leader : " + leader id ) ; qu shutdown ( leader id ) ; assert true ( client base wait for server down ( " 127 0 0 1 : " + qu get peer ( leader id ) client port , client base connection timeout ) , " timeout during waiting for current leader to go down " ) ; string error message = " no new leader was elected " ; wait for ( error message , ( ) - > qu leader exists ( ) & & qu get leader server ( ) ! = leader id , 30 ) ; qu restart ( leader id ) ; error message = " not all the quorum members are connected after restarting the old leader " ; wait for ( error message , ( ) - > qu all peers are connected ( ) , 30 ) ; log info ( " * * * * * leader restart { } succeeded " , restart count ) ; } }


returns a clone of this reader positioned at the new index

public g binary reader clone ( int new index ) { g binary reader clone = new g binary reader ( provider , is little endian ( ) ) ; clone converter = converter ; clone current index = new index ; return clone ; }


formats an { @ code int } as a 4 - byte unsigned hex value

public static string u 4 ( int v ) { char [ ] result = new char [ 8 ] ; for ( int i = 0 ; i < 8 ; i + + ) { result [ 7 - i ] = character for digit ( v & 0x 0f , 16 ) ; v > > = 4 ; } return new string ( result ) ; }


overwrite bytes that have already been written into the stream

public void insert byte ( int streampos , int val ) { out [ streampos ] = ( byte ) val ; }


public test query parameter collection format oper resp spec ( consumer < response spec builder > resp spec customizer ) { resp spec customizer accept ( resp spec ) ; return this ; }


returns the single edge that directly connects { @ code endpoints } ( in the order , if any , specified by { @ code endpoints } ) , if one is present , or { @ code null } if no such edge exists if this graph is directed , the endpoints must be ordered

e edge connecting or null ( endpoint pair < n > endpoints ) ;


create a new { @ link compressor } for use by this { @ link compression codec }

public compressor create compressor ( ) { int buffer size = conf get int ( common configuration keys io compression codec snappy buffersize key , common configuration keys io compression codec snappy buffersize default ) ; return new snappy compressor ( buffer size ) ; }


this method performs an asynchronous ldap search operation that only expects at most one result if more than one result is found then this is an error if no results are found , then { @ code null } will be returned if the ldap server returns an error { @ link result code } then this is handled as a { @ link action listener # on failure ( exception ) failure }

public static void search for entry ( l d a p connection pool ldap , string base d n , search scope scope , filter filter , int time limit seconds , boolean ignore referral errors , action listener < search result entry > listener , string attributes ) { boolean searching = false ; l d a p connection ldap connection = null ; try { ldap connection = privileged connect ( ldap : : get connection ) ; final l d a p connection final connection = ldap connection ; search for entry ( final connection , base d n , scope , filter , time limit seconds , ignore referral errors , action listener wrap ( entry - > { assert is ldap connection thread ( thread current thread ( ) ) : " expected current thread [ " + thread current thread ( ) + " ] to be an l d a p connection reader thread probably the new library has changed the thread ' s name " ; i o utils close ( ( ) - > ldap release connection ( final connection ) ) ; listener on response ( entry ) ; } , e - > { i o utils close while handling exception ( ( ) - > ldap release connection ( final connection ) ) ; listener on failure ( e ) ; } ) , attributes ) ; searching = true ; } catch ( l d a p exception e ) { listener on failure ( e ) ; } finally { if ( searching = = false ) { final l d a p connection final connection = ldap connection ; i o utils close while handling exception ( ( ) - > ldap release connection ( final connection ) ) ; } } }


short - circuit ? : no threadsemaphore : thread thread pool full ? : no thread pool queue full ? : no timeout : yes execution result : hystrix runtime exception ( but timeout prior ) fallback : unsupported operation exception

public void test execution hook thread timeout no fallback run failure ( ) { assert hooks on failure ( new func 0 < test hystrix command < integer > > ( ) { @ override public test hystrix command < integer > call ( ) { return get command ( execution isolation strategy thread , abstract test hystrix command execution result failure , 500 , abstract test hystrix command fallback result unimplemented , 200 ) ; } } , new action 1 < test hystrix command < integer > > ( ) { @ override public void call ( test hystrix command < integer > command ) { testable execution hook hook = command get builder ( ) execution hook ; assert true ( hook command emissions match ( 0 , 1 , 0 ) ) ; assert true ( hook execution events match ( 0 , 0 , 0 ) ) ; assert true ( hook fallback events match ( 0 , 0 , 0 ) ) ; assert equals ( timeout exception class , hook get command exception ( ) get class ( ) ) ; assert null ( hook get fallback exception ( ) ) ; assert equals ( " on start - on thread start - ! on run start - on execution start - on thread complete - on error - " , hook execution sequence to string ( ) ) ; } } ) ; }


programmatic schema update on a given connection returning feedback about what happened

string database schema upgrade ( connection connection , string catalog , string schema ) ;


sets this dialog to be transient ( see { @ link # is transient ( ) }

public void set transient ( boolean is transient ) { this is transient = is transient ; }


public list < integer > get namespace wrapped array ( ) { return namespace wrapped array ; }


get a m r m proxy policy from state store , using default queue and configuration as fallback

public static federation a m r m proxy policy load a m r m policy ( string queue , federation a m r m proxy policy old policy , configuration conf , federation state store facade federation facade , sub cluster id home sub cluster id ) throws federation policy initialization exception { / / local policy and its configuration sub cluster policy configuration configuration = load policy configuration ( queue , conf , federation facade ) ; / / instantiate the policy manager and get policy federation policy initialization context context = new federation policy initialization context ( configuration , federation facade get sub cluster resolver ( ) , federation facade , home sub cluster id ) ; log info ( " creating policy manager of type : " + configuration get type ( ) ) ; federation policy manager federation policy manager = instantiate policy manager ( configuration get type ( ) ) ; / / set queue , reinit policy if required ( implementation lazily check / / content of conf ) , and cache it federation policy manager set queue ( configuration get queue ( ) ) ; return federation policy manager get a m r m policy ( context , old policy ) ; }


< code > optional aapt pb string str = 2 ; < code >

public builder merge str ( com android aapt resources string value ) { copy on write ( ) ; instance merge str ( value ) ; return this ; }


creates list of users with given input array < b > 0 < b > - successful operation

public void create users with list input ( list < user > body , map < string , object > params ) throws i o exception { create users with list input for http response ( body , params ) ; }


o auth 2 0 access token create ( service service , authentication authentication , collection < string > scopes , string client id , map < string , map < string , object > > request claims ) ;


create a { @ code char sequence encoder } that supports only " textplain "

public static char sequence encoder text plain only ( ) { return new char sequence encoder ( new mime type ( " text " , " plain " , default charset ) ) ; }


set the < code > priority < code > of the request

public scheduling request builder priority ( priority priority ) { scheduling request set priority ( priority ) ; return this ; }


sets the < code > category < code > property

public pet category ( category category ) { this category = category ; return this ; }


sets the auto mapping unknown column behavior

public void set auto mapping unknown column behavior ( auto mapping unknown column behavior auto mapping unknown column behavior ) { this auto mapping unknown column behavior = auto mapping unknown column behavior ; }


public void reset ( ) { if ( get input stream ( ) ! = null ) get input stream ( ) seek ( 0 ) ; err handler reset ( this ) ; ctx = null ; syntax errors = 0 ; matched e o f = false ; set trace ( false ) ; precedence stack clear ( ) ; precedence stack push ( 0 ) ; a t n simulator interpreter = get interpreter ( ) ; if ( interpreter ! = null ) { interpreter reset ( ) ; } }


check whether the test is enabled in the current execution environment this prevents classes with a non - matching { @ code @ if profile value } annotation from running altogether , even skipping the execution of { @ code prepare test instance ( ) } methods in { @ code test execution listeners }

public void run ( run notifier notifier ) { if ( ! profile value utils is test enabled in this environment ( get test class ( ) get java class ( ) ) ) { notifier fire test ignored ( get description ( ) ) ; return ; } super run ( notifier ) ; }


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 will stay the same , the limit will be set to position + num elements < 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 , buffer dst , int num elements ) { dst limit ( dst position ( ) + bytes to elements ( dst , num elements < < 1 ) ) ; copy jni ( src , src offset , dst , position in bytes ( dst ) , num elements < < 1 ) ; }


convert a remote iterator over file status results into a list the utility equivalents in commons collection and guava cannot be used here , as this is a different interface , one whose operators can throw i o es

public static list < located file status > to list ( remote iterator < located file status > iterator ) throws i o exception { array list < located file status > list = new array list < > ( ) ; while ( iterator has next ( ) ) { list add ( iterator next ( ) ) ; } return list ; }


returns the last message received on the input stream , if an unparseable message has been received

abstract string get recording stream message ( ) ;


create a size - constrained buffer in terms of the maximum number of keys it will store

static eager buffer config max records ( final long record limit ) { return new eager buffer config impl ( record limit , long max value ) ; }


adjust thunk ' this ' auto - param if function has non - default source and does not reside within the global namespace

private parameter [ ] adjust thunk this parameter ( parameter [ ] parameters ) { symbol s = get symbol ( ) ; if ( s get parent namespace ( ) get i d ( ) = = namespace global namespace id ) { return parameters ; } for ( int i = 0 ; i < parameters length ; i + + ) { if ( parameters [ i ] instanceof auto parameter impl ) { parameters [ i ] = adjust thunk this parameter ( parameters [ i ] ) ; } } return parameters ; }


frees any memory allocated native way operation is irreversible after this call , nothing will be drawn this method is idempotent , subsequent calls have no effect like { @ link android graphics bitmap # recycle ( ) } this is an advanced call and is invoked implicitly by finalizer

public void recycle ( ) { shutdown ( ) ; m buffer recycle ( ) ; }


string filter ( diff repository diff repository , string test case name , string tag , string text , string expanded ) ;


writes the given lines of text to this sink with each line ( including the last ) terminated with the given line separator

public void write lines ( iterable < ? extends char sequence > lines , string line separator ) throws i o exception { check not null ( lines ) ; check not null ( line separator ) ; closer closer = closer create ( ) ; try { writer out = closer register ( open buffered stream ( ) ) ; for ( char sequence line : lines ) { out append ( line ) append ( line separator ) ; } out flush ( ) ; / / https : / / code google com / p / guava - libraries / issues / detail ? id = 1330 } catch ( throwable e ) { throw closer rethrow ( e ) ; } finally { closer close ( ) ; } }


unmaps a particular route from the collection of those that have been previously routed search for previously established routes using the given path and unmaps any matches that are found

public boolean unmap ( string path ) { return routes remove ( path ) ; }


get the code value for a particular integer error code

public static code get ( int code ) { return lookup get ( code ) ; }


create a local map output file name on the same volume

public path get output file for write in volume ( path existing ) { path output dir = new path ( existing get parent ( ) , job output dir ) ; path attempt output dir = new path ( output dir , conf get ( job context task attempt id ) ) ; return new path ( attempt output dir , map output filename string ) ; }


see original { @ link stubber # do return ( object ) }

b d d stubber will return ( object to be returned , object next to be returned ) ;


remove all pending write operation and fail them with the given { @ link throwable } the message will be released via { @ link reference count util # safe release ( object ) }

public void remove and fail all ( throwable cause ) { assert ctx executor ( ) in event loop ( ) ; object util check not null ( cause , " cause " ) ; / / it is possible for some of the failed promises to trigger more writes the new writes / / will " revive " the queue , so we need to clean them up until the queue is empty for ( pending write write = head ; write ! = null ; write = head ) { head = tail = null ; size = 0 ; bytes = 0 ; while ( write ! = null ) { pending write next = write next ; reference count util safe release ( write msg ) ; channel promise promise = write promise ; recycle ( write , false ) ; safe fail ( promise , cause ) ; write = next ; } } assert empty ( ) ; }


obtains the given ticket by its id and returns the cas - representative object implementations need to check for the validity of the ticket by making sure it exists and has not expired yet , etc this method is specifically designed to remove the need to access the ticket registry

ticket get ticket ( string ticket id ) throws invalid ticket exception ;


calls { @ link channel handler context # fire channel read complete ( ) } to forward to the next { @ link channel inbound handler } in the { @ link channel pipeline } sub - classes may override this method to change behavior

public void channel read complete ( channel handler context ctx ) throws exception { ctx fire channel read complete ( ) ; }


there ' s no reason for the queue size to ever be more than max size + 1

private static int cap at maximum size ( int queue size , int maximum size ) { return math min ( queue size - 1 , maximum size ) + 1 ; / / don ' t overflow }


adds a new component ( via the provider ) to be managed by this docking window manager the component is initially hidden

public void add component ( component provider provider ) { add component ( provider , true ) ; }


set whether to include the probability distribution of each character in the results

public string stats aggregation builder show distribution ( boolean show distribution ) { this show distribution = show distribution ; return this ; }


sets the uniform with the given name the { @ link shader program } must be bound for this to work

public void set uniformf ( string name , float value 1 , float value 2 ) { gl20 gl = gdx gl 2 0 ; check managed ( ) ; int location = fetch uniform location ( name ) ; gl gl uniform 2f ( location , value 1 , value 2 ) ; }


{ @ inherit doc } the default implementation returns the result of calling { @ link # visit children } on { @ code ctx }

@ override public t visit show tables ( sql base parser show tables context ctx ) { return visit children ( ctx ) ; }


allows access to the prerequisites of a configured target this is currently used in some tests to reach into the internals of rule c t for white box testing in principle , this should not be used ; instead tests should only assert on properties of the exposed provider instances and or the action graph

protected immutable list < artifact > get prerequisite artifacts ( configured target target , string attribute name ) throws exception { set < artifact > result = new linked hash set < > ( ) ; for ( file provider provider : get prerequisites ( target , attribute name , file provider class ) ) { result add all ( provider get files to build ( ) to list ( ) ) ; } return immutable list copy of ( result ) ; }


marks that this connection should do a decoupled data exchange ( such as batched ) rather then pipeline data connections are marked as pipeline breakers to avoid deadlock situations

public void mark breaks pipeline ( ) { this break pipeline = true ; }


return whether it is a image according to the file name

public static boolean is image ( final file file ) { if ( file = = null | | ! file exists ( ) ) { return false ; } return is image ( file get path ( ) ) ; }


public static config service create config service ( properties properties ) throws nacos exception { return config factory create config service ( properties ) ; }


stop the re - encryption updater thread , as well as all edek re - encryption tasks submitted

void stop threads ( ) { assert dir has write lock ( ) ; synchronized ( this ) { for ( zone submission tracker zst : submissions values ( ) ) { zst cancel all tasks ( ) ; } } if ( updater executor ! = null ) { updater executor shutdown now ( ) ; } }


launch two tasks which can only complete by running do run ( ) concurrently

public void timers arent blocked ( ) throws interrupted exception { final count down latch start latch = new count down latch ( 1 ) ; final count down latch stop latch = new count down latch ( 1 ) ; safe timer task task 1 = new safe timer task ( ) { @ override protected void do run ( ) throws exception { start latch count down ( ) ; stop latch await ( ) ; } } ; safe timer task task 2 = new safe timer task ( ) { @ override protected void do run ( ) { stop latch count down ( ) ; } } ; timer get ( ) schedule ( task 1 , 1 , time unit milliseconds ) ; start latch await ( ) ; timer get ( ) schedule ( task 2 , 2 , time unit milliseconds ) ; if ( ! stop latch await ( 10000 , time unit milliseconds ) ) { fail ( " failed to run the two tasks simultaneously " ) ; } }


model tests for additional properties any type

public void test additional properties any type ( ) { / / todo : test additional properties any type }


gets the maximum alignment value that is allowed by this data organization when getting an alignment for any data type it will not exceed this value if no maximum alignment is returned , the data organization isn ' t specifically limited

public int get absolute max alignment ( ) { return absolute max alignment ; }


public void run ( string [ ] args ) throws i o exception , u r i syntax exception { if ( ! parse arguments ( args ) ) { return ; } start ( ) ; sleep forever ( ) ; }


sets the offset for query results in combination with { @ link # limit ( int ) } the first { @ code offset } results are skipped and the total number of results will be limited by { @ code limit } you cannot use offset without limit

public query builder < t > offset ( int offset ) { this offset = offset ; return this ; }


creates a new { @ link date format } suitable for processing this { @ link time scale }

public date format create date format ( ) { switch ( this ) { case hour : return new simple date format ( " mmm / dd hh " ) ; case min : return new simple date format ( " hh : mm " ) ; case sec10 : return new simple date format ( " hh : mm : ss " ) ; default : throw new assertion error ( ) ; } }


public authentication get authentication ( string token ) { claims claims = jwts parser builder ( ) set signing key ( auth configs get secret key bytes ( ) ) build ( ) parse claims jws ( token ) get body ( ) ; list < granted authority > authorities = authority utils comma separated string to authority list ( ( string ) claims get ( authorities key ) ) ; user principal = new user ( claims get subject ( ) , " " , authorities ) ; return new username password authentication token ( principal , " " , authorities ) ; }


if some events are blocked on the absence of a build started event , generate such an event ; moreover , make that artificial start event announce all events blocked on it , as well as the { @ link build completing event } that caused the early end of the stream

private synchronized void clear missing start event ( build event id id ) { if ( pending events contains key ( build event id util build started id ( ) ) ) { immutable set builder < build event id > children = immutable set builder ( ) ; children add ( progress event initial progress update ) ; children add ( id ) ; children add all ( pending events get ( build event id util build started id ( ) ) stream ( ) map ( build event : : get event id ) collect ( immutable set to immutable set ( ) ) ) ; build event ( new aborted event ( build event id util build started id ( ) , children build ( ) , get last abort reason ( ) , get abort reason details ( ) ) ) ; } }


sets { @ link format # encoder delay } the default value is 0

public builder set encoder delay ( int encoder delay ) { this encoder delay = encoder delay ; return this ; }


gets a unique name in the indicated namespace by appending an integer number if necessary and ignoring any conflicts with existing parameters

private static string get unique name ignoring current parameters ( symbol table symbol table , namespace namespace , string base name , set < string > names not to be used ) { string name = base name ; if ( name ! = null ) { / / establish unique name int cnt = 0 ; list < symbol > symbols = symbol table get symbols ( name , namespace ) ; while ( ! symbols is empty ( ) ) { if ( names not to be used contains ( name ) ) { continue ; } if ( are all paramaters ( symbols ) ) { return name ; } name = base name + " " + ( + + cnt ) ; symbols = symbol table get symbols ( name , namespace ) ; } } return name ; }


wait until an attempt has reached a specified state the timeout is 40 seconds

public void wait for state ( application attempt id attempt id , r m app attempt state final state ) throws interrupted exception { wait for state ( attempt id , final state , timeout ms for attempt ) ; }


returns the initial mapping from p i ds to payload readers this method allows the injection of payload readers for reserved p i ds , excluding pid 0

sparse array < ts payload reader > create initial payload readers ( ) ;


crop the image to a circle and resize to the specified widthheight the circle crop will have the same width and height equal to the min - edge of the result image

public static bitmap circle crop ( @ non null bitmap pool pool , @ non null bitmap in bitmap , int dest width , int dest height ) { int dest min edge = math min ( dest width , dest height ) ; float radius = dest min edge / 2f ; int src width = in bitmap get width ( ) ; int src height = in bitmap get height ( ) ; float scale x = dest min edge / ( float ) src width ; float scale y = dest min edge / ( float ) src height ; float max scale = math max ( scale x , scale y ) ; float scaled width = max scale * src width ; float scaled height = max scale * src height ; float left = ( dest min edge - scaled width ) / 2f ; float top = ( dest min edge - scaled height ) / 2f ; rect f dest rect = new rect f ( left , top , left + scaled width , top + scaled height ) ; / / alpha is required for this transformation bitmap to transform = get alpha safe bitmap ( pool , in bitmap ) ; bitmap config out config = get alpha safe config ( in bitmap ) ; bitmap result = pool get ( dest min edge , dest min edge , out config ) ; result set has alpha ( true ) ; bitmap drawable lock lock ( ) ; try { canvas canvas = new canvas ( result ) ; / / draw a circle canvas draw circle ( radius , radius , radius , circle crop shape paint ) ; / / draw the bitmap in the circle canvas draw bitmap ( to transform , null , dest rect , circle crop bitmap paint ) ; clear ( canvas ) ; } finally { bitmap drawable lock unlock ( ) ; } if ( ! to transform equals ( in bitmap ) ) { pool put ( to transform ) ; } return result ; }


returns a resource on the classpath as a stream object

public static input stream get resource as stream ( class loader loader , string resource ) throws i o exception { input stream in = class loader wrapper get resource as stream ( resource , loader ) ; if ( in = = null ) { throw new i o exception ( " could not find resource " + resource ) ; } return in ; }


returns true if field success is set ( has been assigned a value ) and false otherwise

public boolean is set success ( ) { return isset bit vector get ( success isset id ) ; }


a simple test to test that for the configured ports , the resolver can return the current sasl properties

public void test resolver ( ) { configuration conf = new configuration ( ) ; conf set ( " ingress port sasl configured ports " , " 444 , 555 , 666 , 777 " ) ; conf set ( " ingress port sasl prop 444 " , " authentication " ) ; conf set ( " ingress port sasl prop 555 " , " authentication , privacy " ) ; conf set ( " ingress port sasl prop 666 " , " privacy " ) ; ingress port based resolver resolver = new ingress port based resolver ( ) ; resolver set conf ( conf ) ; / / the client address does not matter , give it a null assert equals ( " auth " , resolver get server properties ( null , 444 ) get ( sasl qop ) ) ; assert equals ( " auth , auth - conf " , resolver get server properties ( null , 555 ) get ( sasl qop ) ) ; assert equals ( " auth - conf " , resolver get server properties ( null , 666 ) get ( sasl qop ) ) ; assert equals ( " auth - conf " , resolver get server properties ( null , 777 ) get ( sasl qop ) ) ; assert equals ( " auth " , resolver get server properties ( null , 888 ) get ( sasl qop ) ) ; }


builds a list of position entries , sorted by ascending address

private array list < position list entry > build sorted positions ( ) { int sz = ( positions = = null ) ? 0 : positions size ( ) ; array list < position list entry > result = new array list ( sz ) ; for ( int i = 0 ; i < sz ; i + + ) { result add ( positions get ( i ) ) ; } / / sort ascending by address collections sort ( result , new comparator < position list entry > ( ) { public int compare ( position list entry a , position list entry b ) { return a get address ( ) - b get address ( ) ; } public boolean equals ( object obj ) { return obj = = this ; } } ) ; return result ; }


returns unmodifiable set of properties names defined in this { @ linkplain config def }

public set < string > names ( ) { return collections unmodifiable set ( config keys key set ( ) ) ; }


sets the { @ code generate alias as model } and returns a reference to this builder so that the methods can be chained together an ' alias ' is a primitive type defined as a schema , and this option will attempt to construct a model for that primitive

public builder with generate alias as model ( boolean generate alias as model ) { this generate alias as model = generate alias as model ! = null ? generate alias as model : boolean value of ( default generate alias as model ) ; return this ; }


private void test serialize deserialize ( object codecs codecs ) throws exception { stopwatch timer = stopwatch create started ( ) ; int total bytes = 0 ; for ( int i = 0 ; i < repetitions ; + + i ) { for ( object subject : subjects ) { byte string serialized = serialize ( subject , codecs ) ; total bytes + = serialized size ( ) ; object deserialized = deserialize ( serialized , codecs ) ; verification function verify deserialized ( subject , deserialized ) ; } } logger at info ( ) log ( " % s total serialized bytes = % d , % s " , subjects get ( 0 ) get class ( ) get simple name ( ) , total bytes , timer ) ; }


returns the number of audio frames trimmed since the last call to { @ link # reset trimmed frame count ( ) }

public long get trimmed frame count ( ) { return trimmed frame count ; }


returns the task type of the task attempt i d

public task type get task type ( ) { return task id get task type ( ) ; }


returns the specified block ' s on - disk length ( excluding metadata )

long get length ( extended block b ) throws i o exception ;


public void write ( short u 0 , short u 1 ) { write ( u 0 ) ; write ( u 1 ) ; }


create a { @ link managed channel } for the given parameters

public static managed channel new client channel ( transport transport , socket address address , boolean tls , boolean testca , @ nullable string authority override , int flow control window , boolean direct executor ) { managed channel builder < ? > builder ; if ( transport = = transport ok http ) { builder = new ok http client channel ( address , tls , testca ) ; } else { try { builder = new netty client channel ( transport , address , tls , testca , flow control window ) ; } catch ( exception e ) { throw new runtime exception ( e ) ; } } if ( authority override ! = null ) { builder override authority ( authority override ) ; } if ( direct executor ) { builder direct executor ( ) ; } else { / / todo ( carl - mastrangelo ) : this should not be necessary i don ' t know where this should be / / put move it somewhere else , or remove it if no longer necessary / / see : https : / / github com / grpc / grpc - java / issues / 2119 builder executor ( get executor ( ) ) ; } return builder build ( ) ; }


returns the live datanodes and its storage details , which has available space ( & gt ; 0 ) to schedule block moves this will return array of datanodes from its local cache it has a configurable refresh interval in millis and periodically refresh the datanode cache by fetching latest { @ link context # get live datanode storage report ( ) } once it elapsed refresh interval

public datanode map get live datanode storage report ( context sps context ) throws i o exception { long now = time monotonic now ( ) ; long elapsed time ms = now - last accessed time ; boolean refresh needed = elapsed time ms > = refresh interval ms ; last accessed time = now ; if ( refresh needed ) { if ( log is debug enabled ( ) ) { log debug ( " elapsed time ms > refresh interval ms : { } > { } , " + " so refreshing cache " , elapsed time ms , refresh interval ms ) ; } datanode map reset ( ) ; / / clear all previously cached items / / fetch live datanodes from namenode and prepare datanode map datanode storage report [ ] live dns = sps context get live datanode storage report ( ) ; for ( datanode storage report storage : live dns ) { storage report [ ] storage reports = storage get storage reports ( ) ; list < storage type > storage types = new array list < > ( ) ; list < long > remaining size list = new array list < > ( ) ; for ( storage report t : storage reports ) { if ( t get remaining ( ) > 0 ) { storage types add ( t get storage ( ) get storage type ( ) ) ; remaining size list add ( t get remaining ( ) ) ; } } datanode map add target ( storage get datanode info ( ) , storage types , remaining size list ) ; } if ( log is debug enabled ( ) ) { log debug ( " live datanodes : { } " , datanode map ) ; } / / get network topology cluster = sps context get network topology ( datanode map ) ; } return datanode map ; }


adds a route to the given handler function that handles http { @ code options } requests

builder options ( handler function < server response > handler function ) ;


close current block and update { @ link # stream c r c }

private void close block ( byte buf out ) { final bzip 2 block compressor block compressor = this block compressor ; if ( ! block compressor is empty ( ) ) { block compressor close ( out ) ; final int block c r c = block compressor crc ( ) ; stream c r c = ( stream c r c < < 1 | stream c r c > > > 31 ) ^ block c r c ; } }


get any delegation token manager created by the filesystem

abfs delegation token manager get delegation token manager ( ) { return delegation token manager ; }


gets the nearest ancestor { @ link abstract build } that belongs to { @ linkplain abstract project # get root project ( ) the root project of get project ( ) } that dominatesgovernsencompasses this build some projects ( such as matrix projects , maven projects , or promotion processes ) form a tree of jobs , and still in some of them , builds of child projects are relatedtied to that of the parent project in such a case , this method returns the governing build

public abstract build < ? , ? > get root build ( ) { return this ; }


extends the bounding box with the bounds of this node this is a potential slow operation , it is advised to cache the result

public bounding box extend bounding box ( final bounding box out , boolean transform ) { final int part count = parts size ; for ( int i = 0 ; i < part count ; i + + ) { final node part part = parts get ( i ) ; if ( part enabled ) { final mesh part mesh part = part mesh part ; if ( transform ) mesh part mesh extend bounding box ( out , mesh part offset , mesh part size , global transform ) ; else mesh part mesh extend bounding box ( out , mesh part offset , mesh part size ) ; } } final int child count = children size ; for ( int i = 0 ; i < child count ; i + + ) children get ( i ) extend bounding box ( out ) ; return out ; }


default completable future < response entity < void > > delete pet ( @ api param ( value = " pet id to delete " , required = true ) @ path variable ( " pet id " ) long pet id , @ api param ( value = " " ) @ request header ( value = " api key " , required = false ) string api key ) { return completable future completed future ( new response entity < > ( http status not implemented ) ) ; }


sets an experimental option useful for new opera driver options not yet exposed through the { @ link opera options } api

public opera options set experimental option ( string name , object value ) { experimental options put ( require non null ( " option name " , name ) , value ) ; return this ; }


compares two char sequences , returning { @ code true } if they represent equal sequences of characters { @ code null } s are handled without exceptions two { @ code null } references are considered to be equal the comparison is case sensitive string utils equals ( null , null ) = true string utils equals ( null , " abc " ) = false string utils equals ( " abc " , null ) = false string utils equals ( " abc " , " abc " ) = true string utils equals ( " abc " , " abc " ) = false

public static boolean equals ( final char sequence cs 1 , final char sequence cs 2 ) { if ( cs 1 = = cs 2 ) { return true ; } if ( cs 1 = = null | | cs 2 = = null ) { return false ; } if ( cs 1 instanceof string & & cs 2 instanceof string ) { return cs 1 equals ( cs 2 ) ; } return string utils region matches ( cs 1 , false , 0 , cs 2 , 0 , math max ( cs 1 length ( ) , cs 2 length ( ) ) ) ; }


returns { @ code true } if the type has been applied

boolean is applied ( ) { return applied ; }


schedules a task on { @ link # instance }

static public task schedule ( task task , float delay seconds , float interval seconds , int repeat count ) { return instance ( ) schedule task ( task , delay seconds , interval seconds , repeat count ) ; }


public final string to human ( ) { string buffer sb = new string buffer ( 100 ) ; boolean first = true ; sb append ( " { " ) ; for ( offsetted item i : items ) { if ( first ) { first = false ; } else { sb append ( " , " ) ; } sb append ( i to human ( ) ) ; } sb append ( " } " ) ; return sb to string ( ) ; }


public void init ( scheduled log executor component log executor , consumer < list < e > > save function , comparator < e > batch update comparator ) { for ( int i = 0 ; i < max threads ; i + + ) { messages stats stats = stats factory create messages stats ( params get stats name prefix ( ) + " queue " + i ) ; tb sql blocking queue < e > queue = new tb sql blocking queue < > ( params , stats ) ; queues add ( queue ) ; queue init ( log executor , save function , batch update comparator , i ) ; } }


synchronize client metadata state with active name node in ha the client synchronizes its state with the active name node in order to guarantee subsequent read consistency from observer nodes

public void msync ( ) throws i o exception { dfs msync ( ) ; }


find pet by id returns a single pet < b > 200 < b > - successful operation < b > 400 < b > - invalid id supplied < b > 404 < b > - pet not found

public mono < pet > get pet by id ( long pet id ) throws web client response exception { object post body = null ; / / verify the required parameter ' pet id ' is set if ( pet id = = null ) { throw new web client response exception ( " missing the required parameter ' pet id ' when calling get pet by id " , http status bad request value ( ) , http status bad request get reason phrase ( ) , null , null , null ) ; } / / create path and map variables final map < string , object > path params = new hash map < string , object > ( ) ; path params put ( " pet id " , pet id ) ; final multi value map < string , string > query params = new linked multi value map < string , string > ( ) ; final http headers header params = new http headers ( ) ; final multi value map < string , string > cookie params = new linked multi value map < string , string > ( ) ; final multi value map < string , object > form params = new linked multi value map < string , object > ( ) ; final string [ ] local var accepts = { " application / xml " , " application / json " } ; final list < media type > local var accept = api client select header accept ( local var accepts ) ; final string [ ] local var content types = { } ; final media type local var content type = api client select header content type ( local var content types ) ; string [ ] local var auth names = new string [ ] { " api key " } ; parameterized type reference < pet > local var return type = new parameterized type reference < pet > ( ) { } ; return api client invoke a p i ( " / pet / { pet id } " , http method get , path params , query params , post body , header params , cookie params , form params , local var accept , local var content type , local var auth names , local var return type ) ; }


public float [ ] get radii ( ) { return m radii ; }


returns the name of the writeable object


public long get corrupt replica blocks count ( ) { return corrupt replica blocks count ; }


public enum integer enum get enum integer ( ) { return enum integer ; }


adds a given volume into this volume set

public void add volume ( disk balancer volume volume ) throws exception { preconditions check not null ( volume , " volume cannot be null " ) ; preconditions check state ( is transient ( ) = = volume is transient ( ) , " mismatch in volume set and volume ' s transient " + " properties " ) ; if ( this storage type = = null ) { preconditions check state ( volumes size ( ) = = 0l , " storage type is null but " + " volume size is " + volumes size ( ) ) ; this storage type = volume get storage type ( ) ; } else { preconditions check state ( this storage type equals ( volume get storage type ( ) ) , " adding wrong type of disk to this volume set " ) ; } volumes add ( volume ) ; compute volume data density ( ) ; }


returns whether the given input is the first line of a web v t t file

public static boolean is webvtt header line ( parsable byte array input ) { @ nullable string line = input read line ( ) ; return line ! = null & & line starts with ( webvtt header ) ; }


constructs a new parent id query that returns all child documents of the specified type that point to the specified id

public static parent id query builder parent id ( string type , string id ) { return new parent id query builder ( type , id ) ; }


public void set comment ( string comment ) ;


the test server will not implement this method it will be used to test the behavior when clients call unimplemented methods

public io grpc testing integration empty protos empty unimplemented call ( io grpc testing integration empty protos empty request ) { return io grpc stub client calls blocking unary call ( get channel ( ) , get unimplemented call method ( ) , get call options ( ) , request ) ; }


try to determine the persistence unit root url based on the given " default persistence unit root location "

private url determine default persistence unit root url ( ) { if ( this default persistence unit root location = = null ) { return null ; } try { url url = this resource pattern resolver get resource ( this default persistence unit root location ) get u r l ( ) ; return ( resource utils is jar u r l ( url ) ? resource utils extract jar file u r l ( url ) : url ) ; } catch ( i o exception ex ) { throw new persistence exception ( " unable to resolve persistence unit root url " , ex ) ; } }


returns a joiner which automatically places { @ code separator } between consecutive elements

public static joiner on ( char separator ) { return new joiner ( string value of ( separator ) ) ; }


returns only default cluster get hedged read metrics

public d f s hedged read metrics get hedged read metrics ( ) { if ( this vfs = = null ) { return super get hedged read metrics ( ) ; } check default d f s ( default d f s , " get hedged read metrics " ) ; return default d f s get hedged read metrics ( ) ; }


public void set group ( string group ) { this group = group ; }


get authentications ( key : authentication name , value : authentication )

public map < string , authentication > get authentications ( ) { return authentications ; }


run the fsck command using the specified params

public static string run fsck ( configuration conf , int expected err code , boolean check error code , string path ) throws exception { byte array output stream b stream = new byte array output stream ( ) ; print stream out = new print stream ( b stream , true ) ; int err code = tool runner run ( new d f sck ( conf , out ) , path ) ; if ( check error code ) { assert equals ( expected err code , err code ) ; } return b stream to string ( ) ; }


public list < list < read only first > > get array array of model ( ) { return array array of model ; }


see { @ link media session compat callback # on skip to previous ( ) }

void on skip to previous ( player player , control dispatcher control dispatcher ) ;


from bug report http : code google compgoogle - gsonissuesdetail ? id = 95

public void test map of map serialization ( ) { map < string , map < string , string > > map = new hash map < string , map < string , string > > ( ) ; map < string , string > nested map = new hash map < string , string > ( ) ; nested map put ( " 1 " , " 1 " ) ; nested map put ( " 2 " , " 2 " ) ; map put ( " nested map " , nested map ) ; string json = gson to json ( map ) ; assert true ( json contains ( " nested map " ) ) ; assert true ( json contains ( " \ " 1 \ " : \ " 1 \ " " ) ) ; assert true ( json contains ( " \ " 2 \ " : \ " 2 \ " " ) ) ; }


set up terasort by cleaning out the destination , and note the initial time before any of the jobs are executed this is executed first for each parameterized run it is where all variables which need to be reset for each run need to be reset

public void test 100 terasort setup ( ) throws throwable { describe ( " setting up for a terasort " ) ; get file system ( ) delete ( terasort path , true ) ; completed stages = new hash map < > ( ) ; terasort duration = optional of ( new duration info ( log , false , " terasort " ) ) ; }


alter saslscram credentials for the given users this is a convenience method for { @ link # alter user scram credentials ( list , alter user scram credentials options ) }

default alter user scram credentials result alter user scram credentials ( list < user scram credential alteration > alterations ) { return alter user scram credentials ( alterations , new alter user scram credentials options ( ) ) ; }


returns the corresponding primitive type if this is a wrapper type ; otherwise returns { @ code this } itself idempotent

public final type token < t > unwrap ( ) { if ( is wrapper ( ) ) { @ suppress warnings ( " unchecked " ) / / this is a wrapper class class < t > type = ( class < t > ) runtime type ; return of ( primitives unwrap ( type ) ) ; } return this ; }


pull a string entry from a stanza , or null

public string get value or null ( string name ) throws invalid xml exception { if ( ! subtrees contains key ( name ) ) { return null ; } linked list < stanza > l = subtrees get ( name ) ; if ( l size ( ) ! = 1 ) { throw new invalid xml exception ( " more than one value found for " + name ) ; } return l get ( 0 ) get value ( ) ; }


returns the multi - architecture dylib binary of the dynamic framework may return null if the rule providing the framework only specified framework imports


record that the output of this blaze command depended on the contents of a build file or source file with the specified time stamp

public void notify dependence on file time ( path fragment path , long ctime millis ) { if ( ! this wait a millisecond & & ctime millis = = this command start time millis ) { if ( path ! = null ) { logger at info ( ) log ( " will have to wait for a millisecond on completion because of % s " , path ) ; } this wait a millisecond = true ; } if ( ! this wait a second & & ctime millis = = this command start time millis rounded ) { if ( path ! = null ) { logger at info ( ) log ( " will have to wait for a second on completion because of % s " , path ) ; } this wait a second = true ; } }


public model snapshot get model ( ) { return model ; }


where the entry was defined < code > optional aapt pb source source = 1 ; < code >

public builder set source ( com android aapt resources source builder builder for value ) { copy on write ( ) ; instance set source ( builder for value ) ; return this ; }


simple test for writing to and rolling the edit log

public void test simple edit log ( ) throws i o exception { / / start a cluster configuration conf = get conf ( ) ; mini d f s cluster cluster = null ; file system file sys = null ; try { cluster = new mini d f s cluster builder ( conf ) num data nodes ( num data nodes ) build ( ) ; cluster wait active ( ) ; file sys = cluster get file system ( ) ; final f s namesystem namesystem = cluster get namesystem ( ) ; f s image fsimage = namesystem get f s image ( ) ; final f s edit log edit log = fsimage get edit log ( ) ; assert exists in storage dirs ( cluster , name node dir type edits , n n storage get in progress edits file name ( 1 ) ) ; edit log log set replication ( " fakefile " , ( short ) 1 ) ; edit log log sync ( ) ; edit log roll edit log ( name node layout version current layout version ) ; assert exists in storage dirs ( cluster , name node dir type edits , n n storage get finalized edits file name ( 1 , 3 ) ) ; assert exists in storage dirs ( cluster , name node dir type edits , n n storage get in progress edits file name ( 4 ) ) ; edit log log set replication ( " fakefile " , ( short ) 2 ) ; edit log log sync ( ) ; edit log close ( ) ; } finally { if ( file sys ! = null ) file sys close ( ) ; if ( cluster ! = null ) cluster shutdown ( ) ; } }


public string get capital camel ( ) { return capital camel ; }


creates all the states between start and final state

private state < t > create middle states ( final state < t > sink state ) { state < t > last sink = sink state ; while ( current pattern get previous ( ) ! = null ) { if ( current pattern get quantifier ( ) get consuming strategy ( ) = = quantifier consuming strategy not follow ) { / / skip not follow patterns , they are converted into edge conditions } else if ( current pattern get quantifier ( ) get consuming strategy ( ) = = quantifier consuming strategy not next ) { final state < t > not next = create state ( current pattern get name ( ) , state state type normal ) ; final iterative condition < t > not condition = get take condition ( current pattern ) ; final state < t > stop state = create stop state ( not condition , current pattern get name ( ) ) ; if ( last sink is final ( ) ) { / / so that the proceed to final is not fired not next add ignore ( last sink , new rich not condition < > ( not condition ) ) ; } else { not next add proceed ( last sink , new rich not condition < > ( not condition ) ) ; } not next add proceed ( stop state , not condition ) ; last sink = not next ; } else { last sink = convert pattern ( last sink ) ; } / / we traverse the pattern graph backwards following pattern = current pattern ; current pattern = current pattern get previous ( ) ; final time current window time = current pattern get window time ( ) ; if ( current window time ! = null & & current window time to milliseconds ( ) < window time or else ( long max value ) ) { / / the window time is the global minimum of all window times of each state window time = optional of ( current window time to milliseconds ( ) ) ; } } return last sink ; }


see { @ link # floor ( long ) } this method modifies the given calendar and returns the same object

public calendar floor ( calendar cal ) { calendar two years ago = ( calendar ) cal clone ( ) ; two years ago add ( calendar year , - 2 ) ; outer : while ( true ) { if ( cal compare to ( two years ago ) < 0 ) { / / we went too far into the past throw new rare or impossible date exception ( ) ; } for ( calendar field f : calendar field adjust order ) { int cur = f value of ( cal ) ; int next = f floor ( this , cur ) ; if ( cur = = next ) continue ; / / this field is already in a good shape move on to next / / we are modifying this field , so clear all the lower level fields for ( calendar field l = f lower field ; l ! = null ; l = l lower field ) l clear ( cal ) ; if ( next < 0 ) { / / we need to borrow from the next field f roll up ( cal , - 1 ) ; / / the problem here , in contrast with the ceil method , is that / / the maximum value of the field is not always a fixed value ( that is , day of month ) / / so we zero - clear all the lower fields , set the desired value + 1 , f set to ( cal , f last ( this ) ) ; f add to ( cal , 1 ) ; / / then subtract a minute to achieve maximum values on all the lower fields , / / with the desired value in ' f ' calendar field minute add to ( cal , - 1 ) ; / / since higher order field is affected by this , we need to restart from all over continue outer ; } else { f set to ( cal , next ) ; f add to ( cal , 1 ) ; calendar field minute add to ( cal , - 1 ) ; if ( f redo adjustment if modified ) continue outer ; / / when we modify day of month and day of week , do it all over from the top } } return cal ; / / all fields adjusted } }


public static void main ( string [ ] args ) { / / initialize creatures list var creatures = list of ( new goblin ( ) , new octopus ( ) , new dragon ( ) , new shark ( ) , new troll ( ) , new killer bee ( ) ) ; / / so - called " hard - coded " specification logger info ( " demonstrating hard - coded specification : " ) ; / / find all walking creatures logger info ( " find all walking creatures " ) ; print ( creatures , new movement selector ( movement walking ) ) ; / / find all dark creatures logger info ( " find all dark creatures " ) ; print ( creatures , new color selector ( color dark ) ) ; logger info ( " \ n " ) ; / / so - called " parameterized " specification logger info ( " demonstrating parameterized specification : " ) ; / / find all creatures heavier than 5 0 0kg logger info ( " find all creatures heavier than 6 0 0kg " ) ; print ( creatures , new mass greater than selector ( 600 0 ) ) ; / / find all creatures heavier than 5 0 0kg logger info ( " find all creatures lighter than or weighing exactly 5 0 0kg " ) ; print ( creatures , new mass smaller than or eq selector ( 500 0 ) ) ; logger info ( " \ n " ) ; / / so - called " composite " specification logger info ( " demonstrating composite specification : " ) ; / / find all red and flying creatures logger info ( " find all red and flying creatures " ) ; var red and flying = new color selector ( color red ) and ( new movement selector ( movement flying ) ) ; print ( creatures , red and flying ) ; / / find all creatures dark or red , non - swimming , and heavier than or equal to 4 0 0kg logger info ( " find all scary creatures " ) ; var scary creatures selector = new color selector ( color dark ) or ( new color selector ( color red ) ) and ( new movement selector ( movement swimming ) not ( ) ) and ( new mass greater than selector ( 400 0 ) or ( new mass equal selector ( 400 0 ) ) ) ; print ( creatures , scary creatures selector ) ; }


gets whether the query builder will ignore unmapped types ( and run a { @ link match no docs query } in place of this query ) or throw an exception if the type is unmapped

public boolean ignore unmapped ( ) { return ignore unmapped ; }


creates a keystore with a single key and saves it to a file

public static void create key store ( string filename , string password , string key password , string alias , key private key , certificate cert ) throws general security exception , i o exception { key store ks = create empty key store ( ) ; ks set key entry ( alias , private key , key password to char array ( ) , new certificate [ ] { cert } ) ; save key store ( ks , filename , password ) ; }


post fakecreate xml item : creates an xml item this route creates an xml item

default response entity < void > create xml item ( @ api param ( value = " xml item body " , required = true ) @ valid @ request body xml item xml item ) { return new response entity < > ( http status not implemented ) ; }


creates list of users with given input array

public void create users with list input test ( ) { list < user > body = null ; / / api create users with list input ( body ) ; / / todo : test validations }


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


writes the given { @ link abstract event } to all channels

void broadcast event ( abstract event event , boolean is priority event ) throws i o exception ;


public configuration get options ( ) { return options ; }


see { @ link media session compat callback # on remove queue item ( media description compat description ) }

void on remove queue item ( player player , media description compat description ) ;


called once the { @ link channel inbound handler # channel inactive ( channel handler context ) } event hit the end of the { @ link channel pipeline }

protected void on unhandled inbound channel inactive ( ) { }


verify whether sorter thread is running or not

public boolean is sorter thread running ( ) { return ( handler ! = null ) ; }


specifies the scheduler to use when scheduling routine maintenance based on an expiration event this augments the periodic maintenance that occurs during normal cache operations to allow for the prompt removal of expired entries regardless of whether any cache activity is occurring at that time by default , { @ link scheduler # disabled scheduler ( ) } is used the scheduling between expiration events is paced to exploit batching and to minimize executions in short succession this minimum difference between the scheduled executions is implementation - specific , currently at ~ 1 second ( 2 ^ 30 ns ) in addition , the provided scheduler may not offer real - time guarantees ( including { @ link scheduled thread pool executor } ) the scheduling is best - effort and does not make any hard guarantees of when an expired entry will be removed < b > note for java 9 and later : < b > consider using { @ link scheduler # system scheduler ( ) } to leverage the dedicated , system - wide scheduling thread

public caffeine < k , v > scheduler ( @ non null scheduler scheduler ) { require state ( this scheduler = = null , " scheduler was already set to % s " , this scheduler ) ; this scheduler = require non null ( scheduler ) ; return this ; }


returns the human readable description of this filter for example : " jpeg and gif image files ( jpg , gif ) "

public string get description ( ) { if ( full description = = null ) { full description = " " ; if ( description = = null | | is extension list in description ( ) ) { if ( description ! = null ) { full description = description ; } full description + = " ( " ; / / build the description from the extension list if ( filters size ( ) = = 0 ) { full description + = " * * " ; } else { boolean first ext = true ; enumeration < string > extensions = filters keys ( ) ; if ( extensions ! = null ) { while ( extensions has more elements ( ) ) { if ( ! first ext ) { full description + = " , " ; } else { first ext = false ; } full description + = " * " + extensions next element ( ) ; } } } full description + = " ) " ; } else { full description = description ; } } return full description ; }


check whether the given bean is defined as a { @ link factory bean }

protected boolean is factory bean ( string bean name , root bean definition mbd ) { boolean result = mbd is factory bean ; if ( result = = null ) { class < ? > bean type = predict bean type ( bean name , mbd , factory bean class ) ; result = ( bean type ! = null & & factory bean class is assignable from ( bean type ) ) ; mbd is factory bean = result ; } return result ; }


returns the current value of the field or null if the field has no current value

public big integer get value ( ) { string text = text field get text ( ) ; return compute value from string ( text ) ; }


determine if the ordering strategy matches the expected one

private static boolean is order ( bucket order order , bucket order expected ) { if ( order = = expected ) { return true ; } else if ( order instanceof compound order ) { / / check if its a compound order with the first element that matches list < bucket order > orders = ( ( compound order ) order ) order elements ; if ( orders size ( ) > = 1 ) { return is order ( orders get ( 0 ) , expected ) ; } } return false ; }


returns the { @ link job i d } which is associated with this job


returns true if this dex doesn ' t contain any class defs

public boolean is empty ( ) { return class defs items ( ) is empty ( ) ; }


returns the record number of the underlying type

public record number get modified record number ( ) { return underlying record number ; }


initialize the bean definition reader used for loading the bean definitions of this context default implementation is empty can be overridden in subclasses

protected void init bean definition reader ( groovy bean definition reader bean definition reader ) { }


protected abstract resource get plan resources ( plan plan , queue queue , resource cluster resources ) ;


constructs an event with kind { @ link event kind # info }

public static event info ( string message ) { return of ( event kind info , message ) ; }


public string next procedure ( ) { return next procedure ; }


returns { @ code true } if { @ code x } represents a mathematical integer this is equivalent to , but not necessarily implemented as , the expression { @ code ! double is na n ( x ) & & ! double is infinite ( x ) & & x = = math rint ( x ) }

public static boolean is mathematical integer ( double x ) { return is finite ( x ) & & ( x = = 0 0 | | significand bits - long number of trailing zeros ( get significand ( x ) ) < = get exponent ( x ) ) ; }


public long get corrupt e c block groups ( ) { return corrupt replicas get corrupt e c block groups ( ) ; }


public void quit worker ( io grpc benchmarks proto control void request , io grpc stub stream observer < io grpc benchmarks proto control void > response observer ) { io grpc stub server calls async unimplemented unary call ( get quit worker method ( ) , response observer ) ; }


returns the list of combined globalpublic symbols

public map < long , abstract ms symbol > get symbols by offset ( ) { return symbol records get symbols by offset ( ) ; }


this is a best effort automatic test for method forwarding between a delegate and its wrapper , where the wrapper class is a subtype of the delegate this ignores methods that are inherited from object

public static < d , w , i extends d > void test method forwarding ( class < d > delegate class , function < i , w > wrapper factory , supplier < i > delegate object supplier ) throws no such method exception , illegal access exception , invocation target exception { test method forwarding ( delegate class , wrapper factory , delegate object supplier , collections empty set ( ) ) ; }


accepts submission from the configuration page subtypes should override the { @ link # submit ( stapler request ) } method

public final synchronized void do config submit ( stapler request req , stapler response rsp ) throws i o exception , servlet exception , form exception { check permission ( configure ) ; submit ( req ) ; description = util nullify ( req get parameter ( " description " ) ) ; filter executors = req get parameter ( " filter executors " ) ! = null ; filter queue = req get parameter ( " filter queue " ) ! = null ; rename ( req get parameter ( " name " ) ) ; get properties ( ) rebuild ( req , req get submitted form ( ) , get applicable property descriptors ( ) ) ; save ( ) ; form apply success ( " / " + util raw encode ( name ) ) generate response ( req , rsp , this ) ; }


get the do as user name ' actual u g i ' is the ugi of the user creating the client it is possible that the creator of the k m s client provier calls this method on behalf of a proxy user ( the do as user ) in which case this call has to be made as the proxy user

private string get do as user ( ) throws i o exception { user group information current ugi = user group information get current user ( ) ; return ( current ugi get authentication method ( ) = = user group information authentication method proxy ) ? current ugi get short user name ( ) : null ; }


formatted time string to the milliseconds the pattern is { @ code yyyy - mm - dd hh : mm : ss }

public static long string 2 millis ( final string time ) { return string 2 millis ( time , get default format ( ) ) ; }


public static byte [ ] copy to bytes ( memory segment [ ] segments , int offset , int num bytes ) { return copy to bytes ( segments , offset , new byte [ num bytes ] , 0 , num bytes ) ; }


public test string overloads view model title via value shortcut ( @ string res int string res ) { on mutation ( ) ; assigned attributes epoxy generated model set ( 2 ) ; title via value shortcut string attribute data set value ( string res ) ; return this ; }


finds a { @ link abstract project } whose name ( when referenced from the specified context ) is closest to the given name

public static @ check for null abstract project find nearest ( string name , item group context ) { return items find nearest ( abstract project class , name , context ) ; }


protected object run ( ) throws exception { logger debug ( " execute command : { } " , get command key ( ) name ( ) ) ; return process ( new action ( ) { @ override object execute ( ) { return get command action ( ) execute ( get execution type ( ) ) ; } } ) ; }


marks the stack entry after the given offset

private void mark stack entry after ( int instruction offset , int stack index ) { if ( ! is stack entry necessary after ( instruction offset , stack index ) ) { if ( debug ) system out print ( " [ " + instruction offset + " s " + stack index + " ] , " ) ; stacks necessary after [ instruction offset ] [ stack index ] = true ; if ( max marked offset < instruction offset ) { max marked offset = instruction offset ; } } }


{ @ inherit doc } the default implementation does nothing

@ override public void enter value expression default ( sql base parser value expression default context ctx ) { }


the timeout for waiting the exit code file is configured as 4 seconds , and the tests create it after 3 seconds the ce should successfully reacquire the container

public void test acquire with exit code timeout ( ) throws exception { application id app id = application id new instance ( 12345 , 67890 ) ; application attempt id attempt id = application attempt id new instance ( app id , 54321 ) ; container id cid = container id new container id ( attempt id , 9876 ) ; container executor mock c e = spy ( container executor ) ; file root = new file ( system get property ( " test build data " , " / tmp " ) ) ; file test dir = new file ( root , test container executor class get name ( ) ) get absolute file ( ) ; file pid file = new file ( test dir , " pid " ) ; path pid path = new path ( pid file to string ( ) ) ; do return ( pid path ) when ( mock c e ) get pid file path ( cid ) ; do return ( false ) when ( mock c e ) is container alive ( any ( ) ) ; do return ( true ) when ( mock c e ) is container active ( cid ) ; configuration conf = new yarn configuration ( ) ; conf set int ( yarn configuration nm container executor exit file timeout , 4000 ) ; mock c e set conf ( conf ) ; string exit code file string = container launch get exit code file ( pid file to string ( ) ) ; file exit code file = new file ( exit code file string ) ; timer timer = new timer ( ) ; try { int written exit code = 10 ; file utils write string to file ( pid file , " 2992 " , charset default charset ( ) , false ) ; timer task task = new java util timer task ( ) { @ override public void run ( ) { try { file utils write string to file ( exit code file , integer to string ( written exit code ) , charset default charset ( ) , false ) ; } catch ( i o exception ioe ) { log warn ( " could not write pid file " ) ; } } } ; timer schedule ( task , 3000 ) ; int return code = mock c e reacquire container ( new container reacquisition context builder ( ) set user ( " foouser " ) set container id ( cid ) build ( ) ) ; assert equals ( written exit code , return code ) ; } finally { timer cancel ( ) ; if ( test dir exists ( ) ) { file utils delete quietly ( test dir ) ; } } }


assert a cookie ' s max age with a hamcrest { @ link matcher }

public result matcher max age ( string name , matcher < ? super integer > matcher ) { return result - > { cookie cookie = get cookie ( result , name ) ; assert that ( " response cookie ' " + name + " ' max age " , cookie get max age ( ) , matcher ) ; } ; }


public void basic echo ( ) throws exception { final int message size = 64 * 1024 ; final int transfer limit = message size * 16 ; final meter rate 1 = metrics new meter ( nio udt message rendezvous channel test class , " send rate " , " bytes " , time unit seconds ) ; final meter rate 2 = metrics new meter ( nio udt message rendezvous channel test class , " send rate " , " bytes " , time unit seconds ) ; final inet socket address addr 1 = unit help local socket address ( ) ; final inet socket address addr 2 = unit help local socket address ( ) ; final echo byte handler handler 1 = new echo byte handler ( rate 1 , message size ) ; final echo byte handler handler 2 = new echo byte handler ( rate 2 , message size ) ; final nio event loop group group 1 = new nio event loop group ( 1 , executors default thread factory ( ) , nio udt provider byte provider ) ; final nio event loop group group 2 = new nio event loop group ( 1 , executors default thread factory ( ) , nio udt provider byte provider ) ; final bootstrap boot 1 = new bootstrap ( ) ; boot 1 group ( group 1 ) channel factory ( nio udt provider byte rendezvous ) local address ( addr 1 ) remote address ( addr 2 ) handler ( handler 1 ) ; final bootstrap boot 2 = new bootstrap ( ) ; boot 2 group ( group 1 ) channel factory ( nio udt provider byte rendezvous ) local address ( addr 2 ) remote address ( addr 1 ) handler ( handler 2 ) ; final channel future connect future 1 = boot 1 connect ( ) ; final channel future connect future 2 = boot 2 connect ( ) ; while ( handler 1 meter ( ) count ( ) < transfer limit & & handler 2 meter ( ) count ( ) < transfer limit ) { log info ( " progress : { } { } " , handler 1 meter ( ) count ( ) , handler 2 meter ( ) count ( ) ) ; thread sleep ( 1000 ) ; } connect future 1 channel ( ) close ( ) sync ( ) ; connect future 2 channel ( ) close ( ) sync ( ) ; log info ( " handler 1 : { } " , handler 1 meter ( ) count ( ) ) ; log info ( " handler 2 : { } " , handler 2 meter ( ) count ( ) ) ; assert true ( handler 1 meter ( ) count ( ) > = transfer limit ) ; assert true ( handler 2 meter ( ) count ( ) > = transfer limit ) ; assert equals ( handler 1 meter ( ) count ( ) , handler 2 meter ( ) count ( ) ) ; group 1 shutdown gracefully ( ) ; group 2 shutdown gracefully ( ) ; group 1 termination future ( ) sync ( ) ; group 2 termination future ( ) sync ( ) ; }


create an array of descriptors representing the parameter types for the supplied method returns a zero sized array if there are no parameters

public static string [ ] to param descriptors ( method method ) { return to descriptors ( method get parameter types ( ) ) ; }


create a new { @ link metadata input buffer } and copy { @ code data } into the backing { @ link byte buffer }

private static metadata input buffer create metadata input buffer ( byte [ ] data ) { metadata input buffer buffer = new metadata input buffer ( ) ; buffer data = byte buffer allocate ( data length ) put ( data ) ; buffer data flip ( ) ; return buffer ; }


private high symbol parse symbol x m l ( xml pull parser parser ) throws pcode x m l exception { high symbol res = high symbol restore map sym x m l ( parser , false , func ) ; insert symbol ( res ) ; return res ; }


public fid hash quad hash ( function func ) throws memory access exception ;


verify that the specified root directory passes all criteria to be an indexed filesystem

static int verify indexed file structure ( file root ) throws index read exception { int item count = 0 ; for ( file f : root list files ( ) ) { if ( f is directory ( ) ) { if ( ! is hidden dir name ( f get name ( ) ) ) { item count + = verify indexed directory ( f ) ; } } else { string fname = f get name ( ) ; if ( fname ends with ( property ext ) ) { throw new index read exception ( " unexpected property file in filesystem root : " + fname ) ; } } } return item count ; }


public void add section ( string name , string login module name , final map < string , string > conf ) { app configuration entry [ ] entries = new app configuration entry [ 1 ] ; entries [ 0 ] = new app configuration entry ( login module name , login module control flag required , conf ) ; this sections put ( name , entries ) ; }


set the selector that decides which node can run this request

public void set node selector ( node selector node selector ) { this node selector = node selector ; }


opens the hash join this method reads the build - side input and constructs the initial hash table , gradually spilling partitions that do not fit into memory

public void open ( final mutable object iterator < bt > build side , final mutable object iterator < pt > probe side ) throws i o exception { open ( build side , probe side , false ) ; }


a utility method to analyze the exceptions and collect the clauses

public static list < throwable > get exception causes ( throwable e , list < throwable > causes ) { if ( e get cause ( ) = = null ) { return causes ; } else { causes add ( e get cause ( ) ) ; get exception causes ( e get cause ( ) , causes ) ; } return causes ; }


tests whether the given flag is off if the flag is not a power of 2 ( ie 3 ) this tests whether the combination of flags is off

private boolean is off ( long flag ) { return ( options & flag ) = = 0 ; }


get parameters from the specified query string

public static multi value map < string , string > get parameters ( string query string ) { return get parameters ( delimited list to string array ( query string , and ) ) ; }


fixup all composites and thier components which may be affected by a data organization change include primitive type size changes and alignment changes it is highly recommended that this program be open with exclusive access before invoking this method to avoid excessive merge conflicts with other users

public void fixup composites ( task monitor monitor ) throws cancelled exception { lock acquire ( ) ; try { / / note : any composite could be indirectly affected by a component size change / / based upon type relationships / / note : composites brought in from archive may have incorrect component size / / if not aligned and should not be used to guage a primitive size change / / unfortunately parent table does not track use of primitives so a brute / / force search is required since all composites must be checked , this / / is combined with the composite graph generation to get ordered list / / of composites for subsequent size change operation list < composite d b > ordered composites = get all composites in post dependency order ( monitor ) ; monitor set progress ( 0 ) ; monitor set maximum ( ordered composites size ( ) ) ; monitor set message ( " updating datatype sizes " ) ; int count = 0 ; for ( composite d b c : ordered composites ) { monitor check canceled ( ) ; c fixup components ( ) ; monitor set progress ( + + count ) ; } } finally { lock release ( ) ; } }


public void test nested sort ( ) throws i o exception , interrupted exception , execution exception { assert acked ( prepare create ( " test " ) set mapping ( x content factory json builder ( ) start object ( ) start object ( " doc " ) start object ( " properties " ) start object ( " nested " ) field ( " type " , " nested " ) start object ( " properties " ) start object ( " foo " ) field ( " type " , " text " ) field ( " fielddata " , true ) start object ( " fields " ) start object ( " sub " ) field ( " type " , " keyword " ) end object ( ) end object ( ) end object ( ) start object ( " bar " ) field ( " type " , " nested " ) start object ( " properties " ) start object ( " foo " ) field ( " type " , " text " ) field ( " fielddata " , true ) start object ( " fields " ) start object ( " sub " ) field ( " type " , " keyword " ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) ) ) ; ensure green ( ) ; client ( ) prepare index ( " test " ) set id ( " 1 " ) set source ( json builder ( ) start object ( ) start array ( " nested " ) start object ( ) field ( " foo " , " bar bar " ) end object ( ) start object ( ) field ( " foo " , " abc abc " ) end object ( ) end array ( ) end object ( ) ) get ( ) ; client ( ) prepare index ( " test " ) set id ( " 2 " ) set source ( json builder ( ) start object ( ) start array ( " nested " ) start object ( ) field ( " foo " , " abc abc " ) end object ( ) start object ( ) field ( " foo " , " cba bca " ) end object ( ) end array ( ) end object ( ) ) get ( ) ; refresh ( ) ; / / we sort on nested field search response search response = client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested foo " ) set nested sort ( new nested sort builder ( " nested " ) ) order ( sort order desc ) ) get ( ) ; assert no failures ( search response ) ; search hit [ ] hits = search response get hits ( ) get hits ( ) ; assert that ( hits length , is ( 2 ) ) ; assert that ( hits [ 0 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 1 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 0 ] get sort values ( ) [ 0 ] , is ( " cba " ) ) ; assert that ( hits [ 1 ] get sort values ( ) [ 0 ] , is ( " bar " ) ) ; / / we sort on nested fields with max children limit search response = client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested foo " ) set nested sort ( new nested sort builder ( " nested " ) set max children ( 1 ) ) order ( sort order desc ) ) get ( ) ; assert no failures ( search response ) ; hits = search response get hits ( ) get hits ( ) ; assert that ( hits length , is ( 2 ) ) ; assert that ( hits [ 0 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 1 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 0 ] get sort values ( ) [ 0 ] , is ( " bar " ) ) ; assert that ( hits [ 1 ] get sort values ( ) [ 0 ] , is ( " abc " ) ) ; { search phase execution exception exc = expect throws ( search phase execution exception class , ( ) - > client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested bar foo " ) set nested sort ( new nested sort builder ( " nested " ) set nested sort ( new nested sort builder ( " nested bar " ) set max children ( 1 ) ) ) order ( sort order desc ) ) get ( ) ) ; assert that ( exc to string ( ) , contains string ( " max children is only supported on top level of nested sort " ) ) ; } / / we sort on nested sub field search response = client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested foo sub " ) set nested sort ( new nested sort builder ( " nested " ) ) order ( sort order desc ) ) get ( ) ; assert no failures ( search response ) ; hits = search response get hits ( ) get hits ( ) ; assert that ( hits length , is ( 2 ) ) ; assert that ( hits [ 0 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 1 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 0 ] get sort values ( ) [ 0 ] , is ( " cba bca " ) ) ; assert that ( hits [ 1 ] get sort values ( ) [ 0 ] , is ( " bar bar " ) ) ; / / missing nested path search phase execution exception exc = expect throws ( search phase execution exception class , ( ) - > client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested foo " ) ) get ( ) ) ; assert that ( exc to string ( ) , contains string ( " it is mandatory to set the [ nested ] context " ) ) ; }


call this to set the phase of the listing merge that you are in currently

void set conflict type ( string conflict type ) { this conflict type = conflict type ; titled border t border = ( titled border ) get border ( ) ; t border set title ( " resolve " + conflict type + " conflict " ) ; }


returns a single server , or else a not found code

public void get server ( io grpc channelz v 1 get server request request , io grpc stub stream observer < io grpc channelz v 1 get server response > response observer ) { io grpc stub client calls async unary call ( get channel ( ) new call ( get get server method ( ) , get call options ( ) ) , request , response observer ) ; }


the integer arg of port should fit in a 1 6bit unsigned value

@ test public void new builder with port too high is invalid ( ) { thrown expect ( illegal argument exception class ) ; thrown expect message ( " invalid port 65536 " ) ; endpoint new builder ( ) port ( 65536 ) build ( ) ; }


log a message at the specified { @ code level } according to the specified format and arguments < p > this form avoids superfluous object creation when the logger is disabled for the specified { @ code level }

void log ( internal log level level , string format , object arg a , object arg b ) ;


set the throttling factor on requests and number of calls to throttle

protected void set throttling ( float p , int limit ) { if ( inconsistent client ! = null ) { inconsistent client set throttle probability ( p ) ; } set failure limit ( limit ) ; }


swap the linkages of two nodes in a tree

private void swap position ( r b node x , r b node y ) { / / save initial values r b node px = x parent , lx = x left , rx = x right ; r b node py = y parent , ly = y left , ry = y right ; boolean x was left child = px ! = null & & x = = px left ; boolean y was left child = py ! = null & & y = = py left ; / / swap , handling special cases of one being the other ' s parent if ( x = = py ) { / / x was y ' s parent x parent = y ; if ( y was left child ) { y left = x ; y right = rx ; } else { y right = x ; y left = lx ; } } else { x parent = py ; if ( py ! = null ) { if ( y was left child ) { py left = x ; } else { py right = x ; } } y left = lx ; y right = rx ; } if ( y = = px ) { / / y was x ' s parent y parent = x ; if ( x was left child ) { x left = y ; x right = ry ; } else { x right = y ; x left = ly ; } } else { y parent = px ; if ( px ! = null ) { if ( x was left child ) { px left = y ; } else { px right = y ; } } x left = ly ; x right = ry ; } / / fix children ' s parent pointers if ( x left ! = null ) { x left parent = x ; } if ( x right ! = null ) { x right parent = x ; } if ( y left ! = null ) { y left parent = y ; } if ( y right ! = null ) { y right parent = y ; } / / swap colors byte c = x color ; x color = y color ; y color = c ; / / check if root changed if ( root = = x ) { root = y ; } else if ( root = = y ) { root = x ; } }


chooses the bit position that minimizes the number of false negative generated while maximizing the number of false positive removed

private int ratio remove ( int [ ] h ) { compute ratio ( ) ; int min index = integer max value ; double min value = double max value ; for ( int i = 0 ; i < nb hash ; i + + ) { if ( ratio [ h [ i ] ] < min value ) { min value = ratio [ h [ i ] ] ; min index = h [ i ] ; } } return min index ; }


tests the making of a new directory which is not matching to any of internal directory

public void test create new file with out matching to mount dir or fallback dir path ( ) throws exception { configuration conf = new configuration ( ) ; config util add link ( conf , " / user 1 / hive / warehouse / partition - 0 " , new path ( target test root to string ( ) ) to uri ( ) ) ; path fallback target = new path ( target test root , " fallback dir " ) ; fs target mkdirs ( fallback target ) ; config util add link fallback ( conf , fallback target to uri ( ) ) ; try ( file system vfs = file system get ( view fs default cluster uri , conf ) ) { path vfs test file = new path ( " / user 2 / test file " ) ; path test file in fallback = path merge paths ( fallback target , vfs test file ) ; assert false ( fs target exists ( test file in fallback ) ) ; / / user 2 does not exist in fallback assert false ( fs target exists ( test file in fallback get parent ( ) ) ) ; vfs create ( vfs test file ) close ( ) ; / / / user 2 / test file should be created in fallback assert true ( fs target exists ( test file in fallback ) ) ; } }


private j s o n writer append ( string s ) throws j s o n exception { if ( s = = null ) { throw new j s o n exception ( " null pointer " ) ; } if ( this mode = = ' o ' | | this mode = = ' a ' ) { try { if ( this comma & & this mode = = ' a ' ) { this writer write ( ' , ' ) ; } this writer write ( s ) ; } catch ( i o exception e ) { throw new j s o n exception ( e ) ; } if ( this mode = = ' o ' ) { this mode = ' k ' ; } this comma = true ; return this ; } throw new j s o n exception ( " value out of sequence " ) ; }


public int get overlay color ( ) { return m overlay color ; }


empty implementation to satisfy the build listener interface

public void target finished ( build event event ) { / / not significant for the class loader }


public task type get task type ( ) { return task type ; }


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


< code > required string message = 1 ; < code >

public com google protobuf byte string get message bytes ( ) { object ref = message ; if ( ref instanceof string ) { com google protobuf byte string b = com google protobuf byte string copy from utf 8 ( ( string ) ref ) ; message = b ; return b ; } else { return ( com google protobuf byte string ) ref ; } }


return a new path parent iterator that iterates from the given path to all parents

public static path parent iterator for all ( string path ) { return new path parent iterator ( path , integer max value ) ; }


returns the string array at the given row , column

public string [ ] get string array ( int row , int col ) { string array array saa = ( string array array ) data columns [ col ] ; return saa get ( row ) ; }


the task runner passes in the options as system properties set the options if the setters haven ' t already been called

private synchronized void set options from system properties ( ) { if ( is cleanup = = null ) { string prop value = system get property ( iscleanup property , " false " ) ; is cleanup = boolean value of ( prop value ) ; } if ( task id = = null ) { task id = system get property ( taskid property ) ; } if ( max events = = null ) { string prop value = system get property ( logsize property , " 0 " ) ; set total log file size ( long parse long ( prop value ) ) ; } }


formats a number into the specified string buffer

public string buffer format ( double number , string buffer to append to , field position pos ) { return to append to append ( runtime utils format execution time ( ( long ) number ) ) ; }


make the given constructor accessible , explicitly setting it accessible if necessary the { @ code set accessible ( true ) } method is only called when actually necessary , to avoid unnecessary conflicts with a jvm security manager ( if active )

public static void make accessible ( constructor < ? > ctor ) { if ( ( ! modifier is public ( ctor get modifiers ( ) ) | | ! modifier is public ( ctor get declaring class ( ) get modifiers ( ) ) ) & & ! ctor is accessible ( ) ) { ctor set accessible ( true ) ; } } / / method handling


tests that free slots which are reported as allocated won ' t be considered for fulfilling other pending slot requests see : flink - 8505

public void test report allocated slot ( ) throws exception { final resource i d task manager id = resource i d generate ( ) ; final testing task executor gateway task executor gateway = new testing task executor gateway builder ( ) create testing task executor gateway ( ) ; final task executor connection task executor connection = new task executor connection ( task manager id , task executor gateway ) ; final resource tracker resource tracker = new default resource tracker ( ) ; final default slot tracker slot tracker = new default slot tracker ( ) ; try ( declarative slot manager slot manager = create declarative slot manager builder ( ) set resource tracker ( resource tracker ) set slot tracker ( slot tracker ) build and start with direct exec ( ) ) { / / initially report a single slot as free final slot i d slot id = new slot i d ( task manager id , 0 ) ; final slot report initial slot report = new slot report ( create free slot status ( slot id ) ) ; slot manager register task manager ( task executor connection , initial slot report , resource profile any , resource profile any ) ; assert that ( slot manager get number registered slots ( ) , is ( equal to ( 1 ) ) ) ; / / now report this slot as allocated final slot status slot status = create allocated slot status ( slot id ) ; final slot report slot report = new slot report ( slot status ) ; slot manager report slot status ( task executor connection get instance i d ( ) , slot report ) ; final job i d job id = new job i d ( ) ; / / this resource requirement should not be fulfilled resource requirements requirements = create resource requirements for single slot ( job id ) ; slot manager process resource requirements ( requirements ) ; assert that ( slot tracker get slot ( slot id ) get job id ( ) , is ( slot status get job i d ( ) ) ) ; assert that ( get total resource count ( resource tracker get missing resources ( ) get ( job id ) ) , is ( 1 ) ) ; } }


sets a configuration property with the specified name and value to override this method properly , you must call the super class : public boolean set option ( channel option & lt ; t & gt ; option , t value ) { if ( super set option ( option , value ) ) { return true ; } if ( option equals ( additional option ) ) { return true ; } return false ; }

< t > boolean set option ( channel option < t > option , t value ) ;


schedules a task on { @ link # instance }

static public task schedule ( task task , float delay seconds , float interval seconds ) { return instance ( ) schedule task ( task , delay seconds , interval seconds ) ; }


final boolean cas base ( long cmp , long val ) { return unsafe compare and swap long ( this , base offset , cmp , val ) ; }


public synchronized int get min buffer size ( ) { return min buffer size ; }


writes the pixmap as a png with compression see { @ link png } to configure the compression level , more efficiently flip the pixmap vertically , and to write out multiple p n gs with minimal allocation

static public void write p n g ( file handle file , pixmap pixmap ) { write p n g ( file , pixmap , deflater default compression , false ) ; }


iterate over all the unique index field values index values are returned in an ascending sorted order with the initial iterator position set to the minimum index value

public d b field iterator index field iterator ( int column index ) throws i o exception { synchronized ( db ) { index table index table = secondary indexes get ( column index ) ; if ( index table = = null ) { throw new i o exception ( " index required ( " + get name ( ) + " , " + column index + " ) " ) ; } return index table index iterator ( ) ; } }


test the important case where the invocation is on a proxied interface method but the attribute is defined on the target class

public void transaction attribute declared on cglib class method ( ) throws exception { method class method = i test bean 1 class get method ( " get age " ) ; test bean 1 tb = new test bean 1 ( ) ; proxy factory pf = new proxy factory ( tb ) ; pf set proxy target class ( true ) ; object proxy = pf get proxy ( ) ; annotation transaction attribute source atas = new annotation transaction attribute source ( ) ; transaction attribute actual = atas get transaction attribute ( class method , proxy get class ( ) ) ; rule based transaction attribute rbta = new rule based transaction attribute ( ) ; rbta get rollback rules ( ) add ( new rollback rule attribute ( exception class ) ) ; assert that ( ( ( rule based transaction attribute ) actual ) get rollback rules ( ) ) is equal to ( rbta get rollback rules ( ) ) ; }


public list < item update > evaluate ( project project , engine engine ) { return evaluate ( project , engine , null ) ; }


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 lottery numbers get numbers ( ) { return lottery numbers ; }


public string get name ( clazz clazz ) { return clazz get string ( u 2name index ) ; }


the maximum number of requests allowed in a batch before triggering a batch execution

public hystrix property < integer > max requests in batch ( ) { return max requests in batch ; }


returns whether this data entry is an output entry

public boolean is output ( ) { return output ; }


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