sets required properties to reasonable defaults and logs it

private static void set required properties ( properties zk props ) { / / set default client port if ( zk props get property ( " client port " ) = = null ) { zk props set property ( " client port " , string value of ( default zookeeper client port ) ) ; log warn ( " no ' client port ' configured set to ' { } ' " , default zookeeper client port ) ; } / / set default init limit if ( zk props get property ( " init limit " ) = = null ) { zk props set property ( " init limit " , string value of ( default zookeeper init limit ) ) ; log warn ( " no ' init limit ' configured set to ' { } ' " , default zookeeper init limit ) ; } / / set default sync limit if ( zk props get property ( " sync limit " ) = = null ) { zk props set property ( " sync limit " , string value of ( default zookeeper sync limit ) ) ; log warn ( " no ' sync limit ' configured set to ' { } ' " , default zookeeper sync limit ) ; } / / set default data dir if ( zk props get property ( " data dir " ) = = null ) { string data dir = string format ( " % s / % s / zookeeper " , system get property ( " java io tmpdir " ) , uuid random u u i d ( ) to string ( ) ) ; zk props set property ( " data dir " , data dir ) ; log warn ( " no ' data dir ' configured set to ' { } ' " , data dir ) ; } int peer port = default zookeeper peer port ; int leader port = default zookeeper leader port ; / / set peer and leader ports if none given , because zoo keeper complains if multiple / / servers are configured , but no ports are given for ( map entry < object , object > entry : zk props entry set ( ) ) { string key = ( string ) entry get key ( ) ; if ( entry get key ( ) to string ( ) starts with ( " server " ) ) { string value = ( string ) entry get value ( ) ; string [ ] parts = value split ( " : " ) ; if ( parts length = = 1 ) { string address = string format ( " % s : % d : % d " , parts [ 0 ] , peer port , leader port ) ; zk props set property ( key , address ) ; log info ( " set peer and leader port of ' { } ' : ' { } ' = > ' { } ' " , key , value , address ) ; } else if ( parts length = = 2 ) { string address = string format ( " % s : % d : % d " , parts [ 0 ] , integer value of ( parts [ 1 ] ) , leader port ) ; zk props set property ( key , address ) ; log info ( " set peer port of ' { } ' : ' { } ' = > ' { } ' " , key , value , address ) ; } } } }


private static string exception to string ( throwable t ) { string writer string writer = new string writer ( ) ; print writer writer = new print writer ( string writer ) ; t print stack trace ( writer ) ; return string writer to string ( ) ; }


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


extractor that returns the raw { @ link data buffer data buffers } note : the data buffers should be { @ link org springframework core io buffer data buffer utils # release ( data buffer ) released } after being used

public static body extractor < flux < data buffer > , reactive http input message > to data buffers ( ) { return ( input message , context ) - > input message get body ( ) ; }


locates the value of a descriptor based on values attached to both the getter and setter methods if both have values supplied then the value attached to the getter is preferred

private object resolve object descriptor ( @ nullable object getter , @ nullable object setter ) { return ( getter ! = null ? getter : setter ) ; }


returns the name of the metric ( which may differ to the writeable name )


this method is still used by production so we benchmark it see https : issues apache orgjirabrowse k a f k a - 10730

private static produce response response ( ) { return new produce response ( partition response map ) ; }


public void incr authorization successes ( ) { rpc authorization successes incr ( ) ; }


see { @ link args # get synchronization context } this is a required field

public builder set synchronization context ( synchronization context sync context ) { this sync context = check not null ( sync context ) ; return this ; }


public string encoding ( ) { return encoding ; }


add or update an domain if the domain already exists , only the owner and the admin can update it

public void put domain ( timeline domain domain , user group information caller u g i ) throws yarn exception , i o exception { long start time = time monotonic now ( ) ; metrics incr put domain ops ( ) ; try { do put domain ( domain , caller u g i ) ; } finally { metrics add put domain time ( time monotonic now ( ) - start time ) ; } }


validates that schemes other than ' file : ' are not allowed

public void test non file scheme path ( ) throws exception { string checkpoint path = temp folder new folder ( ) to u r i ( ) to string ( ) ; rocks d b state backend rocks db backend = new rocks d b state backend ( checkpoint path ) ; rocks db backend set db storage path ( " hdfs : / / / some / path / to / perdition " ) ; }


return the value of the first ( and maybe only ) text field

public string get value ( ) { return input values [ 0 ] ; }


determine whether the element ' s " name " attribute should get parsed as bean definition aliases , i e alternative bean definition names the default implementation returns { @ code true }

protected boolean should parse name as aliases ( ) { return true ; }


saves the current configuration state of this panel

public void write config state ( string prefix , save state save state ) { save state put boolean ( prefix + dual listing side by side , is side by side ( ) ) ; save state put boolean ( prefix + dual listing header showing , is header showing ( ) ) ; }


check whether the given bean type should be advised by this { @ code controller advice bean }

public boolean is applicable to bean type ( @ nullable class < ? > bean type ) { return this bean type predicate test ( bean type ) ; }


set the aliastype map , consisting of string aliases mapped to classes keys are aliases ; values are either { @ code class } instances , or string class names

public void set aliases ( map < string , ? > aliases ) { this aliases = aliases ; }


dynamically creates a runtime field from a parsed date value

runtime field type new dynamic date field ( string name , date formatter date formatter ) ;


public long get max lifetime ( ) { return max lifetime ; }


public set < requested global properties > get global properties ( ) { return this global props ; }


find the fields constant that matches field id , or null if its not found

public static fields find by thrift id ( int field id ) { switch ( field id ) { case 1 : / / function name return function name ; case 2 : / / func args return func args ; default : return null ; } }


returns the time to wait ( if any ) for the given length message , using the given limit traffic and the max wait time

public long read time to wait ( final long size , final long limit traffic , final long max time , final long now ) { bytes recv flow control ( size ) ; if ( size = = 0 | | limit traffic = = 0 ) { return 0 ; } final long last time check = last time get ( ) ; long sum = current read bytes get ( ) ; long local reading time = reading time ; long last r b = last read bytes ; final long interval = now - last time check ; long past delay = math max ( last reading time - last time check , 0 ) ; if ( interval > abstract traffic shaping handler minimal wait ) { / / enough interval time to compute shaping long time = sum * 1000 / limit traffic - interval + past delay ; if ( time > abstract traffic shaping handler minimal wait ) { if ( logger is debug enabled ( ) ) { logger debug ( " time : " + time + ' : ' + sum + ' : ' + interval + ' : ' + past delay ) ; } if ( time > max time & & now + time - local reading time > max time ) { time = max time ; } reading time = math max ( local reading time , now + time ) ; return time ; } reading time = math max ( local reading time , now ) ; return 0 ; } / / take the last read interval check to get enough interval time long lastsum = sum + last r b ; long lastinterval = interval + check interval get ( ) ; long time = lastsum * 1000 / limit traffic - lastinterval + past delay ; if ( time > abstract traffic shaping handler minimal wait ) { if ( logger is debug enabled ( ) ) { logger debug ( " time : " + time + ' : ' + lastsum + ' : ' + lastinterval + ' : ' + past delay ) ; } if ( time > max time & & now + time - local reading time > max time ) { time = max time ; } reading time = math max ( local reading time , now + time ) ; return time ; } reading time = math max ( local reading time , now ) ; return 0 ; }


the public factory method to construct { @ link shadowed api adapters generator }

public static shadowed api adapters generator create ( invocation site transformation record call site transformations ) { return emit class writers ( call site transformations ) emit adapter methods ( ) close class writers ( ) ; }


test for issue https : github comgrpcgrpc - javaissues 6 1 5

public void complete without close ( ) { stream transport state ( ) set listener ( new server stream listener base ( ) ) ; / / test that it doesn ' t throw an exception stream close ( status ok , new metadata ( ) ) ; stream transport state ( ) complete ( ) ; }


boolean is null ( ) { return null equals ( this ) ; }


method used to terminate the health monitoring service

protected void service stop ( ) throws exception { if ( timer ! = null ) { timer cancel ( ) ; } super service stop ( ) ; }


does nothing if no { @ link go to service } has been installed from { @ link # install navigation ( go to service , navigatable ) } also , this method will do nothing if this table ' s < code > table model < code > is not an instance of { @ link program table model } otherwise , this method will attempt to go to the program location denoted by the given row and column

public void navigate ( int row , int column ) { if ( navigatable = = null ) { return ; } column = convert column index to model ( column ) ; if ( row < 0 | | column < 0 ) { return ; } if ( ! ( data model instanceof program table model ) ) { return ; } program table model ptm = ( program table model ) data model ; program location loc = ptm get program location ( row , column ) ; if ( loc ! = null & & loc get address ( ) is external address ( ) ) { goto service go to ( loc get address ( ) , ptm get program ( ) ) ; return ; } program program = ptm get program ( ) ; goto service go to ( navigatable , loc , program ) ; }


get a shared copy of the aws credentials , with its reference counter updated caller is required to call { @ code close ( ) } on this after they have finished using it

public a w s credential provider list share credentials ( final string purpose ) { log debug ( " sharing credentials for : { } " , purpose ) ; return credentials share ( ) ; }


public model and view get model and view ( final http servlet request request , final boolean is success , final web application service service , final class owner class ) { val view = get view ( request , is success , service , owner class ) ; return new model and view ( view ) ; }


public client response response ( ) { return this delegate ; }


returns whether the linux sandbox is supported on the local machine by running a small command in it

public static boolean is supported ( final command environment cmd env ) throws interrupted exception { if ( os get current ( ) ! = os linux ) { return false ; } if ( ! linux sandbox util is supported ( cmd env ) ) { return false ; } path linux sandbox = linux sandbox util get linux sandbox ( cmd env ) ; boolean is supported ; synchronized ( is supported map ) { is supported = is supported map get ( linux sandbox ) ; if ( is supported ! = null ) { return is supported ; } is supported = compute is supported ( cmd env , linux sandbox ) ; is supported map put ( linux sandbox , is supported ) ; } return is supported ; }


namespaces defined on this element < code > repeated aapt pb xml namespace namespace declaration = 1 ; < code >

private void remove namespace declaration ( int index ) { ensure namespace declaration is mutable ( ) ; namespace declaration remove ( index ) ; }


gets the target as a relative offset from the given address

public final int get target ( int base address ) { return target - base address ; }


public float get particle damping ( ) { return m particle system get particle damping ( ) ; }


delete a path , catching any exception and downgrading to a log message

public static void delete quietly ( file system fs , path path , boolean recursive ) throws i o exception { if ( fs ! = null & & path ! = null ) { try { fs delete ( path , recursive ) ; } catch ( i o exception e ) { log warn ( " when deleting { } " , path , e ) ; } } }


name of pattern that processing will be skipped to

public optional < string > get pattern name ( ) { return optional empty ( ) ; }


public static fields find by thrift id ( int field id ) { switch ( field id ) { case 1 : / / e return e ; case 2 : / / ite return ite ; default : return null ; } }


quote a string the string is quoted only if quoting is required due to embedded delimiters , quote characters or the empty string

public static string quote ( string s ) { if ( s = = null ) return null ; if ( s length ( ) = = 0 ) return " \ " \ " " ; string buffer b = new string buffer ( s length ( ) + 8 ) ; quote ( b , s ) ; return b to string ( ) ; }


private void corrupt f s image m d 5 ( boolean corrupt all ) throws i o exception { list < uri > name dirs = ( list < uri > ) f s namesystem get namespace dirs ( config ) ; / / corrupt the md 5 files in all the namedirs for ( uri uri : name dirs ) { / / directory layout looks like : / / test / data / dfs / name n / current / { fsimage , edits , } file name dir = new file ( uri get path ( ) ) ; file dfs dir = name dir get parent file ( ) ; assert equals ( dfs dir get name ( ) , " dfs " ) ; / / make sure we got right dir / / set the md 5 file to all zeros file image file = new file ( name dir , storage storage dir current + " / " + n n storage get image file name ( 0 ) ) ; m d 5 file utils save m d 5 file ( image file , new m d 5 hash ( new byte [ 16 ] ) ) ; / / only need to corrupt one if ! corrupt all if ( ! corrupt all ) { break ; } } }


for each renderer of type { @ link c # track type none } that was enabled , we will associate it with an { @ link empty sample stream }

private void associate no sample renderers with empty sample stream ( @ nullable type sample stream [ ] sample streams ) { for ( int i = 0 ; i < renderer capabilities length ; i + + ) { if ( renderer capabilities [ i ] get track type ( ) = = c track type none & & track selector result is renderer enabled ( i ) ) { sample streams [ i ] = new empty sample stream ( ) ; } } }


set ( fake ) ha so that edit logs will not be loaded

static void set ha conf ( string ns id , configuration conf ) { conf set ( d f s config keys dfs nameservices , ns id ) ; final string ha n n key = dfs ha namenodes key prefix + " " + ns id ; conf set ( ha n n key , " nn 0 , nn 1 " ) ; final string rpc key = dfs namenode rpc address key + " " + ns id + " " ; conf set ( rpc key + " nn 0 " , " 127 0 0 1 : 8080 " ) ; conf set ( rpc key + " nn 1 " , " 127 0 0 1 : 8080 " ) ; }


read data from the channel to the given byte buffer until there are no bytes remaining in the buffer or the end of the file has been reached

public static void read fully ( file channel channel , byte buffer destination buffer , long position ) throws i o exception { if ( position < 0 ) { throw new illegal argument exception ( " the file channel position cannot be negative , but it is " + position ) ; } long current position = position ; int bytes read ; do { bytes read = channel read ( destination buffer , current position ) ; current position + = bytes read ; } while ( bytes read ! = - 1 & & destination buffer has remaining ( ) ) ; }


ensure our metadata is fresh ( if an update is expected , this will block until it has completed )

boolean ensure fresh metadata ( timer timer ) { if ( this metadata update requested ( ) | | this metadata time to next update ( timer current time ms ( ) ) = = 0 ) { return await metadata update ( timer ) ; } else { / / the metadata is already fresh return true ; } }


test scanning all blocks set the scan period high enough that we should rescan all blocks at least twice during this test

public void test scan all blocks with rescan ( ) throws exception { test scan all blocks impl ( true ) ; }


extractor to read form data into { @ code multi value map < string , string > } as of 5 1 this method can also be used on the client side to read form data from a server response ( e g o auth )

public static body extractor < mono < multi value map < string , string > > , reactive http input message > to form data ( ) { return ( message , context ) - > { resolvable type element type = form data type ; media type media type = media type application form urlencoded ; http message reader < multi value map < string , string > > reader = find reader ( element type , media type , context ) ; return read to mono ( message , context , element type , reader ) ; } ; }


returns the { @ link method } instance for { @ link # test sub list original list set affects sub list ( ) } so that tests of { @ link copy on write array list } can suppress them with { @ code feature specific test suite builder suppressing ( ) } until < a href = " http : bugs sun combugdatabaseview bug do ? bug id = 6570631 " > sun bug 6570631 is fixed

public static method get sub list original list set affects sub list method ( ) { return get method ( list sub list tester class , " test sub list original list set affects sub list " ) ; }


post fakeinline - additional properties : test inline additional properties

default response entity < void > test inline additional properties ( @ api param ( value = " request body " , required = true ) @ valid @ request body map < string , string > param ) { return new response entity < > ( http status not implemented ) ; }


return the bytes of des decryption for base 6 4 - encode bytes

public static byte [ ] decrypt base 6 4 d e s ( final byte [ ] data , final byte [ ] key , final string transformation , final byte [ ] iv ) { return decrypt d e s ( utils bridge base 6 4 decode ( data ) , key , transformation , iv ) ; }


get the long value for an instance setting

public long get long settings value ( address data addr , string name ) { instance settings d b settings = get instance settings d b ( data addr , name ) ; if ( settings ! = null ) { return settings get long value ( ) ; } return null ; }


set the jndi template to use for jndi lookups

public void set jndi template ( jndi template jndi template ) { this jndi locator set jndi template ( jndi template ) ; }


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 " ) ; }


boolean update ( list < modify request > modify requests , bi consumer < boolean , throwable > consumer ) ;


atomically adds the given value to the element at index { @ code i }

public final double get and add ( int i , double delta ) { while ( true ) { long current = longs get ( i ) ; double current val = long bits to double ( current ) ; double next val = current val + delta ; long next = double to raw long bits ( next val ) ; if ( longs compare and set ( i , current , next ) ) { return current val ; } } }


return the default timeout that this transaction manager should apply if there is no timeout specified at the transaction level , in seconds returns { @ code transaction definition timeout default } to indicate the underlying transaction infrastructure ' s default timeout

public final int get default timeout ( ) { return this default timeout ; }


protected class < ? extends annotation > get required annotation type ( ) { return this required annotation type ; }


public boolean get bool item ( ) { return bool item ; }


returns a print stream for the given file , or the standard output if the file name is empty

private print stream create print stream ( file file ) throws file not found exception { return file = = configuration std out ? system out : new print stream ( new buffered output stream ( new file output stream ( file ) ) ) ; }


can be used to check a checkbox by default used from views like { @ code h default to true ( scm use update ) } the expression will evaluate to true if scm is null

public static boolean default to true ( boolean b ) { if ( b = = null ) return true ; return b ; }


file status get file status ( ) { return this fstatus ; }


gets the ip address where the task manager operates

public string address string ( ) { return inet address to string ( ) ; }


returns the nodes absolute data - path the given shard is allocated on or < code > null < code > if the information is not available

public string get data path ( shard routing shard routing ) { return routing to data path get ( shard routing ) ; }


this is basically the " shift - add " algorithm for string matching from the paper " a new approach to text searching " in this case the " alphabet " has just two " characters " : 0 and 1 ( or < code > false < code > and < code > true < code > in some places because of the { @ link bit set } interface )

static int find bit pattern ( bit set find in , int begin index , bit set to find ) { assert begin index > = 0 ; / / note that this only compares up to the highest bit that is set , so trailing non digit characters will not participate / / in the comparison this is not currently a problem for this class , but is something to consider if this functionality / / is ever reused elsewhere the solution would be to use a wrapper class containing a bit set and a separate int to store / / the length to compare int to find length = to find length ( ) ; int find in length = find in length ( ) ; if ( to find length = = 0 ) { return begin index ; } / / 63 here is the largest bit position ( starting from 0 ) in a long if ( to find length > math min ( 63 , find in length ) ) { / / since we control the input we should avoid the situation / / where the pattern to find has more bits than a single long assert to find length < = 63 : " length to find was [ " + to find length + " ] - cannot be greater than 63 " ; return - 1 ; } / / ~ 1l means all bits set except the least significant long state = ~ 1l ; / / this array has one entry per " character " in the " alphabet " ( which for this method consists of just 0 and 1 ) / / ~ 0l means all bits set long [ ] to find mask = { ~ 0l , ~ 0l } ; for ( int i = 0 ; i < to find length ; + + i ) { to find mask [ to find get ( i ) ? 1 : 0 ] & = ~ ( 1l < < i ) ; } for ( int i = begin index ; i < find in length ; + + i ) { state | = to find mask [ find in get ( i ) ? 1 : 0 ] ; state < < = 1 ; if ( ( state & ( 1l < < to find length ) ) = = 0l ) { return i - to find length + 1 ; } } return - 1 ; }


returns the low water mark of the write buffer once the number of bytes queued in the write buffer exceeded the { @ linkplain # set write buffer high water mark ( int ) high water mark } and then dropped down below this value , { @ link channel # is writable ( ) } will start to return { @ code true } again

int get write buffer low water mark ( ) ;


build a ' nested ' accessor for the given message

protected message header accessor create accessor ( message < ? > message ) { return new message header accessor ( message ) ; } / / configuration properties


expect that the cookie with the given name is present

public web test client response spec exists ( string name ) { get cookie ( name ) ; return this response spec ; }


check if hit timeout of retry , if not , throw an exception and start a new round of retry

private void check timeout or retry ( map host host , i o exception ioe ) throws i o exception { / / first time to retry long current time = time monotonic now ( ) ; if ( retry start time = = 0 ) { retry start time = current time ; } / / retry is not timeout , let ' s do retry with throwing an exception if ( current time - retry start time < this fetch retry timeout ) { log warn ( " shuffle output from " + host get host name ( ) + " failed , retry it " , ioe ) ; throw ioe ; } else { / / timeout , prepare to be failed log warn ( " timeout for copying map output with retry on host " + host + " after " + fetch retry timeout + " milliseconds " ) ; } }


set the time the resource was last changed , as specified by the { @ code last - modified } header

public void set if unmodified since ( instant if unmodified since ) { set instant ( if unmodified since , if unmodified since ) ; }


should return a new { @ link # < input > } to which the { @ link layout result visitor } can write into

public @ nullable input create input ( ) { return null ; }


return whether the class with the given name should be loaded in isolation using a plugin classloader

public static boolean should load in isolation ( string name ) { return ! ( exclude matcher ( name ) matches ( ) & & ! include matcher ( name ) matches ( ) ) ; }


return a slice of records from this instance , which is a view into this set starting from the given position and with the given size limit if the size is beyond the end of the file , the end will be based on the size of the file at the time of the read if this message set is already sliced , the position will be taken relative to that slicing

public file records slice ( int position , int size ) throws i o exception { / / cache current size in case concurrent write changes it int current size in bytes = size in bytes ( ) ; if ( position < 0 ) throw new illegal argument exception ( " invalid position : " + position + " in read from " + this ) ; if ( position > current size in bytes - start ) throw new illegal argument exception ( " slice from position " + position + " exceeds end position of " + this ) ; if ( size < 0 ) throw new illegal argument exception ( " invalid size : " + size + " in read from " + this ) ; int end = this start + position + size ; / / handle integer overflow or if end is beyond the end of the file if ( end < 0 | | end > start + current size in bytes ) end = start + current size in bytes ; return new file records ( file , channel , this start + position , end , true ) ; }


abort a multipart upload retry policy : none

void abort multipart upload ( multipart upload upload ) { string dest key ; string upload id ; dest key = upload get key ( ) ; upload id = upload get upload id ( ) ; if ( log is info enabled ( ) ) { date format df = new simple date format ( " yyyy - mm - dd hh : mm : ss " ) ; log debug ( " aborting multipart upload { } to { } initiated by { } on { } " , upload id , dest key , upload get initiator ( ) , df format ( upload get initiated ( ) ) ) ; } get amazon s 3 client ( ) abort multipart upload ( new abort multipart upload request ( get bucket ( ) , dest key , upload id ) ) ; }


protected string produce ticket identifier ( ) { val pgt id = this ticket granting ticket unique ticket id generator get new ticket id ( proxy granting ticket proxy granting ticket prefix ) ; if ( cipher executor = = null | | ! cipher executor is enabled ( ) ) { return pgt id ; } logger debug ( " attempting to encode proxy - granting ticket [ { } ] " , pgt id ) ; val pgt encoded = this cipher executor encode ( pgt id ) ; logger debug ( " encoded proxy - granting ticket id [ { } ] " , pgt encoded ) ; return pgt encoded ; }


returns the { @ link status } of a cancelled context or { @ code null } if the context is not cancelled

public static status status from cancelled ( context context ) { preconditions check not null ( context , " context must not be null " ) ; if ( ! context is cancelled ( ) ) { return null ; } throwable cancellation cause = context cancellation cause ( ) ; if ( cancellation cause = = null ) { return status cancelled with description ( " io grpc context was cancelled without error " ) ; } if ( cancellation cause instanceof timeout exception ) { return status deadline exceeded with description ( cancellation cause get message ( ) ) with cause ( cancellation cause ) ; } status status = status from throwable ( cancellation cause ) ; if ( status code unknown equals ( status get code ( ) ) & & status get cause ( ) = = cancellation cause ) { / / if from throwable could not determine a status , then / / just return cancelled return status cancelled with description ( " context cancelled " ) with cause ( cancellation cause ) ; } return status with cause ( cancellation cause ) ; }


always returns { @ code true } if { @ link # is available ( ) } returns { @ code true }

public static boolean supports hostname validation ( ) { return is available ( ) ; }


return the initial value for an aggregation


if set to true and no custom { @ link object mapper } has been set , a { @ link xml mapper } will be created using its default constructor

public void set create xml mapper ( boolean create xml mapper ) { this builder create xml mapper ( create xml mapper ) ; }


protected < t extends s a m l object > void prepare security parameters context ( final saml registered service service provider metadata facade adaptor , final message context outbound context , final saml registered service service ) { val sec parameters context = outbound context get subcontext ( security parameters context class , true ) ; val role desc = adaptor get sso descriptor ( ) ; val signing parameters = build signature signing parameters ( role desc , service ) ; objects require non null ( sec parameters context ) set signature signing parameters ( signing parameters ) ; }


tests that the { @ link slot report } sent to the rm does not contain out datedstale information as slots are being requested from the tm this is a probabilistic test case and needs to be executed several times to produce a failure without the fix for flink - 12865

public void test slot report does not contain stale information ( ) throws exception { final one shot latch received slot request = new one shot latch ( ) ; final completable future < void > verify slot report future = new completable future < > ( ) ; final one shot latch terminate slot report verification = new one shot latch ( ) ; final testing resource manager gateway testing resource manager gateway = new testing resource manager gateway ( ) ; / / assertions for this test testing resource manager gateway set task executor heartbeat consumer ( ( ignored , heartbeat payload ) - > { try { final array list < slot status > slots = lists new array list ( heartbeat payload get slot report ( ) ) ; assert that ( slots , has size ( 1 ) ) ; final slot status slot status = slots get ( 0 ) ; log info ( " received slot status : { } " , slot status ) ; if ( received slot request is triggered ( ) ) { assert that ( slot status get allocation i d ( ) , is ( not null value ( ) ) ) ; } else { assert that ( slot status get allocation i d ( ) , is ( null value ( ) ) ) ; } } catch ( assertion error e ) { verify slot report future complete exceptionally ( e ) ; } if ( terminate slot report verification is triggered ( ) ) { verify slot report future complete ( null ) ; } } ) ; final completable future < resource i d > task executor registration future = new completable future < > ( ) ; testing resource manager gateway set send slot report function ( ignored - > { task executor registration future complete ( null ) ; return completable future completed future ( acknowledge get ( ) ) ; } ) ; rpc register gateway ( testing resource manager gateway get address ( ) , testing resource manager gateway ) ; resource manager leader retriever notify listener ( testing resource manager gateway get address ( ) , testing resource manager gateway get fencing token ( ) to u u i d ( ) ) ; final task manager services task manager services = new task manager services builder ( ) set task slot table ( new allocate slot notifying task slot table ( received slot request ) ) build ( ) ; final task executor task executor = create task executor ( task manager services ) ; final resource i d task executor resource id = task manager services get unresolved task manager location ( ) get resource i d ( ) ; task executor start ( ) ; final task executor gateway task executor gateway = task executor get self gateway ( task executor gateway class ) ; final scheduled executor service heartbeat executor = java util concurrent executors new single thread scheduled executor ( ) ; try { task executor registration future get ( ) ; final one shot latch schedule first heartbeat = new one shot latch ( ) ; final resource i d resource manager resource id = testing resource manager gateway get own resource id ( ) ; final long heartbeat interval = 5l ; heartbeat executor schedule with fixed delay ( ( ) - > { schedule first heartbeat trigger ( ) ; task executor gateway heartbeat from resource manager ( resource manager resource id ) ; } , 0l , heartbeat interval , time unit milliseconds ) ; schedule first heartbeat await ( ) ; slot i d slot id = new slot i d ( task executor resource id , 0 ) ; final completable future < acknowledge > request slot future = task executor gateway request slot ( slot id , job id , new allocation i d ( ) , resource profile zero , " foobar " , testing resource manager gateway get fencing token ( ) , timeout ) ; request slot future get ( ) ; terminate slot report verification trigger ( ) ; verify slot report future get ( ) ; } finally { executor utils graceful shutdown ( timeout to milliseconds ( ) , time unit milliseconds , heartbeat executor ) ; rpc utils terminate rpc endpoint ( task executor , timeout ) ; } }


nn exceptions contain the stack trace as part of the exception message when it ' s a known error , pretty - print the error and squish the stack trace

static string prettify exception ( exception e ) { if ( e get localized message ( ) ! = null ) { return e get class ( ) get simple name ( ) + " : " + e get localized message ( ) split ( " \ n " ) [ 0 ] ; } else if ( e get stack trace ( ) ! = null & & e get stack trace ( ) length > 0 ) { return e get class ( ) get simple name ( ) + " at " + e get stack trace ( ) [ 0 ] ; } else { return e get class ( ) get simple name ( ) ; } }


public list < array enum enum > get array enum ( ) { return array enum ; }


public boolean is compatible ( dalv insn insn ) { register spec list regs = insn get registers ( ) ; return ( insn instanceof simple insn ) & & ( regs size ( ) = = 2 ) & & unsigned fits in short ( regs get ( 0 ) get reg ( ) ) & & unsigned fits in short ( regs get ( 1 ) get reg ( ) ) ; }


public bulk request builder add ( byte [ ] data , int from , int length , @ nullable string default index , x content type x content type ) throws exception { request add ( data , from , length , default index , x content type ) ; return this ; }


returns an ( optionally cached ) project file instance if there is no such file , or if the file cannot be parsed , then it throws an exception

project file get project file ( path working directory , list < root > package path , path fragment path , options parser options parser ) throws options parsing exception , interrupted exception ;


bind the given { @ code value } to the { @ link statement } using the underlying binding strategy

void bind ( bind target bind target , object value ) ;


public < t > t get parcelable ( @ non null final string key , @ non null final parcelable creator < t > creator ) { return get parcelable ( key , creator , null ) ; }


initialize direct field access for this data binder , as alternative to the default bean property access

public void init direct field access ( ) { assert state ( this binding result = = null , " data binder is already initialized - call init direct field access before other configuration methods " ) ; this direct field access = true ; }


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

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


returns private immutable program this represents the local program to be checked - in program returned will be released by the merge test facilitator when disposed or re - initialized

public program d b get private program ( ) { return private program ; }


emit a message that can be logged or escalated by the logger implementation

public static void emit message ( log level level , string category key , string message , int sampling frequency , @ nullable map < string , object > metadata ) { error reporter get instance ( ) report ( map ( level ) , category key , message , sampling frequency , metadata ) ; }


public static long get time span ( final date date 1 , final date date 2 , @ time constants unit final int unit ) { return millis 2 time span ( date 2 millis ( date 1 ) - date 2 millis ( date 2 ) , unit ) ; }


test getting snapshot stats m x bean information

public void test snapshot stats m x bean info ( ) throws exception { configuration conf = new configuration ( ) ; mini d f s cluster cluster = null ; string path name = " / snapshot " ; path path = new path ( path name ) ; try { cluster = new mini d f s cluster builder ( conf ) build ( ) ; cluster wait active ( ) ; snapshot manager sm = cluster get namesystem ( ) get snapshot manager ( ) ; distributed file system dfs = ( distributed file system ) cluster get file system ( ) ; dfs mkdirs ( path ) ; dfs allow snapshot ( path ) ; dfs create snapshot ( path ) ; m bean server mbs = management factory get platform m bean server ( ) ; object name mxbean name = new object name ( " hadoop : service = name node , name = snapshot info " ) ; composite data [ ] directories = ( composite data [ ] ) mbs get attribute ( mxbean name , " snapshottable directories " ) ; int num directories = array get length ( directories ) ; assert equals ( sm get num snapshottable dirs ( ) , num directories ) ; composite data [ ] snapshots = ( composite data [ ] ) mbs get attribute ( mxbean name , " snapshots " ) ; int num snapshots = array get length ( snapshots ) ; assert equals ( sm get num snapshots ( ) , num snapshots ) ; composite data d = ( composite data ) array get ( directories , 0 ) ; composite data s = ( composite data ) array get ( snapshots , 0 ) ; assert true ( ( ( string ) d get ( " path " ) ) contains ( path name ) ) ; assert true ( ( ( string ) s get ( " snapshot directory " ) ) contains ( path name ) ) ; } finally { if ( cluster ! = null ) { cluster shutdown ( ) ; } } }


returns the internal offload executor pool for offloading tasks

public object pool < ? extends executor > get offload executor pool ( ) { return this offload executor pool ; }


public builder set missing bucket ( boolean missing bucket ) { this missing bucket = missing bucket ; return this ; }


public static int write string ( data output out , string s ) throws i o exception { if ( s length ( ) > 0xffff / 3 ) { / / maybe too long log warn ( " truncating long string : " + s length ( ) + " chars , starting with " + s substring ( 0 , 20 ) ) ; s = s substring ( 0 , 0xffff / 3 ) ; } int len = utf 8 length ( s ) ; if ( len > 0xffff ) / / double - check length throw new i o exception ( " string too long ! " ) ; out write short ( len ) ; write chars ( out , s , 0 , s length ( ) ) ; return len ; }


enable hardware acceleration for this view read this before enabling hardware acceleration : 1 ) test your animation on the minimum api level you support some drawing features such as dashes and stroke caps have min api levels ( https : developer android comguidetopicsgraphicshardware - accel html # unsupported ) 2 ) enabling hardware acceleration is not always more performant check it with your specific animation only if you are having performance issues with software rendering 3 ) software rendering is safer and will be consistent across devices manufacturers can potentially break hardware rendering with bugs in their skia engine lottie cannot do anything about that

@ suppress warnings ( " weaker access " ) public void use experimental hardware acceleration ( ) { set layer type ( layer type hardware , null ) ; }


regression test for hdfs - 3835 - " long - lived 2nn cannot perform a checkpoint if security is enabled and the nn restarts without outstanding delegation tokens "

public void test secondary name node with delegation tokens ( ) throws i o exception { mini d f s cluster cluster = null ; secondary name node secondary = null ; configuration conf = new hdfs configuration ( ) ; conf set boolean ( d f s config keys dfs namenode delegation token always use key , true ) ; try { cluster = new mini d f s cluster builder ( conf ) num data nodes ( num datanodes ) format ( true ) build ( ) ; assert not null ( cluster get namesystem ( ) get delegation token ( new text ( " atm " ) ) ) ; secondary = start secondary name node ( conf ) ; / / checkpoint once , so the 2nn loads the dt into its in - memory sate secondary do checkpoint ( ) ; / / perform a save namespace , so that the nn has a new fsimage , and the 2nn / / therefore needs to download a new fsimage the next time it performs a / / checkpoint cluster get name node rpc ( ) set safe mode ( safe mode action safemode enter , false ) ; cluster get name node rpc ( ) save namespace ( 0 , 0 ) ; cluster get name node rpc ( ) set safe mode ( safe mode action safemode leave , false ) ; / / ensure that the 2nn can still perform a checkpoint secondary do checkpoint ( ) ; } finally { cleanup ( secondary ) ; secondary = null ; cleanup ( cluster ) ; cluster = null ; } }


public void namespace number test ( ) { / / todo : test namespace number }


string get execution argument ( int daemon id ) { return null ; }


returns a collection of all entries in the zip file

public collection < zip file entry > get entries ( ) { return entries values ( ) ; }


reads an array from the stream using the specified { @ link org elasticsearch common io stream writeable reader } to read array elements from the stream this method can be seen as the reader version of { @ link stream output # write array ( writeable writer , object [ ] ) } it is assumed that the stream first contains a variable - length integer representing the size of the array , and then contains that many elements that can be read from the stream

public < t > t [ ] read array ( final writeable reader < t > reader , final int function < t [ ] > array supplier ) throws i o exception { final int length = read array size ( ) ; final t [ ] values = array supplier apply ( length ) ; for ( int i = 0 ; i < length ; i + + ) { values [ i ] = reader read ( this ) ; } return values ; }


returns true if the relation exists , between an inferior ( callee ) function and a full hash representing the superior ( caller ) function

public boolean get inferior full relation ( fid hash quad superior function , function record inferior function ) { try { d b record library by i d = libraries table get library by i d ( inferior function get library i d ( ) ) ; if ( library by i d ! = null ) { return relations table get inferior full relation ( superior function , inferior function ) ; } } catch ( i o exception e ) { msg error ( this , " serious problem in get inferior full relation " , e ) ; } return false ; }


public static log operation get log operation by code ( byte code ) { for ( log operation temp : values ( ) ) { if ( temp get code ( ) = = code ) { return temp ; } } throw new illegal argument exception ( " unknown log operation [ " + code + " ] " ) ; }


simulate the { @ link d f s config keys # dfs namenode name dir key } of a populated dfs filesystem this method populates for each parent directory , < code > parentdir name < code > with the content of namenode storage directory that comes from a singleton namenode master ( that contains edits , fsimage , version and time files ) if the destination directory does not exist , it will be created if the directory already exists , it will first be deleted

public static file [ ] create name node storage dirs ( string [ ] parents , string dir name ) throws exception { file [ ] ret val = new file [ parents length ] ; for ( int i = 0 ; i < parents length ; i + + ) { file new dir = new file ( parents [ i ] , dir name ) ; create empty dirs ( new string [ ] { new dir to string ( ) } ) ; local file system local f s = file system get local ( new hdfs configuration ( ) ) ; local f s copy to local file ( new path ( namenode storage to string ( ) , " current " ) , new path ( new dir to string ( ) ) , false ) ; ret val [ i ] = new dir ; } return ret val ; }


output the proper model name ( capitalized ) in case the name belongs to the type system it won ' t be renamed

public string to model name ( final string name ) { / / allow for explicitly configured kotlin * and java * types if ( name starts with ( " kotlin " ) | | name starts with ( " java " ) ) { return name ; } / / if import mapping contains name , assume this is a legitimate model name if ( import mapping contains key ( name ) ) { return import mapping get ( name ) ; } string modified name = name replace all ( " \ \ " , " " ) ; string sanitized name = sanitize kotlin specific names ( modified name ) ; string name with prefix suffix = sanitized name ; if ( ! string utils is empty ( model name prefix ) ) { / / add ' ' so that model name can be camelized correctly name with prefix suffix = model name prefix + " " + name with prefix suffix ; } if ( ! string utils is empty ( model name suffix ) ) { / / add ' ' so that model name can be camelized correctly name with prefix suffix = name with prefix suffix + " " + model name suffix ; } / / camelize name of nested properties modified name = camelize ( name with prefix suffix ) ; / / model name cannot use reserved keyword , e g return if ( is reserved word ( modified name ) ) { final string model name = " model " + modified name ; logger warn ( modified name + " ( reserved word ) cannot be used as model name renamed to " + model name ) ; return model name ; } / / model name starts with number if ( modified name matches ( " ^ \ \ d * " ) ) { final string model name = " model " + modified name ; / / e g 2 0 0 response = > model 2 0 0 response ( after camelize ) logger warn ( name + " ( model name starts with number ) cannot be used as model name renamed to " + model name ) ; return model name ; } return title case ( modified name ) ; }


verify that parent directory of src exists

void verify parent dir ( i nodes in path iip ) throws file not found exception , parent not directory exception { if ( iip length ( ) > 2 ) { final i node parent node = iip get i node ( - 2 ) ; if ( parent node = = null ) { throw new file not found exception ( " parent directory doesn ' t exist : " + iip get parent path ( ) ) ; } else if ( ! parent node is directory ( ) ) { throw new parent not directory exception ( " parent path is not a directory : " + iip get parent path ( ) ) ; } } }


public static boolean is file exists ( file file ) { if ( file = = null ) { return false ; } return is file exists ( file to path ( ) ) ; }


public byte size value get heap used ( ) { return new byte size value ( heap used ) ; }


public void rebind cas configuration properties ( final application context application context ) { rebind cas configuration properties ( this binder , application context ) ; }


specify the order value for this registry default is { @ link ordered # lowest precedence }

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


extract a sub - path from the given offset into the elements list

default path container sub path ( int index ) { return sub path ( index , elements ( ) size ( ) ) ; }


return a handler mapping instance ordered at { @ link ordered # lowest precedence } containing the { @ link default servlet http request handler } instance mapped to { @ code " " } ; or { @ code null } if default servlet handling was not been enabled

protected simple url handler mapping build handler mapping ( ) { if ( this handler = = null ) { return null ; } return new simple url handler mapping ( collections singleton map ( "


public row id get row id ( int column index ) throws s q l exception { return null ; }


test get safe mode tip without minimum number of live datanodes required

public void test get safe mode tips without num live datanode ( ) throws i o exception { configuration conf = new hdfs configuration ( ) ; conf set double ( d f s config keys dfs namenode safemode threshold pct key , threshold ) ; conf set int ( d f s config keys dfs namenode safemode extension key , extension ) ; conf set int ( d f s config keys dfs namenode safemode min datanodes key , 0 ) ; name node init metrics ( conf , namenode role namenode ) ; block manager block manager = spy ( new block manager ( fsn , false , conf ) ) ; block manager safe mode safe mode = new block manager safe mode ( block manager , fsn , false , conf ) ; safe mode activate ( block total ) ; string tip = safe mode get safe mode tip ( ) ; assert true ( tip contains ( " the minimum number of live datanodes is not " + " required " ) ) ; }


verify that the iterator is taken from a snapshot of the values

public void test iterator is snapshot ( ) throws throwable { / / set the counters all to 1 increment all counters ( ) ; / / take the snapshot final iterator < map entry < string , long > > it = statistics counters ( ) entry set ( ) iterator ( ) ; / / increment the counters increment all counters ( ) ; / / now assert that all the iterator values are of value 1 while ( it has next ( ) ) { map entry < string , long > next = it next ( ) ; assert that ( next get value ( ) ) described as ( " value of entry % s " , next ) is equal to ( 1 ) ; } }


returns an unmodifiable { @ code iterable } over the nodes reachable from any of the { @ code start nodes } , in the order of a depth - first post - order traversal this is equivalent to a depth - first post - order traversal of a graph with an additional root node whose successors are the listed { @ code start nodes }

public final iterable < n > depth first post order ( iterable < ? extends n > start nodes ) { final immutable set < n > validated = validate ( start nodes ) ; return new iterable < n > ( ) { @ override public iterator < n > iterator ( ) { return new traversal ( ) post order ( validated iterator ( ) ) ; } } ; }


returns the record number for the class containing this method

public record number get containing class record number ( ) { return containing class record number ; }


test that program merge correctly uses the address set that limits the diff

public void test limited address set ( ) throws exception { program builder 1 create memory ( " d 1 " , " 0x 1 0 0 " , 0x 1 0 0 , null , ( byte ) 0x a c ) ; program builder 1 create memory ( " d 2 " , " 0x 2 0 0 " , 0x 1 0 0 ) ; program builder 1 create label ( " 0x 0 1 0 0 6 4 2 0 " , " function 1 " ) ; program builder 1 create comment ( " 0x 0 1 0 0 5 9a 3 " , " here we are " , code unit eol comment ) ; program builder 2 create memory ( " d 1 " , " 0x 1 0 0 " , 0x 1 0 0 , null , ( byte ) 0x a f ) ; program builder 2 create memory ( " d 4 " , " 0x 4 0 0 " , 0x 1 0 0 ) ; program builder 2 create label ( " 0x 0 1 0 0 6 4 2 0 " , " function 2 " ) ; program builder 2 create comment ( " 0x 0 1 0 0 5 9a 3 " , " there you have it " , code unit eol comment ) ; program merge = new program merge manager ( p 1 , p 2 , task monitor adapter dummy monitor ) ; program merge set diff filter ( new program diff filter ( program diff filter all diffs ) ) ; address set view diffs ; / / before limiting it should detect diffs diffs = program merge get filtered differences ( task monitor adapter dummy monitor ) ; assert true ( diffs contains ( addr ( p 1 , 0x 0 1 0 0 6 4 2 0 ) ) ) ; assert true ( diffs contains ( addr ( p 1 , 0x 0 1 0 0 5 9a 3 ) ) ) ; / / program diff only determines differences within the limited set program merge = new program merge manager ( p 1 , p 2 , new address set ( addr ( 0x 0 1 0 0 2 2 3 9 ) , addr ( 0x 0 1 0 0 2 4 8c ) ) , task monitor adapter dummy monitor ) ; program merge set diff filter ( new program diff filter ( program diff filter all diffs ) ) ; address set as = new address set ( ) ; as add range ( addr ( 0x 0 1 0 0 2 2 3 9 ) , addr ( 0x 0 1 0 0 2 4 8c ) ) ; assert equals ( as , program merge get limited address set ( ) ) ; / / limited set is used by the diff diffs = program merge get filtered differences ( task monitor adapter dummy monitor ) ; assert true ( ! diffs contains ( addr ( 0x 0 1 0 0 6 4 2 0 ) ) & & ! diffs contains ( addr ( 0x 0 1 0 0 5 9a 3 ) ) ) ; }


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

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


public object execute ( execution type execution type ) throws command action execution exception { hystrix invokable command = hystrix command factory get instance ( ) create delayed ( create copy ( original meta holder , execution type ) ) ; return new command execution action ( command , original meta holder ) execute ( execution type ) ; }


test case for https : issues apache orgjirabrowse z o o k e e p e r - 2244

public void test restart zoo keeper server ( ) throws exception { final int [ ] client ports = new int [ server count ] ; string builder sb = new string builder ( ) ; string server ; for ( int i = 0 ; i < server count ; i + + ) { client ports [ i ] = port assignment unique ( ) ; server = " server " + i + " = 127 0 0 1 : " + port assignment unique ( ) + " : " + port assignment unique ( ) + " : participant ; 127 0 0 1 : " + client ports [ i ] ; sb append ( server + " \ n " ) ; } string current quorum cfg section = sb to string ( ) ; main thread [ ] mt = new main thread [ server count ] ; for ( int i = 0 ; i < server count ; i + + ) { mt [ i ] = new main thread ( i , client ports [ i ] , current quorum cfg section , false ) ; mt [ i ] start ( ) ; } / / ensure server started for ( int i = 0 ; i < server count ; i + + ) { assert true ( client base wait for server up ( " 127 0 0 1 : " + client ports [ i ] , connection timeout ) , " waiting for server " + i + " being up " ) ; } zoo keeper zk = client base create z k client ( " 127 0 0 1 : " + client ports [ 0 ] ) ; string z node path = " / server restart test " ; string data = " original data " ; zk create ( z node path , data get bytes ( ) , ids open acl unsafe , create mode persistent ) ; zk close ( ) ;


public int get number of read events ( ) { return number of read events get ( ) ; }


returns the kind of field or method designated by this handle


set a custom rmi client socket factory to use for exporting the service if the given object also implements { @ code java rmi server r m i server socket factory } , it will automatically be registered as server socket factory too

public void set client socket factory ( r m i client socket factory client socket factory ) { this client socket factory = client socket factory ; }


helper method to set api key prefix for the first api key authentication

public void set api key prefix ( string api key prefix ) { for ( authentication auth : authentications values ( ) ) { if ( auth instanceof api key auth ) { ( ( api key auth ) auth ) set api key prefix ( api key prefix ) ; return ; } } throw new runtime exception ( " no api key authentication configured ! " ) ; }


returns true if this is a relocatable file < br > e type = = new elf header constants et rel

public boolean is relocatable ( ) { return e type = = elf constants et rel ; }


set the { @ link thread context } used to add warning headers to network responses this is expected to only be invoked by the { @ code node } ' s constructor ( therefore once outside of tests )

public static void set thread context ( thread context thread context ) { objects require non null ( thread context , " cannot register a null thread context " ) ; / / add returning false means it did have it already if ( thread context add ( thread context ) = = false ) { throw new illegal state exception ( " double - setting thread context not allowed ! " ) ; } }


the connection establishment is attempted multiple times and is given up only on the last failure instead of connecting with a timeout of x , we try connecting with a timeout of x < x but multiple times

private void connect ( u r l connection connection , int connection timeout ) throws i o exception { int unit = 0 ; if ( connection timeout < 0 ) { throw new i o exception ( " invalid timeout " + " [ timeout = " + connection timeout + " ms ] " ) ; } else if ( connection timeout > 0 ) { unit = math min ( unit connect timeout , connection timeout ) ; } long start time = time monotonic now ( ) ; long last time = start time ; int attempts = 0 ; / / set the connect timeout to the unit - connect - timeout connection set connect timeout ( unit ) ; while ( true ) { try { attempts + + ; connection connect ( ) ; break ; } catch ( i o exception ioe ) { long current time = time monotonic now ( ) ; long retry time = current time - start time ; long left time = connection timeout - retry time ; long time since last iteration = current time - last time ; / / throw an exception if we have waited for timeout amount of time / / note that the updated value if timeout is used here if ( left time < = 0 ) { int retry time in seconds = ( int ) retry time / 1000 ; log error ( " connection retry failed with " + attempts + " attempts in " + retry time in seconds + " seconds " ) ; throw ioe ; } / / reset the connect timeout for the last try if ( left time < unit ) { unit = ( int ) left time ; / / reset the connect time out for the final connect connection set connect timeout ( unit ) ; } if ( time since last iteration < unit ) { try { / / sleep the left time of unit sleep ( unit - time since last iteration ) ; } catch ( interrupted exception e ) { log warn ( " sleep in connection retry get interrupted " ) ; if ( stopped ) { return ; } } } / / update the total remaining connect - timeout last time = time monotonic now ( ) ; } } }


returns the { @ code int } value that , when treated as unsigned , is nearest in value to { @ code value }

public static int saturated cast ( long value ) { if ( value < = 0 ) { return 0 ; } else if ( value > = ( 1l < < 32 ) ) { return - 1 ; } else { return ( int ) value ; } }


public stats response stats ( stats request request , request options options ) throws i o exception { return rest high level client perform request and parse entity ( request , enrich request converters : : stats , options , stats response : : from x content , collections empty set ( ) ) ; }


public void triangle type test ( ) { / / todo : test triangle type }


creates the standard symbol name for symbols that have the addresses appended to the name following an " @ " character in order to make it unique

public static string get address appended name ( string name , address address ) { return get address appended name ( name , address , " @ " ) ; }


returns the enumeration of the nested set { " b " , " d " , " e " , { " c " , " a " , " e " } } in the implementation ' s enumeration order

protected abstract list < string > nested duplicates result ( ) ;


creates list of users with given input array

public void create users with list input ( list < user > body , handler < async result < void > > result handler ) { delegate create users with list input ( body , result handler ) ; }


returns a summary of the function ' s expected argument at { @ code argument pos }

signature argument get expected argument ( function definition function definition , int argument pos ) ;


shortcut for { @ code get descriptor ( ) get reactive type ( ) }

public class < ? > get reactive type ( ) { return get descriptor ( ) get reactive type ( ) ; }


tests that if the same invocation - name is specified by more than one invocation , proto compile action builder throws an exception

public void exception if same name ( ) throws exception { proto lang toolchain provider toolchain 1 = proto lang toolchain provider create ( " dontcare " , / * plugin executable = * / null , / * runtime = * / mock ( transitive info collection class ) , / * blacklisted protos = * / nested set builder empty set ( stable order ) ) ; proto lang toolchain provider toolchain 2 = proto lang toolchain provider create ( " dontcare " , / * plugin executable = * / null , / * runtime = * / mock ( transitive info collection class ) , / * blacklisted protos = * / nested set builder empty set ( stable order ) ) ; illegal state exception e = assert throws ( illegal state exception class , ( ) - > create command line from toolchains ( immutable list of ( new toolchain invocation ( " plugin name " , toolchain 1 , " out replacement " ) , new toolchain invocation ( " plugin name " , toolchain 2 , " out replacement " ) ) , " bazel - out " , proto info ( / * direct proto sources * / immutable list of ( ) , / * transitive proto sources * / immutable list of ( ) , / * public import proto sources * / immutable list of ( ) , / * strict importable sources * / immutable list of ( ) ) , label parse absolute unchecked ( " / / foo : bar " ) , deps strict , exports do not use , services allow , / * protoc opts = * / immutable list of ( ) , false ) ) ; assert that ( e ) has message that ( ) is equal to ( " invocation name plugin name appears more than once " + " this could lead to incorrect proto - compiler behavior " ) ; }


if failed then there was an error parsing the results that cannot be recovered from

public boolean is failed ( ) { return failed ; }


remove the given setting from the keystore

void remove ( string setting ) { ensure open ( ) ; entry old entry = entries get ( ) remove ( setting ) ; if ( old entry ! = null ) { arrays fill ( old entry bytes , ( byte ) 0 ) ; } }


returns whether the file or its backup exists

public boolean exists ( ) { return atomic file exists ( ) ; }


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 " ) ; }


returns an immutable range set containing the specified single range if { @ link range # is empty ( ) range is empty ( ) } , this is equivalent to { @ link immutable range set # of ( ) }

public static < c extends comparable > immutable range set < c > of ( range < c > range ) { check not null ( range ) ; if ( range is empty ( ) ) { return of ( ) ; } else if ( range equals ( range all ( ) ) ) { return all ( ) ; } else { return new immutable range set < c > ( immutable list of ( range ) ) ; } }


wait until service is started it does not have to reach a stable state

protected void wait for service to be in state ( service client client , service example app , service state desired state , int wait for millis ) throws timeout exception , interrupted exception { generic test utils wait for ( ( ) - > { try { service retrieved app = client get status ( example app get name ( ) ) ; return retrieved app get state ( ) = = desired state ; } catch ( exception e ) { e print stack trace ( ) ; return false ; } } , 2000 , wait for millis ) ; }


public void logout user test ( ) { / / api logout user ( ) ; / / todo : test validations }


calculate merging strategy attribute merging strategy

protected attribute merging strategy determine merging strategy ( ) { return object utils default if null ( get merging strategy ( ) , attribute merging strategy multivalued ) ; }


returns an element greater than the { @ link # samples ( ) } and greater than { @ link # above samples lesser ( ) }


returns the comment url of this { @ link cookie }


public void set capacity ( int new capacity ) { if ( capacity > new capacity ) { clear ( ) ; / / behavior can be modified to accommodate for decrease in cache size for now , we ' ll / / just clear the cache } else { this capacity = new capacity ; } }


returns the correctly typed version of the builder

protected final t this t ( ) { @ suppress warnings ( " unchecked " ) t this t = ( t ) this ; return this t ; }


protected void update ticket state ( ) { logger trace ( " before updating ticket [ { } ] \ n \ t previous time used : [ { } ] \ n \ t last time used : [ { } ] \ n \ t usage count : [ { } ] " , get id ( ) , this previous time used , this last time used , this count of uses ) ; this previous time used = zoned date time from ( this last time used ) ; this last time used = zoned date time now ( this expiration policy get clock ( ) ) ; this count of uses + + ; logger trace ( " after updating ticket [ { } ] \ n \ t previous time used : [ { } ] \ n \ t last time used : [ { } ] \ n \ t usage count : [ { } ] " , get id ( ) , this previous time used , this last time used , this count of uses ) ; }


flushes the right column buffer , printing it and clearing the buffer if the buffer is already empty , this does nothing

private void flush right ( ) throws i o exception { append newline if necessary ( right buf , right column ) ; while ( right buf length ( ) ! = 0 ) { left column write ( ' \ n ' ) ; output full lines ( ) ; } }


storages are marked as " content stale " after nn restart or fails over and before nn receives the first heartbeat followed by the first blockreport

public int get num stale storages ( ) { return get block manager ( ) get datanode manager ( ) get num stale storages ( ) ; }


convenience method to set this bt indexed mesh to the specified vertex and index data the specified data must be indexed and triangulated and must outlive this bt indexed mesh

public void set ( final object tag , final float buffer vertices , int size in bytes of each vertex , int vertex count , int position offset in bytes , final short buffer indices , int index offset , int index count ) { set vertices ( vertices , size in bytes of each vertex , vertex count , position offset in bytes ) ; set indices ( indices , index offset , index count ) ; this tag = tag ; }


creates or retrieves a { @ link certificate provider } instance , increments its ref - count and registers the watcher passed returns a { @ link handle } that can be { @ link handle # close ( ) } d when the instance is no longer needed by the caller

public synchronized handle create or get provider ( string cert name , string plugin name , object config , watcher watcher , boolean notify cert updates ) { if ( ! notify cert updates ) { / / we try to get a provider first for notify cert updates = = true always try { return create provider helper ( cert name , plugin name , config , watcher , true ) ; } catch ( unsupported operation exception uoe ) { / / ignore & log exception and fall thru to create a provider with actual value logger log ( level fine , " trying to get provider for notify cert updates = = true " , uoe ) ; } } return create provider helper ( cert name , plugin name , config , watcher , notify cert updates ) ; }


public string get string item ( ) { return string item ; }


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


set the { @ link # size ( ) } and ensure that the { @ link # values } array can store at least that many entries

protected void resize ( int new size ) { count = new size ; if ( new size > values length ) { final int old length = values length ; values = array util grow ( values , count ) ; for ( int i = old length ; i < values length ; + + i ) { values [ i ] = new bytes ref builder ( ) ; } } }


public static string get chinese zodiac ( final date date ) { calendar cal = calendar get instance ( ) ; cal set time ( date ) ; return chinese zodiac [ cal get ( calendar year ) % 12 ] ; }


if the name node is running , attempt to finalize a previous upgrade when this method return , the name node should be finalized , but data nodes may not be since that occurs asynchronously

public void finalize cluster ( configuration conf ) throws exception { for ( name node info nn info : namenodes values ( ) ) { if ( nn info = = null ) { throw new illegal state exception ( " attempting to finalize " + " namenode but it is not running " ) ; } finalize namenode ( nn info name node , nn info conf ) ; } }


set the queue connection factory to use for obtaining jms queue connections

public void set connection factory ( @ nullable connection factory connection factory ) { this connection factory = connection factory ; }


is the job a eligible for migration ? returns : false if { @ link # can start migration ( cluster state ) } returns { @ code false } false if the job is not in the cluster state false if the { @ link job # is deleting ( ) } false if the job has an allocated persistent task true otherwise i e the job is present , not deleting and does not have a persistent task or its persistent task is un - allocated

public boolean job is eligible for migration ( string job id , cluster state cluster state ) { if ( can start migration ( cluster state ) = = false ) { return false ; } ml metadata ml metadata = ml metadata get ml metadata ( cluster state ) ; job job = ml metadata get jobs ( ) get ( job id ) ; if ( job = = null | | job is deleting ( ) ) { return false ; } persistent tasks custom metadata persistent tasks = cluster state metadata ( ) custom ( persistent tasks custom metadata type ) ; return ml tasks open job ids ( persistent tasks ) contains ( job id ) = = false | | ml tasks unassigned job ids ( persistent tasks , cluster state nodes ( ) ) contains ( job id ) ; }


visits a non standard attribute of the class

public void visit attribute ( final attribute attribute ) { if ( cv ! = null ) { cv visit attribute ( attribute ) ; } }


specify the type that the result object is required to match if not specified , the result value will be exposed as returned by the jdbc driver

public void set result type ( class < t > result type ) { this row mapper set required type ( result type ) ; }


set to " true " to have { @ link # set use dynamic logger dynamic loggers } hide proxy class names wherever possible default is " false "

public void set hide proxy class names ( boolean hide proxy class names ) { this hide proxy class names = hide proxy class names ; }


list the statuses of the filesdirectories in the given path if the path is a directory

public remote iterator < located file status > list located status ( path f ) throws i o exception { return fs list located status ( f , default filter ) ; }


return the number of directories that were exported

public int get total dirs exported count ( ) { return total dirs exported count ; }


multiply { @ code rhs } by { @ code by } , and add the result to { @ code lhs } without creating any new { @ link resource } object

public static resource multiply and add to ( resource lhs , resource rhs , double by ) { int max length = resource utils get number of countable resource types ( ) ; for ( int i = 0 ; i < max length ; i + + ) { try { resource information rhs value = rhs get resource information ( i ) ; resource information lhs value = lhs get resource information ( i ) ; long converted rhs = ( long ) ( rhs value get value ( ) * by ) ; lhs set resource value ( i , lhs value get value ( ) + converted rhs ) ; } catch ( resource not found exception ye ) { log warn ( " resource is missing : " + ye get message ( ) ) ; } } return lhs ; }


get the collection of { @ link header } objects whose { @ link header # key ( ) keys } all match the specified key

iterator < header > all with name ( string key ) ;


removes an element at a given index , shifting elements at greater indicies down one

public void remove index ( int n ) { if ( n > = size ) { throw new index out of bounds exception ( " n > = size ( ) " ) ; } system arraycopy ( values , n + 1 , values , n , size - n - 1 ) ; size - - ; / / sort status is unchanged }


obtain the { @ link web async manager } for the current request , or if not found , create and associate it with the request

public static web async manager get async manager ( web request web request ) { int scope = request attributes scope request ; web async manager async manager = null ; object async manager attr = web request get attribute ( web async manager attribute , scope ) ; if ( async manager attr instanceof web async manager ) { async manager = ( web async manager ) async manager attr ; } if ( async manager = = null ) { async manager = new web async manager ( ) ; web request set attribute ( web async manager attribute , async manager , scope ) ; } return async manager ; }


verify that serialization form of copy on write map hash and hash map are the same

@ test public void hash serialization ( ) { hash data td = new hash data ( ) ; x stream 2 xs = new x stream 2 ( ) ; string out = xs to x m l ( td ) ; assert equals ( " empty maps " , " < hudson util copy on write map test - hash data > " + " < map 1 / > < map 2 / > < / hudson util copy on write map test - hash data > " , out replace all ( " \ \ s + " , " " ) ) ; hash data td 2 = ( hash data ) xs from x m l ( out ) ; assert true ( td 2 map 1 is empty ( ) ) ; assert true ( td 2 map 2 is empty ( ) ) ; td map 1 put ( " foo 1 " , " bar 1 " ) ; td map 2 put ( " foo 2 " , " bar 2 " ) ; out = xs to x m l ( td ) ; assert equals ( " maps " , " < hudson util copy on write map test - hash data > < map 1 > " + " < entry > < string > foo 1 < / string > < string > bar 1 < / string > < / entry > < / map 1 > " + " < map 2 > < entry > < string > foo 2 < / string > < string > bar 2 < / string > < / entry > " + " < / map 2 > < / hudson util copy on write map test - hash data > " , out replace all ( " \ \ s + " , " " ) ) ; td 2 = ( hash data ) xs from x m l ( out ) ; assert equals ( " bar 1 " , td 2 map 1 get ( " foo 1 " ) ) ; assert equals ( " bar 2 " , td 2 map 2 get ( " foo 2 " ) ) ; }


test deleting a directory which is a descendant of a snapshottable directory in the test we need to cover the following cases : 1 delete current i node file i node directory without taking any snapshot 2 delete current i node file i node directory while snapshots have been taken on ancestor ( s ) 3 delete current i node file with snapshot 4 delete current i node directory with snapshot

public void test delete current file directory ( ) throws exception { / / create a folder which will be deleted before taking snapshots path delete dir = new path ( subsub , " delete dir " ) ; path delete file = new path ( delete dir , " delete file " ) ; / / create a directory that we will not change during the whole process path no change dir parent = new path ( sub , " no change dir parent " ) ; path no change dir = new path ( no change dir parent , " no change dir " ) ; / / create a file that we will not change in the future path no change file = new path ( no change dir , " no change file " ) ; d f s test util create file ( hdfs , delete file , blocksize , replication , seed ) ; d f s test util create file ( hdfs , no change file , blocksize , replication , seed ) ; / / we will change this file ' s metadata in the future path meta change file 1 = new path ( subsub , " meta change file 1 " ) ; d f s test util create file ( hdfs , meta change file 1 , blocksize , replication , seed ) ; / / another file , created under no change dir , whose metadata will be changed path meta change file 2 = new path ( no change dir , " meta change file 2 " ) ; d f s test util create file ( hdfs , meta change file 2 , blocksize , replication , seed ) ; / / case 1 : delete delete dir before taking snapshots hdfs set quota ( dir , long max value - 1 , long max value - 1 ) ; check quota usage computation ( dir , 10 , blocksize * replication * 4 ) ; hdfs delete ( delete dir , true ) ; check quota usage computation ( dir , 8 , blocksize * replication * 3 ) ; / / create snapshot s 0 snapshot test helper create snapshot ( hdfs , dir , " s 0 " ) ; / / after creating snapshot s 0 , create a directory tempdir under dir and then / / delete dir immediately path temp dir = new path ( dir , " tempdir " ) ; path temp file = new path ( temp dir , " tempfile " ) ; d f s test util create file ( hdfs , temp file , blocksize , replication , seed ) ; final i node file temp = test snapshot blocks map assert block collection ( temp file to string ( ) , 1 , fsdir , blockmanager ) ; block info [ ] blocks = temp get blocks ( ) ; hdfs delete ( temp dir , true ) ; / / check dir ' s quota usage check quota usage computation ( dir , 8 , blocksize * replication * 3 ) ; / / check blocks of temp file for ( block info b : blocks ) { assert equals ( invalid inode id , b get block collection id ( ) ) ; } / / make a change : create a new file under subsub path new file after s 0 = new path ( subsub , " new file " ) ; d f s test util create file ( hdfs , new file after s 0 , blocksize , replication , seed ) ; / / further change : change the replicator factor of meta change file hdfs set replication ( meta change file 1 , replication 1 ) ; hdfs set replication ( meta change file 2 , replication 1 ) ; / / create snapshot s 1 snapshot test helper create snapshot ( hdfs , dir , " s 1 " ) ; / / check dir ' s quota usage check quota usage computation ( dir , 9l , blocksize * replication * 4 ) ; / / get two snapshots for later use snapshot snapshot 0 = fsdir get i node ( dir to string ( ) ) as directory ( ) get snapshot ( d f s util string 2 bytes ( " s 0 " ) ) ; snapshot snapshot 1 = fsdir get i node ( dir to string ( ) ) as directory ( ) get snapshot ( d f s util string 2 bytes ( " s 1 " ) ) ; / / case 2 + case 3 : delete no change dir parent , no change file , and / / meta change file 2 note that when we directly delete a directory , the / / directory will be converted to an i node directory with snapshot to make / / sure the deletion goes through an i node directory , we delete the parent / / of no change dir hdfs delete ( no change dir parent , true ) ; / / while deletion , we add a diff for meta change file 2 as its snapshot copy / / for s 1 , we also add diffs for both sub and no change dir parent check quota usage computation ( dir , 9l , blocksize * replication * 4 ) ; / / check the snapshot copy of no change dir path snapshot no change dir = snapshot test helper get snapshot path ( dir , " s 1 " , sub get name ( ) + " / " + no change dir parent get name ( ) + " / " + no change dir get name ( ) ) ; i node directory snapshot node = ( i node directory ) fsdir get i node ( snapshot no change dir to string ( ) ) ; / / should still be an i node directory assert equals ( i node directory class , snapshot node get class ( ) ) ; read only list < i node > children = snapshot node get children list ( snapshot current state id ) ; / / check 2 children : no change file and meta change file 2 assert equals ( 2 , children size ( ) ) ; i node no change file s copy = children get ( 1 ) ; assert equals ( no change file get name ( ) , no change file s copy get local name ( ) ) ; assert equals ( i node file class , no change file s copy get class ( ) ) ; test snapshot blocks map assert block collection ( new path ( snapshot no change dir , no change file s copy get local name ( ) ) to string ( ) , 1 , fsdir , blockmanager ) ; i node file meta change file 2 s copy = children get ( 0 ) as file ( ) ; assert equals ( meta change file 2 get name ( ) , meta change file 2 s copy get local name ( ) ) ; assert true ( meta change file 2 s copy is with snapshot ( ) ) ; assert false ( meta change file 2 s copy is under construction ( ) ) ; test snapshot blocks map assert block collection ( new path ( snapshot no change dir , meta change file 2 s copy get local name ( ) ) to string ( ) , 1 , fsdir , blockmanager ) ; / / check the replication factor of meta change file 2 s copy assert equals ( replication 1 , meta change file 2 s copy get file replication ( snapshot current state id ) ) ; assert equals ( replication 1 , meta change file 2 s copy get file replication ( snapshot 1 get id ( ) ) ) ; assert equals ( replication , meta change file 2 s copy get file replication ( snapshot 0 get id ( ) ) ) ; / / case 4 : delete directory sub / / before deleting sub , we first create a new file under sub path new file = new path ( sub , " new file " ) ; d f s test util create file ( hdfs , new file , blocksize , replication , seed ) ; final i node file new file node = test snapshot blocks map assert block collection ( new file to string ( ) , 1 , fsdir , blockmanager ) ; blocks = new file node get blocks ( ) ; check quota usage computation ( dir , 10l , blocksize * replication * 5 ) ; hdfs delete ( sub , true ) ; / / while deletion , we add diff for subsub and meta change file 1 , and remove / / new file check quota usage computation ( dir , 9l , blocksize * replication * 4 ) ; for ( block info b : blocks ) { assert equals ( invalid inode id , b get block collection id ( ) ) ; } / / make sure the whole subtree of sub is stored correctly in snapshot path snapshot sub = snapshot test helper get snapshot path ( dir , " s 1 " , sub get name ( ) ) ; i node directory snapshot node 4 sub = fsdir get i node ( snapshot sub to string ( ) ) as directory ( ) ; assert true ( snapshot node 4 sub is with snapshot ( ) ) ; / / the snapshot copy of sub has only one child subsub / / new file should have been destroyed assert equals ( 1 , snapshot node 4 sub get children list ( snapshot current state id ) size ( ) ) ; / / but should have two children , subsub and no change dir , when s 1 was taken assert equals ( 2 , snapshot node 4 sub get children list ( snapshot 1 get id ( ) ) size ( ) ) ; / / check the snapshot copy of subsub , which is contained in the subtree of / / sub ' s snapshot copy i node snapshot node 4 subsub = snapshot node 4 sub get children list ( snapshot current state id ) get ( 0 ) ; assert true ( snapshot node 4 subsub as directory ( ) is with snapshot ( ) ) ; assert true ( snapshot node 4 sub = = snapshot node 4 subsub get parent ( ) ) ; / / check the children of subsub i node directory snapshot subsub dir = ( i node directory ) snapshot node 4 subsub ; children = snapshot subsub dir get children list ( snapshot current state id ) ; assert equals ( 2 , children size ( ) ) ; assert equals ( children get ( 0 ) get local name ( ) , meta change file 1 get name ( ) ) ; assert equals ( children get ( 1 ) get local name ( ) , new file after s 0 get name ( ) ) ; / / only one child before snapshot s 0 children = snapshot subsub dir get children list ( snapshot 0 get id ( ) ) ; assert equals ( 1 , children size ( ) ) ; i node child = children get ( 0 ) ; assert equals ( child get local name ( ) , meta change file 1 get name ( ) ) ; / / check snapshot copy of meta change file 1 i node file meta change file 1 s copy = child as file ( ) ; assert true ( meta change file 1 s copy is with snapshot ( ) ) ; assert false ( meta change file 1 s copy is under construction ( ) ) ; assert equals ( replication 1 , meta change file 1 s copy get file replication ( snapshot current state id ) ) ; assert equals ( replication 1 , meta change file 1 s copy get file replication ( snapshot 1 get id ( ) ) ) ; assert equals ( replication , meta change file 1 s copy get file replication ( snapshot 0 get id ( ) ) ) ; }


turn the given list of header values into a comma - delimited result

protected string to comma delimited string ( list < string > header values ) { string joiner joiner = new string joiner ( " , " ) ; for ( string val : header values ) { if ( val ! = null ) { joiner add ( val ) ; } } return joiner to string ( ) ; }


job submitter get job submitter ( file system fs , client protocol submit client ) throws i o exception { return new job submitter ( fs , mock client ) ; }


fix offset and length of block locations note that this method modifies the original array

static block location [ ] fix block locations ( block location [ ] locations , long start , long len , long file offset in har ) { / / offset 1 past last byte of desired range long end = start + len ; for ( block location location : locations ) { / / offset of part block relative to beginning of desired file / / ( may be negative if file starts in this part block ) long har block start = location get offset ( ) - file offset in har ; / / offset 1 past last byte of har block relative to beginning of / / desired file long har block end = har block start + location get length ( ) ; if ( start > har block start ) { / / desired range starts after beginning of this har block / / fix offset to beginning of relevant range ( relative to desired file ) location set offset ( start ) ; / / fix length to relevant portion of har block location set length ( location get length ( ) - ( start - har block start ) ) ; } else { / / desired range includes beginning of this har block location set offset ( har block start ) ; } if ( har block end > end ) { / / range ends before end of this har block / / fix length to remove irrelevant portion at the end location set length ( location get length ( ) - ( har block end - end ) ) ; } } return locations ; }


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 ( ) ) ; }


sets the size of the area ( range on the x - axis ) that should be minimum visible at once ( no further zooming in allowed ) if this is e g set to 10 , no less than a range of 10 on the x - axis can be viewed at once without scrolling

public void set visible x range minimum ( float min x range ) { float x scale = m x axis m axis range / ( min x range ) ; m view port handler set maximum scale x ( x scale ) ; }


test if the rpc server gets the retry count from client

public void test call retry count ( ) throws i o exception { final int retry count = 255 ; / / override client to store the call id final client client = new client ( long writable class , conf ) ; client set call id and retry count ( client next call id ( ) , 255 , null ) ; / / attach a listener that tracks every call id received by the server final test server server = new test server ( 1 , false ) ; server call listener = new runnable ( ) { @ override public void run ( ) { / / we have not set the retry count for the client , thus on the server / / side we should see retry count as 0 assert assert equals ( retry count , server get call retry count ( ) ) ; } } ; try { inet socket address addr = net utils get connect address ( server ) ; server start ( ) ; final serial caller caller = new serial caller ( client , addr , 10 ) ; caller run ( ) ; assert false ( caller failed ) ; } finally { client stop ( ) ; server stop ( ) ; } }


get the admin a c ls from the given servlet context and check if the given user is in the acl

public static boolean user has administrator access ( servlet context servlet context , string remote user ) { access control list admins acl = ( access control list ) servlet context get attribute ( admins acl ) ; user group information remote user u g i = user group information create remote user ( remote user ) ; return admins acl ! = null & & admins acl is user allowed ( remote user u g i ) ; }


public void header ( string header , int value ) { response add int header ( header , value ) ; }


updated user ( asynchronously ) this can only be done by the logged in user

public okhttp 3 call update user async ( string username , user body , final api callback < void > callback ) throws api exception { okhttp 3 call local var call = update user validate before call ( username , body , callback ) ; local var api client execute async ( local var call , callback ) ; return local var call ; }


tells this thread to commit a set of offsets this method does not block , the committing operation will happen asynchronously only one commit operation may be pending at any time if the committing takes longer than the frequency with which this method is called , then some commits may be skipped due to being superseded by newer ones

void set offsets to commit ( map < topic partition , offset and metadata > offsets to commit , @ nonnull kafka commit callback commit callback ) { / / record the work to be committed by the main consumer thread and make sure the consumer / / notices that if ( next offsets to commit get and set ( tuple 2 of ( offsets to commit , commit callback ) ) ! = null ) { log warn ( " committing offsets to kafka takes longer than the checkpoint interval " + " skipping commit of previous offsets because newer complete checkpoint offsets are available " + " this does not compromise flink ' s checkpoint integrity " ) ; } / / if the consumer is blocked in a poll ( ) or handover operation , wake it up to commit soon handover wakeup producer ( ) ; synchronized ( consumer reassignment lock ) { if ( consumer ! = null ) { consumer wakeup ( ) ; } else { / / the consumer is currently isolated for partition reassignment ; / / set this flag so that the wakeup state is restored once the reassignment is / / complete has buffered wakeup = true ; } } }


closes the sink note : this method must be called even if the corresponding call to { @ link # open ( data spec ) } threw an { @ link i o exception } see { @ link # open ( data spec ) } for more details


create an option to specify the starting byte to read

public static option start ( long value ) { return new start option ( value ) ; }


computes a simple agg metric ( min , sum , etc ) from the provided values

public static double calculate metric ( double [ ] values , values source aggregation builder < ? > metric ) { if ( metric instanceof min aggregation builder ) { double accumulator = double positive infinity ; for ( double value : values ) { accumulator = math min ( accumulator , value ) ; } return accumulator ; } else if ( metric instanceof max aggregation builder ) { double accumulator = double negative infinity ; for ( double value : values ) { accumulator = math max ( accumulator , value ) ; } return accumulator ; } else if ( metric instanceof sum aggregation builder ) { double accumulator = 0 ; for ( double value : values ) { accumulator + = value ; } return accumulator ; } else if ( metric instanceof avg aggregation builder ) { double accumulator = 0 ; for ( double value : values ) { accumulator + = value ; } return accumulator / values length ; } return 0 0 ; }


downloads a range of bytes from the blob to the given byte buffer , using the specified request options and operation context

void download range ( final long offset , final long length , final output stream out stream , final blob request options options , final operation context op context ) throws storage exception , i o exception ;


get number of destination blocks flowing out of this block

public int get num destinations ( code block block , task monitor monitor ) throws cancelled exception { if ( block = = null ) { return 0 ; } if ( ! ( block get model ( ) instanceof simple block model ) ) { throw new illegal argument exception ( ) ; } return simple dest reference iterator get num destinations ( block , follow indirect flows , monitor ) ; }


adds a " remember my decision " option to the dialog see < a href = " # remember option " > header documentation for details < p > this will replace any previously added " check box " options

public option dialog builder add remember my decision option ( ) { this remember option = new dialog remember option ( " remember my decision " ) ; return this ; }


return the name of the affected property , if available

public string get property name ( ) { return this property name ; }


add the given request to the queue for the connection it was directed to

public void add ( network client in flight request request ) { string destination = request destination ; deque < network client in flight request > reqs = this requests get ( destination ) ; if ( reqs = = null ) { reqs = new array deque < > ( ) ; this requests put ( destination , reqs ) ; } reqs add first ( request ) ; in flight request count increment and get ( ) ; }