we want block group has every internal block , but we have redundant internal blocks ( which have the same index ) in this method , we delete the redundant internal blocks until only one left for each index the block placement policy will make sure that the left internal blocks are spread across racks and also try hard to pick one with least free space

private void choose excess redundancy striped ( block collection bc , final collection < datanode storage info > non excess , block info stored block , datanode descriptor del node hint ) { assert stored block instanceof block info striped ; block info striped sblk = ( block info striped ) stored block ; short group size = sblk get total block num ( ) ; / / find all duplicated indices bit set found = new bit set ( group size ) ; / / indices found bit set duplicated = new bit set ( group size ) ; / / indices found more than once hash map < datanode storage info , integer > storage 2index = new hash map < > ( ) ; for ( datanode storage info storage : non excess ) { int index = sblk get storage block index ( storage ) ; assert index > = 0 ; if ( found get ( index ) ) { duplicated set ( index ) ; } found set ( index ) ; storage 2index put ( storage , index ) ; } / / use del hint only if del hint is duplicated final datanode storage info del storage hint = datanode storage info get datanode storage info ( non excess , del node hint ) ; if ( del storage hint ! = null ) { integer index = storage 2index get ( del storage hint ) ; if ( index ! = null & & duplicated get ( index ) ) { process chosen excess redundancy ( non excess , del storage hint , stored block ) ; } } / / cardinality of found indicates the expected number of internal blocks final int num of target = found cardinality ( ) ; final block storage policy storage policy = storage policy suite get policy ( bc get storage policy i d ( ) ) ; final list < storage type > excess types = storage policy choose excess ( ( short ) num of target , datanode storage info to storage types ( non excess ) ) ; if ( excess types is empty ( ) ) { log warn ( " excess types chosen for block { } among storages { } is empty " , stored block , non excess ) ; return ; } block placement policy placement policy = placement policies get policy ( striped ) ; / / for each duplicated index , delete some replicas until only one left for ( int target index = duplicated next set bit ( 0 ) ; target index > = 0 ; target index = duplicated next set bit ( target index + 1 ) ) { list < datanode storage info > candidates = new array list < > ( ) ; for ( datanode storage info storage : non excess ) { int index = storage 2index get ( storage ) ; if ( index = = target index ) { candidates add ( storage ) ; } } if ( candidates size ( ) > 1 ) { list < datanode storage info > replicas to delete = placement policy choose replicas to delete ( non excess , candidates , ( short ) 1 , excess types , null , null ) ; for ( datanode storage info chosen : replicas to delete ) { process chosen excess redundancy ( non excess , chosen , stored block ) ; candidates remove ( chosen ) ; } } duplicated clear ( target index ) ; } }


test renaming a dir and then delete snapshots

public void test rename dir and delete snapshot 1 ( ) throws exception { final path sdir 1 = new path ( " / dir 1 " ) ; final path sdir 2 = new path ( " / dir 2 " ) ; hdfs mkdirs ( sdir 1 ) ; hdfs mkdirs ( sdir 2 ) ; final path foo = new path ( sdir 2 , " foo " ) ; final path bar = new path ( foo , " bar " ) ; final path bar 2 = new path ( foo , " bar 2 " ) ; d f s test util create file ( hdfs , bar , blocksize , repl , seed ) ; d f s test util create file ( hdfs , bar 2 , blocksize , repl , seed ) ; snapshot test helper create snapshot ( hdfs , sdir 1 , " s 1 " ) ; snapshot test helper create snapshot ( hdfs , sdir 2 , " s 2 " ) ; hdfs create snapshot ( sdir 1 , " s 3 " ) ; final path newfoo = new path ( sdir 1 , " foo " ) ; hdfs rename ( foo , newfoo ) ; final path newbar = new path ( newfoo , bar get name ( ) ) ; final path newbar 2 = new path ( newfoo , bar 2 get name ( ) ) ; final path newbar 3 = new path ( newfoo , " bar 3 " ) ; d f s test util create file ( hdfs , newbar 3 , blocksize , repl , seed ) ; hdfs create snapshot ( sdir 1 , " s 4 " ) ; hdfs delete ( newbar , true ) ; hdfs delete ( newbar 3 , true ) ; assert false ( hdfs exists ( newbar 3 ) ) ; assert false ( hdfs exists ( bar ) ) ; final path bar s 4 = snapshot test helper get snapshot path ( sdir 1 , " s 4 " , " foo / bar " ) ; final path bar 3 s 4 = snapshot test helper get snapshot path ( sdir 1 , " s 4 " , " foo / bar 3 " ) ; assert true ( hdfs exists ( bar s 4 ) ) ; assert true ( hdfs exists ( bar 3 s 4 ) ) ; hdfs create snapshot ( sdir 1 , " s 5 " ) ; hdfs delete ( newbar 2 , true ) ; assert false ( hdfs exists ( bar 2 ) ) ; final path bar 2 s 5 = snapshot test helper get snapshot path ( sdir 1 , " s 5 " , " foo / bar 2 " ) ; assert true ( hdfs exists ( bar 2 s 5 ) ) ; / / delete snapshot s 5 the diff of s 5 should be combined to s 4 hdfs delete snapshot ( sdir 1 , " s 5 " ) ; restart cluster and check image ( true ) ; assert false ( hdfs exists ( bar 2 s 5 ) ) ; final path bar 2 s 4 = snapshot test helper get snapshot path ( sdir 1 , " s 4 " , " foo / bar 2 " ) ; assert true ( hdfs exists ( bar 2 s 4 ) ) ; / / delete snapshot s 4 the diff of s 4 should be combined to s 2 instead of / / s 3 hdfs delete snapshot ( sdir 1 , " s 4 " ) ; assert false ( hdfs exists ( bar s 4 ) ) ; path bar s 3 = snapshot test helper get snapshot path ( sdir 1 , " s 3 " , " foo / bar " ) ; assert false ( hdfs exists ( bar s 3 ) ) ; bar s 3 = snapshot test helper get snapshot path ( sdir 2 , " s 3 " , " foo / bar " ) ; assert false ( hdfs exists ( bar s 3 ) ) ; final path bar s 2 = snapshot test helper get snapshot path ( sdir 2 , " s 2 " , " foo / bar " ) ; assert true ( hdfs exists ( bar s 2 ) ) ; assert false ( hdfs exists ( bar 2 s 4 ) ) ; path bar 2 s 3 = snapshot test helper get snapshot path ( sdir 1 , " s 3 " , " foo / bar 2 " ) ; assert false ( hdfs exists ( bar 2 s 3 ) ) ; bar 2 s 3 = snapshot test helper get snapshot path ( sdir 2 , " s 3 " , " foo / bar 2 " ) ; assert false ( hdfs exists ( bar 2 s 3 ) ) ; final path bar 2 s 2 = snapshot test helper get snapshot path ( sdir 2 , " s 2 " , " foo / bar 2 " ) ; assert true ( hdfs exists ( bar 2 s 2 ) ) ; assert false ( hdfs exists ( bar 3 s 4 ) ) ; path bar 3 s 3 = snapshot test helper get snapshot path ( sdir 1 , " s 3 " , " foo / bar 3 " ) ; assert false ( hdfs exists ( bar 3 s 3 ) ) ; bar 3 s 3 = snapshot test helper get snapshot path ( sdir 2 , " s 3 " , " foo / bar 3 " ) ; assert false ( hdfs exists ( bar 3 s 3 ) ) ; final path bar 3 s 2 = snapshot test helper get snapshot path ( sdir 2 , " s 2 " , " foo / bar 3 " ) ; assert false ( hdfs exists ( bar 3 s 2 ) ) ; / / restart the cluster and check fsimage restart cluster and check image ( true ) ; / / delete snapshot s 2 hdfs delete snapshot ( sdir 2 , " s 2 " ) ; assert false ( hdfs exists ( bar s 2 ) ) ; assert false ( hdfs exists ( bar 2 s 2 ) ) ; / / restart the cluster and check fsimage restart cluster and check image ( true ) ; hdfs delete snapshot ( sdir 1 , " s 3 " ) ; restart cluster and check image ( true ) ; hdfs delete snapshot ( sdir 1 , " s 1 " ) ; restart cluster and check image ( true ) ; }


if the type of the field is parameterized , returns the class object representing the parameter type at the specified index , null otherwise

public class get element type ( int index ) { type element type = field get element type ( index ) ; return element type ! = null ? element type get class of type ( ) : null ; }


parses an optional attribute as a decimal number , returning its integer value , or the default value if the attribute is null

public static int parse optional bounded int attr ( element ele , string attr name , int default value , int min value , int max value ) throws number format exception { string value = ele get attribute value ( attr name ) ; if ( value = = null ) { return default value ; } try { return parse bounded int ( value , min value , max value ) ; } catch ( number format exception nfe ) { throw new number format exception ( " attribute ' " + attr name + " ' bad value : " + nfe get message ( ) + " in " + to string ( ele ) ) ; } }


stores a collection of values with the same key , replacing any existing values for that key if { @ code values } is empty , this is equivalent to { @ link # remove all ( object ) remove all ( key ) }

collection < v > replace values ( @ nullable k key , iterable < ? extends v > values ) ;


checks that future get times out , with the given millisecond timeout

void assert future times out ( future future , long timeout millis ) { long start time = system nano time ( ) ; try { future get ( timeout millis , milliseconds ) ; should throw ( ) ; } catch ( timeout exception success ) { } catch ( exception fail ) { thread unexpected exception ( fail ) ; } finally { future cancel ( true ) ; } assert true ( millis elapsed since ( start time ) > = timeout millis ) ; }


returns a table source matching the descriptor

public static < t > table source < t > find and create table source ( table source factory context context ) { try { return table factory service find ( table source factory class , context get table ( ) to properties ( ) ) create table source ( context ) ; } catch ( throwable t ) { throw new table exception ( " find and create table source failed " , t ) ; } }


resolves a pattern to multiple , separate indices doesn ' t perform validation

public void resolve as separate mappings ( string index wildcard , string java regex , boolean include frozen , action listener < list < es index > > listener ) { field capabilities request field request = create field caps request ( index wildcard , include frozen ) ; client field caps ( field request , wrap ( response - > { client admin ( ) indices ( ) get aliases ( create get aliases request ( response , include frozen ) , wrap ( aliases - > listener on response ( separate mappings ( type registry , java regex , response get indices ( ) , response get ( ) , aliases get aliases ( ) ) ) , ex - > { if ( ex instanceof index not found exception | | ex instanceof elasticsearch security exception ) { listener on response ( separate mappings ( type registry , java regex , response get indices ( ) , response get ( ) , null ) ) ; } else { listener on failure ( ex ) ; } } ) ) ; } , listener : : on failure ) ) ; }


creates an instance of { @ link generic row data } with given field values by default , the row describes a { @ link row kind # insert } in a changelog note : all fields of the row must be internal data structures

public static generic row data of ( object values ) { generic row data row = new generic row data ( values length ) ; for ( int i = 0 ; i < values length ; + + i ) { row set field ( i , values [ i ] ) ; } return row ; }


collect union states from given parallel subtask states

private map < string , list < tuple 2 < stream state handle , operator state handle state meta info > > > collect union states ( list < list < operator state handle > > parallel subtask states ) { map < string , list < tuple 2 < stream state handle , operator state handle state meta info > > > union states = new hash map < > ( parallel subtask states size ( ) ) ; for ( list < operator state handle > sub task state : parallel subtask states ) { for ( operator state handle operator state handle : sub task state ) { if ( operator state handle = = null ) { continue ; } final set < map entry < string , operator state handle state meta info > > partition offset entries = operator state handle get state name to partition offsets ( ) entry set ( ) ; partition offset entries stream ( ) filter ( entry - > entry get value ( ) get distribution mode ( ) equals ( operator state handle mode union ) ) for each ( entry - > { list < tuple 2 < stream state handle , operator state handle state meta info > > state locations = union states compute if absent ( entry get key ( ) , k - > new array list < > ( parallel subtask states size ( ) * partition offset entries size ( ) ) ) ; state locations add ( tuple 2 of ( operator state handle get delegate state handle ( ) , entry get value ( ) ) ) ; } ) ; } } return union states ; }


this function combines get all by domain name and get hostname by i p , for a single domain name , it will first do a forward lookup to get all of ip addresses , then for each ip address , it will do a reverse lookup to get the fqdn this function is necessary in secure environment since kerberos uses fqdn in the service principal instead of ip

string [ ] get all resolved hostname by domain name ( string domain name , boolean use f q d n ) throws unknown host exception ;


public big decimal get number item ( ) { return number item ; }


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

boolean retain all ( collection < ? > c ) ;


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


creates a replaying connectable observable with a time bound buffer

public static < t > connectable flowable < t > create ( flowable < t > source , long max age , time unit unit , scheduler scheduler , boolean eager truncate ) { return create ( source , max age , unit , scheduler , integer max value , eager truncate ) ; }


public string get user ( ) { return current user ; }


public string command ( string command ) throws i o exception { assert that ( " ; automatically added " , command , not ( ends with ( " ; " ) ) ) ; logger info ( " out : { } ; " , command ) ; out write ( command + " ; \ n " ) ; out flush ( ) ; for ( string echo : expected command echos ( command ) ) { assert equals ( echo , read line ( ) ) ; } return read line ( ) ; }


this implementation creates a file system resource , applying the given path relative to the path of the underlying file of this resource descriptor

public resource create relative ( string relative path ) { string path to use = string utils apply relative path ( this path , relative path ) ; return ( this file ! = null ? new file system resource ( path to use ) : new file system resource ( this file path get file system ( ) , path to use ) ) ; }


public string get pathname ( ) { synchronized ( file system ) { string buffer buf = new string buffer ( parent ! = null ? parent get pathname ( ) : " " ) ; if ( buf length ( ) ! = 1 ) { buf append ( file system separator char ) ; } buf append ( name ) ; return buf to string ( ) ; } }


set the window maintain duration ( retention time ) in milliseconds this retention time is a guaranteed lower bound for how long a window will be maintained

public windows < w > until ( final long duration ms ) throws illegal argument exception { if ( duration ms < 0 ) { throw new illegal argument exception ( " window retention time ( duration ms ) cannot be negative " ) ; } maintain duration ms = duration ms ; return this ; }


public annotations list parse parameter attribute ( annotation visibility visibility ) { annotations list result ; try { result = parse annotations list ( visibility ) ; if ( input available ( ) ! = 0 ) { throw new parse exception ( " extra data in attribute " ) ; } } catch ( i o exception ex ) { / / byte array my data input stream should never throw throw new runtime exception ( " shouldn ' t happen " , ex ) ; } return result ; }


test the metric snapshottable directories , allow snapshot ops , disallow snapshot ops , and list snapshottable dir ops

public void test snapshottable dirs ( ) throws exception { cluster get namesystem ( ) get snapshot manager ( ) set allow nested snapshots ( true ) ; assert gauge ( " snapshottable directories " , 0 , get metrics ( ns metrics ) ) ; assert counter ( " allow snapshot ops " , 0l , get metrics ( nn metrics ) ) ; assert counter ( " disallow snapshot ops " , 0l , get metrics ( nn metrics ) ) ; / / allow snapshots for directories , and check the metrics hdfs allow snapshot ( sub 1 ) ; assert gauge ( " snapshottable directories " , 1 , get metrics ( ns metrics ) ) ; assert counter ( " allow snapshot ops " , 1l , get metrics ( nn metrics ) ) ; path sub 2 = new path ( dir , " sub 2 " ) ; path file = new path ( sub 2 , " file " ) ; d f s test util create file ( hdfs , file , 1024 , replication , seed ) ; hdfs allow snapshot ( sub 2 ) ; assert gauge ( " snapshottable directories " , 2 , get metrics ( ns metrics ) ) ; assert counter ( " allow snapshot ops " , 2l , get metrics ( nn metrics ) ) ; path subsub 1 = new path ( sub 1 , " sub 1sub 1 " ) ; path subfile = new path ( subsub 1 , " file " ) ; d f s test util create file ( hdfs , subfile , 1024 , replication , seed ) ; hdfs allow snapshot ( subsub 1 ) ; assert gauge ( " snapshottable directories " , 3 , get metrics ( ns metrics ) ) ; assert counter ( " allow snapshot ops " , 3l , get metrics ( nn metrics ) ) ; / / set an already snapshottable directory to snapshottable , should not / / change the metrics hdfs allow snapshot ( sub 1 ) ; assert gauge ( " snapshottable directories " , 3 , get metrics ( ns metrics ) ) ; / / but the number of allow snapshot operations still increases assert counter ( " allow snapshot ops " , 4l , get metrics ( nn metrics ) ) ; / / disallow the snapshot for snapshottable directories , then check the / / metrics again hdfs disallow snapshot ( sub 1 ) ; assert gauge ( " snapshottable directories " , 2 , get metrics ( ns metrics ) ) ; assert counter ( " disallow snapshot ops " , 1l , get metrics ( nn metrics ) ) ; / / delete subsub 1 , snapshottable directories should be 1 hdfs delete ( subsub 1 , true ) ; assert gauge ( " snapshottable directories " , 1 , get metrics ( ns metrics ) ) ; / / list all the snapshottable directories snapshottable directory status [ ] status = hdfs get snapshottable dir listing ( ) ; assert equals ( 1 , status length ) ; assert counter ( " list snapshottable dir ops " , 1l , get metrics ( nn metrics ) ) ; }


returns < tt > true < tt > if this queue contains the specified element more formally , returns < tt > true < tt > if and only if this queue contains at least one element < tt > e < tt > such that < tt > o equals ( e ) < tt >

public boolean contains ( @ nullable decl object o ) { if ( o = = null ) return false ; final e [ ] items = this items ; final monitor monitor = this monitor ; monitor enter ( ) ; try { int i = take index ; int k = 0 ; while ( k + + < count ) { if ( o equals ( items [ i ] ) ) return true ; i = inc ( i ) ; } return false ; } finally { monitor leave ( ) ; } }


public restore snapshot request repository ( string repository ) { this repository = repository ; return this ; }


< code > optional bytes msg = 7 ; < code >


returns the label of the xcode config rule to use for resolving the host system xcode version

public label get xcode config label ( ) { return null ; }


copies the data from input stream to output stream

public static long copy ( input stream from , output stream to ) throws i o exception { / / copied from guava com google common io byte streams because its api is unstable ( beta ) preconditions check not null ( from ) ; preconditions check not null ( to ) ; byte [ ] buf = new byte [ max buffer length ] ; long total = 0 ; while ( true ) { int r = from read ( buf ) ; if ( r = = - 1 ) { break ; } to write ( buf , 0 , r ) ; total + = r ; } return total ; }


public big decimal get number ( ) { return number ; }


returns type mappings using type parameters and type arguments found in the generic superclass and the super interfaces of { @ code context class }

static immutable map < type variable key , type > get type mappings ( type context type ) { check not null ( context type ) ; type mapping introspector introspector = new type mapping introspector ( ) ; introspector visit ( context type ) ; return immutable map copy of ( introspector mappings ) ; }


entry point for test assertions related to { @ link toolchain context }

public static toolchain context subject assert that ( toolchain context toolchain context ) { return assert about ( toolchain context subject factory ) that ( toolchain context ) ; }


returns { @ code throwable } ' s cause , cast to { @ code expected cause type } prefer this method instead of manually casting an exception ' s cause for example , { @ code ( i o exception ) e get cause ( ) } throws a { @ link class cast exception } that discards the original exception { @ code e } if the cause is not an { @ link i o exception } , but { @ code throwables get cause as ( e , i o exception class ) } keeps { @ code e } as the { @ link class cast exception } ' s cause

public static < x extends throwable > x get cause as ( throwable throwable , class < x > expected cause type ) { try { return expected cause type cast ( throwable get cause ( ) ) ; } catch ( class cast exception e ) { e init cause ( throwable ) ; throw e ; } }


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


sets the size - indicating how many term buckets should be returned ( defaults to 10 )

public significant terms aggregation builder size ( int size ) { if ( size < = 0 ) { throw new illegal argument exception ( " [ size ] must be greater than 0 found [ " + size + " ] in [ " + name + " ] " ) ; } bucket count thresholds set required size ( size ) ; return this ; }


return a wrapped reader that only exposes allowed fields

public directory reader filter ( directory reader reader ) throws i o exception { if ( has field level security ( ) = = false ) { return reader ; } return field subset reader wrap ( reader , permitted fields automaton ) ; }


test sending to a destination using the method send ( string d , message creator message creator ) using qos parameters

void test send destination name with q o s ( ) throws exception { do test send destination ( false , false , false , true ) ; }


gets the " netscape " loop count , if any a count of 0 ( { @ link gif header # netscape loop count forever } ) means repeat indefinitely it must not be a negative value < br > use { @ link # get total iteration count ( ) } to know how many times the animation sequence should be displayed


returns the path for the lock node relative to the given path

protected string get lock path ( string root path ) { return root path + ' / ' + lock node ; }


update any null registration information using the specified updated information this assumption is that multiple registrations for the same option may be partial but will be compatible no compatibility checks are performed between existing registration and update registration info

final void update registration ( string updated description , help location updated help , object updated default value , property editor updated editor ) { description = description ! = null ? description : updated description ; help location = help location ! = null ? help location : updated help ; default value = default value ! = null ? default value : updated default value ; property editor = property editor ! = null ? property editor : updated editor ; is registered = true ; }


public static void relaunch app ( final boolean is kill process ) { intent intent = utils bridge get launch app intent ( utils get app ( ) get package name ( ) ) ; if ( intent = = null ) { log e ( " app utils " , " didn ' t exist launcher activity " ) ; return ; } intent add flags ( intent flag activity new task | intent flag activity clear top | intent flag activity clear task ) ; utils get app ( ) start activity ( intent ) ; if ( ! is kill process ) return ; android os process kill process ( android os process my pid ( ) ) ; system exit ( 0 ) ; }


define the main panel for the dialog here

protected j panel build main panel ( ) { / / give base class the panel it needs to complete its construction / / and then finish building after base class is done main panel = new j panel ( ) ; main panel set layout ( new box layout ( main panel , box layout y axis ) ) ; list model = new default list model < > ( ) ; set plugin paths list data ( preferences get plugin paths ( ) ) ; / / construct the bottom error message panel j panel status message panel = new j panel ( ) ; status message = new g d label ( " ready to set user plugin paths " ) ; status message set name ( " status label " ) ; status message set foreground ( status message color ) ; status message panel add ( status message ) ; / / put the main panel together / / make sure to construct the plugin paths panel , since that / / creates the scroll pane we use for sizing the text fields on / / subsequent panels main panel add ( build plugin paths panel ( ) ) ; main panel add ( box create vertical strut ( 10 ) ) ; main panel add ( box create vertical glue ( ) ) ; main panel add ( status message panel ) ; main panel invalidate ( ) ; / / dialog sensitivity setup enable buttons ( false ) ; set apply enabled ( false ) ; return main panel ; }


factory for " 32 " version of thread storage symbol internals

public static thread storage symbol internals parse 3 2 ( pdb byte reader reader , abstract pdb pdb ) throws pdb exception { thread storage symbol internals result = new thread storage symbol internals ( pdb ) ; result type record number = record number parse ( pdb , reader , record category type , 32 ) ; result offset = reader parse var sized offset ( 32 ) ; result segment = pdb parse segment ( reader ) ; result name = reader parse string ( pdb , string parse type string utf 8 nt ) ; reader align 4 ( ) ; return result ; }


creates a version - specific elasticsearch sink , using arbitrary transport addresses

protected abstract elasticsearch sink base < tuple 2 < integer , string > , c > create elasticsearch sink ( int bulk flush max actions , string cluster name , list < a > addresses , elasticsearch sink function < tuple 2 < integer , string > > elasticsearch sink function ) ;


get the dwarf - encoded integer value as stored by the context

public final long decode ( dwarf decode context context ) throws memory access exception { long val = do decode ( context ) ; return resolve relative offset ( val , context ) ; }


returns the length of a starlark string , sequence ( such as a list or tuple ) , dict , or other iterable , as if by the starlark expression { @ code len ( x ) } , or - 1 if the value is valid but has no length

public static int len ( object x ) { if ( x instanceof string ) { return ( ( string ) x ) length ( ) ; } else if ( x instanceof sequence ) { return ( ( sequence ) x ) size ( ) ; } else if ( x instanceof dict ) { return ( ( dict ) x ) size ( ) ; } else if ( x instanceof starlark iterable ) { / / iterables size runs in constant time if x implements collection return iterables size ( ( iterable < ? > ) x ) ; } else { check valid ( x ) ; return - 1 ; / / valid but not a sequence } }


regression test : make sure that if an evaluation fails before a dirty value starts evaluation ( in particular , before it is reset ) , the graph remains consistent

public void many dirty values clear children on error ( ) throws exception { many dirty values clear children on fail ( / * interrupt = * / false ) ; }


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


create a new { @ code server service definition } whose { @ link server call handler } s will call { @ code interceptors } before calling the pre - existing { @ code server call handler } the last interceptor will have its { @ link server interceptor # intercept call } called first

public static server service definition intercept ( server service definition service def , server interceptor interceptors ) { return intercept ( service def , arrays as list ( interceptors ) ) ; }


see original { @ link ongoing stubbing # then ( answer ) }

b d d my ongoing stubbing < t > will ( answer < ? > answer ) ;


public static string to xml ( object root , string encoding ) { class clazz = class util unwrap cglib ( root ) ; return to xml ( root , clazz , encoding ) ; }


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

public java lang string get hosts ( int index ) { return hosts get ( index ) ; }


get the { @ link timestamped key value store } with the given name the store can be a " regular " or global store this is often useful in test cases to pre - populate the store before the test case instructs the topology to { @ link # pipe input ( consumer record ) process an input message } , andor to check the store afterward

public < k , v > key value store < k , value and timestamp < v > > get timestamped key value store ( final string name ) { final state store store = get state store ( name , false ) ; return store instanceof timestamped key value store ? ( timestamped key value store < k , v > ) store : null ; }


checks and returns the status of the existing index in this store

public check index status check index ( print stream out ) throws i o exception { metadata lock write lock ( ) lock ( ) ; try ( check index check index = new check index ( directory ) ) { check index set info stream ( out ) ; return check index check index ( ) ; } finally { metadata lock write lock ( ) unlock ( ) ; } }


factory method to create an appropriate instance of a queue configuration parser returns a parser that can parse either the deprecated property style queue configuration in mapred - site xml , or one that can parse hierarchical queues in mapred - queues xml first preference is given to configuration in mapred - site xml if no queue configuration is found there , then a parser that can parse configuration in mapred - queues xml is created

static queue configuration parser get queue configuration parser ( configuration conf , boolean reload conf , boolean are acls enabled ) { if ( conf ! = null & & conf get ( deprecated queue configuration parser mapred queue names key ) ! = null ) { if ( reload conf ) { conf reload configuration ( ) ; } return new deprecated queue configuration parser ( conf ) ; } else { url xml in url = thread current thread ( ) get context class loader ( ) get resource ( queue conf file name ) ; if ( xml in url = = null ) { xml in url = thread current thread ( ) get context class loader ( ) get resource ( queue conf default file name ) ; assert xml in url ! = null ; / / this should be in our jar } input stream stream = null ; try { stream = xml in url open stream ( ) ; return new queue configuration parser ( new buffered input stream ( stream ) , are acls enabled ) ; } catch ( i o exception ioe ) { throw new runtime exception ( " couldn ' t open queue configuration at " + xml in url , ioe ) ; } finally { i o utils close stream ( stream ) ; } } }


adjust { @ code item } using specific { @ code sparse index map }

protected t adjust item ( abstract index map index map , t item ) { return item ; }


remove all metrics published by this task

public void remove metrics ( ) { task metrics group close ( ) ; }


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


return the additional ( undeclared ) property with the specified name

public fruit get additional property ( string key ) { if ( this additional properties = = null ) { return null ; } return this additional properties get ( key ) ; }


adds a validation state to the final results

public void add result ( validated validated ) { synchronized ( validations ) { validation rule rule = validated get rule ( ) ; if ( rule ! = null & & ! rule equals ( validation rule empty ( ) ) & & ! validations contains ( validated ) ) { validations add ( validated ) ; } } }


evaluates the cluster state and tries to assign tasks to nodes

cluster state reassign tasks ( final cluster state current state ) { cluster state cluster state = current state ; final persistent tasks custom metadata tasks = current state get metadata ( ) custom ( persistent tasks custom metadata type ) ; if ( tasks ! = null ) { logger trace ( " reassigning { } persistent tasks " , tasks tasks ( ) size ( ) ) ; final discovery nodes nodes = current state nodes ( ) ; / / we need to check if removed nodes were running any of the tasks and reassign them for ( persistent task < ? > task : tasks tasks ( ) ) { if ( needs reassignment ( task get assignment ( ) , nodes ) ) { assignment assignment = create assignment ( task get task name ( ) , task get params ( ) , cluster state ) ; if ( objects equals ( assignment , task get assignment ( ) ) = = false ) { logger trace ( " reassigning task { } from node { } to node { } " , task get id ( ) , task get assignment ( ) get executor node ( ) , assignment get executor node ( ) ) ; cluster state = update ( cluster state , builder ( cluster state ) reassign task ( task get id ( ) , assignment ) ) ; } else { logger trace ( " ignoring task { } because assignment is the same { } " , task get id ( ) , assignment ) ; } } else { logger trace ( " ignoring task { } because it is still running " , task get id ( ) ) ; } } } return cluster state ; }


gets the data type ( as a { @ link type information } ) produced by this function or input format

type information < t > get produced type ( ) ;


calculate the mapped source address for a specified offset with the mapped sub - block

public address get mapped source address ( address mapped source base address , long offset in sub block ) throws address overflow exception { if ( offset in sub block < 0 ) { throw new illegal argument exception ( " negative offset " ) ; } long source offset = offset in sub block ; if ( ! is one to one mapping ( ) ) { source offset = ( mapped source byte count * ( offset in sub block / mapped byte count ) ) + ( offset in sub block % mapped byte count ) ; } return mapped source base address add no wrap ( source offset ) ; }


returns the next token in the string as an { @ code object } this method is implemented in order to satisfy the { @ code enumeration } interface

public object next element ( ) { return next token ( ) ; }


check whether this resolver is supposed to apply to the given handler the default implementation checks against the configured { @ linkplain # set mapped handlers handlers } and { @ linkplain # set mapped handler classes handler classes } , if any

protected boolean should apply to ( http servlet request request , @ nullable object handler ) { if ( handler ! = null ) { if ( this mapped handlers ! = null & & this mapped handlers contains ( handler ) ) { return true ; } if ( this mapped handler classes ! = null ) { for ( class < ? > handler class : this mapped handler classes ) { if ( handler class is instance ( handler ) ) { return true ; } } } } return ! has handler mappings ( ) ; }


public static view set status bar color ( @ non null final activity activity , @ color int final int color , final boolean is decor ) { if ( build version sdk int < build version codes kitkat ) return null ; transparent status bar ( activity ) ; return apply status bar color ( activity , color , is decor ) ; }


generates a list of symbols from the information that we have

protected void generate symbols list ( task monitor monitor ) throws pdb exception , cancelled exception { symbols = new array list < > ( ) ; map < long , abstract ms symbol > symbols by offset = pdb get debug info ( ) get symbols by offset ( ) ; for ( symbol hash record record : hash records ) { monitor check canceled ( ) ; long offset = record get offset ( ) - 2 ; / / modified offset abstract ms symbol symbol = symbols by offset get ( offset ) ; modified hash record symbol offsets add ( offset ) ; if ( symbol = = null ) { throw new pdb exception ( " pdb corrupted " ) ; } symbols add ( symbol ) ; } }


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


public void test file exists ( ) throws exception { path file = touch ( local fs , name get method name ( ) to lower case ( ) ) ; assert true ( sftp fs exists ( file ) ) ; assert true ( local fs exists ( file ) ) ; assert true ( sftp fs delete ( file , false ) ) ; assert false ( sftp fs exists ( file ) ) ; assert false ( local fs exists ( file ) ) ; assert that ( ( ( s f t p file system ) sftp fs ) get connection pool ( ) get live conn count ( ) , is ( 1 ) ) ; }


set the body of the request and build it the string is assumed to be utf - 8 encoded unless the request has a " content - type " header with a charset attribute

mock server http request body ( string body ) ;


if set to true , all future compositions that are set will be cached so that they don ' t need to be parsed next time they are loaded this won ' t apply to compositions that have already been loaded defaults to true { @ link r attr # lottie cache composition }

public void set cache composition ( boolean cache composition ) { this cache composition = cache composition ; }


return a { @ link numeric doc values } instance that has a value for every document , returns the same value as { @ code values } if there is a value for the current document and { @ code missing } otherwise

public static numeric doc values replace missing ( numeric doc values values , long missing ) { return new abstract numeric doc values ( ) { private long value ; @ override public int doc i d ( ) { return values doc i d ( ) ; } @ override public boolean advance exact ( int target ) throws i o exception { if ( values advance exact ( target ) ) { value = values long value ( ) ; } else { value = missing ; } return true ; } @ override public long long value ( ) throws i o exception { return value ; } } ; }


public snapshot id snapshot id ( ) { return snapshot id ; }


private string get url ( string ip , string relative path ) { return " http : / / " + ip + env util get context path ( ) + relative path ; }


build the context and get the instance with the properties selected

public abfs client context build ( ) { / / validate the values return new abfs client context ( exponential retry policy , abfs perf tracker , abfs counters ) ; }


initializes the reduce - part of the job with the appropriate output settings

public static void set output ( job conf job , string table name , int field count ) { d b configuration db conf = set output ( job , table name ) ; db conf set output field count ( field count ) ; }


public set < string > get photo urls ( ) { return photo urls ; }


set the long value for instance settings

public boolean set long settings value ( address data addr , string name , long value ) { return update instance settings ( data addr , name , null , value , null ) ; }


commit offsets for the specified list of topics and partitions this is a non - blocking call which returns a request future that can be polled in the case of a synchronous commit or ignored in the asynchronous case note : this is visible only for testing

request future < void > send offset commit request ( final map < topic partition , offset and metadata > offsets ) { if ( offsets is empty ( ) ) return request future void success ( ) ; node coordinator = check and get coordinator ( ) ; if ( coordinator = = null ) return request future coordinator not available ( ) ; / / create the offset commit request map < string , offset commit request data offset commit request topic > request topic data map = new hash map < > ( ) ; for ( map entry < topic partition , offset and metadata > entry : offsets entry set ( ) ) { topic partition topic partition = entry get key ( ) ; offset and metadata offset and metadata = entry get value ( ) ; if ( offset and metadata offset ( ) < 0 ) { return request future failure ( new illegal argument exception ( " invalid offset : " + offset and metadata offset ( ) ) ) ; } offset commit request data offset commit request topic topic = request topic data map get or default ( topic partition topic ( ) , new offset commit request data offset commit request topic ( ) set name ( topic partition topic ( ) ) ) ; topic partitions ( ) add ( new offset commit request data offset commit request partition ( ) set partition index ( topic partition partition ( ) ) set committed offset ( offset and metadata offset ( ) ) set committed leader epoch ( offset and metadata leader epoch ( ) or else ( record batch no partition leader epoch ) ) set committed metadata ( offset and metadata metadata ( ) ) ) ; request topic data map put ( topic partition topic ( ) , topic ) ; } final generation generation ; if ( subscriptions has auto assigned partitions ( ) ) { generation = generation if stable ( ) ; / / if the generation is null , we are not part of an active group ( and we expect to be ) / / the only thing we can do is fail the commit and let the user rejoin the group in poll ( ) if ( generation = = null ) { log info ( " failing offset commit request since the consumer is not part of an active group " ) ; if ( rebalance in progress ( ) ) { / / if the client knows it is already rebalancing , we can use rebalance in progress exception instead of / / commit failed exception to indicate this is not a fatal error return request future failure ( new rebalance in progress exception ( " offset commit cannot be completed since the " + " consumer is undergoing a rebalance for auto partition assignment you can try completing the rebalance " + " by calling poll ( ) and then retry the operation " ) ) ; } else { return request future failure ( new commit failed exception ( " offset commit cannot be completed since the " + " consumer is not part of an active group for auto partition assignment ; it is likely that the consumer " + " was kicked out of the group " ) ) ; } } } else { generation = generation no generation ; } offset commit request builder builder = new offset commit request builder ( new offset commit request data ( ) set group id ( this rebalance config group id ) set generation id ( generation generation id ) set member id ( generation member id ) set group instance id ( rebalance config group instance id or else ( null ) ) set topics ( new array list < > ( request topic data map values ( ) ) ) ) ; log trace ( " sending offset commit request with { } to coordinator { } " , offsets , coordinator ) ; return client send ( coordinator , builder ) compose ( new offset commit response handler ( offsets , generation ) ) ; }


number of busy { @ link executor } s that are carrying out some work right now

public int get busy executors ( ) { int r = 0 ; for ( computer c : get all ( ) ) { if ( c is online ( ) ) r + = c count busy ( ) ; } return r ; }


returns the level of support that the sink provides for a given { @ link format }

int get format support ( format format ) ;


branch status branch rollback ( global session global session , branch session branch session ) throws transaction exception ;


private static string quick convert ( list < string > a ) { return gson to json ( a ) ; }


public static filtered javacopts create ( immutable list < string > bazel javacopts , immutable list < string > standard javacopts ) { return new auto value javac options filtered javacopts ( bazel javacopts , standard javacopts ) ; }


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


public void test array of number only ( ) { / / todo : test array of number only }


public void append ( byte [ ] key , int koff , int klen , byte [ ] value , int voff , int vlen ) throws i o exception { if ( ( koff | klen | ( koff + klen ) | ( key length - ( koff + klen ) ) ) < 0 ) { throw new index out of bounds exception ( " bad key buffer offset - length combination " ) ; } if ( ( voff | vlen | ( voff + vlen ) | ( value length - ( voff + vlen ) ) ) < 0 ) { throw new index out of bounds exception ( " bad value buffer offset - length combination " ) ; } try { data output stream dos key = prepare append key ( klen ) ; try { + + error count ; dos key write ( key , koff , klen ) ; - - error count ; } finally { dos key close ( ) ; } data output stream dos value = prepare append value ( vlen ) ; try { + + error count ; dos value write ( value , voff , vlen ) ; - - error count ; } finally { dos value close ( ) ; } } finally { state = state ready ; } }


increase the reference count if we create new invoker shares same connection , the connection will be closed without any reference

private void batch client ref incr ( list < reference count exchange client > reference count exchange clients ) { if ( collection utils is empty ( reference count exchange clients ) ) { return ; } for ( reference count exchange client reference count exchange client : reference count exchange clients ) { if ( reference count exchange client ! = null ) { reference count exchange client increment and get count ( ) ; } } }


{ @ link option definition } is really a wrapper around a { @ link field } that caches information obtained through reflection checking that the fields they represent are equal is sufficient to check that two { @ link option definition } objects are equal

public boolean equals ( object object ) { if ( ! ( object instanceof option definition ) ) { return false ; } option definition other option = ( option definition ) object ; return field equals ( other option field ) ; }


expect an attempt to create a session or request credentials to fail with a specific exception class , optionally text

public < e extends exception > e expected session request failure ( final class < e > clazz , final string endpoint , final string region , final string exception text ) throws exception { try ( a w s credential provider list parent creds = get file system ( ) share credentials ( " test " ) ; duration info ignored = new duration info ( log , " requesting credentials " ) ) { configuration conf = new configuration ( get contract ( ) get conf ( ) ) ; client configuration aws conf = s 3 a utils create aws conf ( conf , null , aws service identifier sts ) ; return intercept ( clazz , exception text , ( ) - > { a w s security token service token service = s t s client factory builder ( parent creds , aws conf , endpoint , region ) build ( ) ; invoker invoker = new invoker ( new s 3 a retry policy ( conf ) , log at error ) ; s t s client factory s t s client sts client = s t s client factory create client connection ( token service , invoker ) ; return sts client request session credentials ( 30 , time unit minutes ) ; } ) ; } }


required : a list of server specifications < code > repeated istio networking v 1alpha 3 server servers = 1 ; < code >

public int get servers count ( ) { if ( servers builder = = null ) { return servers size ( ) ; } else { return servers builder get count ( ) ; } }


list up all { @ link build wrapper descriptor } s that are applicable for the given project

public static list < descriptor < build wrapper > > get for ( abstract project < ? , ? > project ) { list < descriptor < build wrapper > > result = new array list < > ( ) ; descriptor pd = jenkins get ( ) get descriptor ( ( class ) project get class ( ) ) ; for ( descriptor < build wrapper > w : build wrapper all ( ) ) { if ( pd instanceof abstract project descriptor & & ! ( ( abstract project descriptor ) pd ) is applicable ( w ) ) continue ; if ( w instanceof build wrapper descriptor ) { build wrapper descriptor bwd = ( build wrapper descriptor ) w ; if ( bwd is applicable ( project ) ) result add ( bwd ) ; } else { / / old build wrapper that doesn ' t implement build wrapper descriptor result add ( w ) ; } } return result ; }


retrieves the { @ link abstract ms type } record indicated by the record number the record must already have been parsed and inserted into the list

public abstract ms type get record ( int record number ) { if ( record number < 0 | | record number - type index min > type list size ( ) ) { / / this should not happen , but we have seen it and cannot yet explain it / / so , for now , we are creating and returning a new bad ms type pdb log log bad type record index ( this , record number ) ; bad ms type type = new bad ms type ( pdb , 0 ) ; type set record number ( record number make ( record category , record number ) ) ; return type ; } if ( record number < type index min ) { primitive ms type primitive = primitive types by record number get ( record number ) ; if ( primitive = = null ) { primitive = new primitive ms type ( pdb , record number ) ; primitive types by record number put ( record number , primitive ) ; } return primitive ; } return type list get ( record number - type index min ) ; } / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = / / package - protected internals / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


set the socket address a client can use to connect for the < code > name < code > property as a < code > host : port < code > the wildcard address is replaced with the local host ' s address

public inet socket address update connect addr ( string name , inet socket address addr ) { final inet socket address connect addr = net utils get connect address ( addr ) ; set socket addr ( name , connect addr ) ; return connect addr ; }


test exceptions after the run of date format runnalbe a correct run should deliver 5 times the same exception

public void test exceptions ( ) { assert equals ( expected exceptions , result get exception list ( ) ) ; }


public void test cat all of ( ) { / / todo : test cat all of }


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

boolean remove all ( collection < ? > c ) ;


returns the path to this action ' s tool relative to the provided crosstool path

string get tool path string ( path fragment cc toolchain path ) { switch ( tool path origin ) { case crosstool package : / / legacy behavior return cc toolchain path get relative ( tool path fragment ) get safe path string ( ) ; case filesystem root : / / fallthrough case workspace root : return tool path fragment get safe path string ( ) ; } / / unreached throw new illegal state exception ( ) ; }


public cors configuration get cors configuration ( http servlet request request ) { return this cors configuration ; }


returns a formatted , comma - separated list of the user i ds associated with this { @ code request } , or { @ code null } if no user i ds were found the return value is used for audit logging while it may be easy on the eyes , it is underspecified : it does not mention the corresponding { @ code scheme } , nor are its components escaped this is not a security feature

public string get users for audit ( ) { return auth util get users ( auth info ) ; }


parses { @ code args } , using the classes registered with this parser , at the given priority may be called multiple times ; later options override existing ones if they have equal or higher priority strings that cannot be parsed as options are accumulated as residue , if this parser allows it { @ link # get options ( class ) } and { @ link # get residue ( ) } will return the results

public void parse ( option priority priority category priority , string source , list < string > args ) throws options parsing exception { parse with source function ( priority , o - > source , args ) ; }


instantiate a new { @ link hash map } with an initial capacity that can accommodate the specified number of elements without any immediate resizerehash operations to be expected this differs from the regular { @ link hash map } constructor which takes an initial capacity relative to a load factor but is effectively aligned with the jdk ' s { @ link java util concurrent concurrent hash map # concurrent hash map ( int ) }

public static < k , v > hash map < k , v > new hash map ( int expected size ) { return new hash map < > ( ( int ) ( expected size / default load factor ) , default load factor ) ; }


in addition to close , ensure that the next " open " would truncate the file

public synchronized void rewind ( ) throws i o exception { close current ( ) ; }


returns the { @ link thread properties } of the { @ link thread } that powers the { @ link single thread event executor } if the { @ link single thread event executor } is not started yet , this operation will start it and block until it is fully started

public final thread properties thread properties ( ) { thread properties thread properties = this thread properties ; if ( thread properties = = null ) { thread thread = this thread ; if ( thread = = null ) { assert ! in event loop ( ) ; submit ( noop task ) sync uninterruptibly ( ) ; thread = this thread ; assert thread ! = null ; } thread properties = new default thread properties ( thread ) ; if ( ! properties updater compare and set ( this , null , thread properties ) ) { thread properties = this thread properties ; } } return thread properties ; }


create a remote iterator from a remote iterator , casting the type in the process this is to help with filesystem api calls where overloading causes confusion ( e g list status iterator ( ) )

public static < s , t > remote iterator < t > type casting remote iterator ( remote iterator < s > iterator ) { return new type casting remote iterator < > ( iterator ) ; }


adds { @ link align # left } and clears { @ link align # right } for the alignment of the actor within the cell

public cell < t > left ( ) { if ( align = = null ) align = lefti ; else align = ( align | align left ) & ~ align right ; return this ; }


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 : / / msg return msg ; default : return null ; } }


marks the stack entry after the given offset

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


public list < acl > zk get a c l s ( string path ) throws i o exception { check service live ( ) ; string fullpath = create full path ( path ) ; list < acl > acls ; try { if ( log is debug enabled ( ) ) { log debug ( " get a c l s { } " , fullpath ) ; } acls = curator get a c l ( ) for path ( fullpath ) ; } catch ( exception e ) { throw operation failure ( fullpath , " read ( ) " , e ) ; } if ( acls = = null ) { throw new path not found exception ( path ) ; } return acls ; }


create a new arg - type - based prepared statement setter using the args and types passed in by default , we ' ll create an { @ link argument type prepared statement setter } this method allows for the creation to be overridden by subclasses

protected prepared statement setter new arg type prepared statement setter ( object [ ] args , int [ ] arg types ) { return new argument type prepared statement setter ( args , arg types ) ; }


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


sets the < code > bool item < code > property

public type holder example bool item ( boolean bool item ) { this bool item = bool item ; return this ; }


model tests for mixed properties and additional properties class

public void test mixed properties and additional properties class ( ) { / / todo : test mixed properties and additional properties class }


clears any cached glyphs and adds glyphs for the specified text

public glyph layout set text ( char sequence str , float x , float y ) { clear ( ) ; return add text ( str , x , y , 0 , str length ( ) , 0 , align left , false ) ; }


invokes { @ link video renderer event listener # on dropped frames ( int , long ) }

public void dropped frames ( int dropped frame count , long elapsed ms ) { if ( handler ! = null ) { handler post ( ( ) - > cast non null ( listener ) on dropped frames ( dropped frame count , elapsed ms ) ) ; } }


public string get content type ( ) { return this content type ; }


writes a cdata section ( as { @ link # cdata ( string ) } )

public void cdata ( string data , boolean quote ) { if ( in tag ) { / / complete the parent ' s start tag if ( compact ) { out print ( " > " ) ; } else { out println ( " > " ) ; } in tag = false ; } if ( data = = null ) { data = " " ; } boolean specials = false ; boolean cdata end = false ; / / scan the string for special characters / / if special characters are found , scan the string for ' ] ] > ' if ( string has x m l specials ( data ) ) { specials = true ; if ( data contains ( " ] ] > " ) ) { cdata end = true ; } } / / display the result display indent ( out , indent ) ; if ( quote | | always quote c data ) { out print ( " < ! [ cdata [ " ) ; out print ( data ) ; out println ( " ] ] > " ) ; } else if ( ! specials ) { out println ( data ) ; } else { string encode x m l ( data , out ) ; out println ( ) ; } out flush ( ) ; tags written + + ; }


set the options back to their default values

public void restore defaults ( ) { apply code scope block comments = default apply code scope block comments ; apply instruction labels = default apply instruction labels ; restrictions = default restrictions ; remap addresses using existing public symbols = default remap addresses using existing symbols ; allow demote primary mangled symbols = default allow demote primary mangled symbols ; apply function variables = default apply function variables ; class layout = default class layout ; }


returns an immutable collection of all key - value pairs in the multimap its iterator traverses the values for the first key , the values for the second key , and so on

public immutable set < entry < k , v > > entries ( ) { immutable set < entry < k , v > > result = entries ; return result = = null ? ( entries = new entry set < > ( this ) ) : result ; }


specify the cache period for the resources served by the resource handler , in seconds the default is to not send any cache headers but to rely on last - modified timestamps only set to 0 in order to send cache headers that prevent caching , or to a positive number of seconds to send cache headers with the given max - age value

public resource handler registration set cache period ( integer cache period ) { this cache period = cache period ; return this ; }


use the knuth notation u { x } - dividend v { v } - divisor

private static int estimate quotient ( int u 2 , int u 1 , int u 0 , int v 1 , int v 0 ) { / / estimate qhat based on the first 2 digits of divisor divided by the first digit of a dividend long u 2 1 = combine ints ( u 2 , u 1 ) ; long qhat ; if ( u 2 = = v 1 ) { qhat = int base - 1 ; } else if ( u 2 1 > = 0 ) { qhat = u 2 1 / ( v 1 & long mask ) ; } else { qhat = divide unsigned long ( u 2 1 , v 1 & long mask ) ; } if ( qhat = = 0 ) { return 0 ; } / / check if qhat is greater than expected considering only first 3 digits of a dividend / / this step help to eliminate all the cases when the estimation is greater than q by 2 / / and eliminates most of the cases when qhat is greater than q by 1 / / / / u 2 * b * b + u 1 * b + u 0 > = ( v 1 * b + v 0 ) * qhat / / u 2 * b * b + u 1 * b + u 0 > = v 1 * b * qhat + v 0 * qhat / / u 2 * b * b + u 1 * b - v 1 * b * qhat > = v 0 * qhat - u 0 / / ( u 2 1 - v 1 * qhat ) * b > = v 0 * qhat - u 0 / / ( u 2 1 - v 1 * qhat ) * b + u 0 > = v 0 * qhat / / when ( ( u 2 1 - v 1 * qhat ) * b + u 0 ) is less than ( v 0 * qhat ) decrease qhat by one int iterations = 0 ; long rhat = u 2 1 - ( v 1 & long mask ) * qhat ; while ( long compare unsigned ( rhat , int base ) < 0 & & long compare unsigned ( ( v 0 & long mask ) * qhat , combine ints ( low int ( rhat ) , u 0 ) ) > 0 ) { iterations + + ; qhat - - ; rhat + = ( v 1 & long mask ) ; } if ( iterations > 2 ) { throw new illegal state exception ( " qhat is greater than q by more than 2 : " + iterations ) ; } return ( int ) qhat ; }


scenario : sync invocation , no attachment added by default verify : no id attribute added in attachment

public void test attach invocation id if async sync ( ) { url url = url value of ( " dubbo : / / localhost / " ) ; invocation inv = new rpc invocation ( " test " , " demo service " , " " , new class [ ] { } , new string [ ] { } ) ; rpc utils attach invocation id if async ( url , inv ) ; assert null ( rpc utils get invocation id ( inv ) ) ; }


propagate a fatal error which affects the ability to fetch metadata for the cluster two examples are authentication and unsupported version exceptions

public synchronized void fatal error ( kafka exception exception ) { this fatal exception = exception ; }


write a total of num writes record length data to a file , read it back , and check to make sure what was read is the same as what was written the sync interval is the number of writes after which to call hflush to force the data to storage

private void write and read one file ( int num writes , int record length , int sync interval ) throws i o exception { / / a lower bound on the minimum time we think it will take to do / / a write to azure storage final long minimum expected time = 20 ; log info ( " writing " + num writes * record length + " bytes to " + blob path get name ( ) ) ; f s data output stream output = fs create ( blob path ) ; int writes since h flush = 0 ; try { / / do a flush and hflush to exercise case for empty write queue in page blob output stream , / / to test concurrent execution gates output flush ( ) ; output hflush ( ) ; for ( int i = 0 ; i < num writes ; i + + ) { output write ( random data , i * record length , record length ) ; writes since h flush + + ; output flush ( ) ; if ( ( i % sync interval ) = = 0 ) { output hflush ( ) ; writes since h flush = 0 ; } } } finally { long start = time monotonic now ( ) ; output close ( ) ; long end = time monotonic now ( ) ; log debug ( " close duration = " + ( end - start ) + " msec " ) ; if ( writes since h flush > 0 ) { assert true ( string format ( " close duration with > = 1 pending write is % d , less than minimum expected of % d " , end - start , minimum expected time ) , end - start > = minimum expected time ) ; } } / / read the data back and check it f s data input stream stream = fs open ( blob path ) ; int size = num writes * record length ; byte [ ] b = new byte [ size ] ; try { stream seek ( 0 ) ; stream read ( b , 0 , size ) ; verify read random data ( b , size , 0 , size ) ; } finally { stream close ( ) ; } / / delete the file fs delete ( blob path , false ) ; }


return a resolvable type for this bean definition this implementation delegates to { @ link # get bean class ( ) }

public resolvable type get resolvable type ( ) { return ( has bean class ( ) ? resolvable type for class ( get bean class ( ) ) : resolvable type none ) ; }


initialize the filesystem if there is none bonded to already and the command line path list is not empty

boolean maybe init filesystem ( final list < string > paths ) throws i o exception { / / is there an s3 fs to create ? if ( get filesystem ( ) = = null ) { / / none yet - create one if ( ! paths is empty ( ) ) { init s 3 a file system ( paths get ( 0 ) ) ; } else { log debug ( " no path on command line , so not instantiating fs " ) ; } } return get filesystem ( ) ! = null ; }


this test has been moved to { @ link sum aggregator tests # test unmapped ( ) }

public void test unmapped ( ) throws exception { }


places the given plugin at the front of the list

public void prepend ( graph mouse plugin p ) { if ( mouse plugins contains ( p ) ) { mouse plugins remove ( p ) ; } mouse plugins add ( 0 , p ) ; }


increases the reference count by { @ code 1 }


moves the given vertex as necessary so that it is not touching any other vertex

protected void isolate vertex ( abstract test vertex v ) { graph viewer < abstract test vertex , test edge > viewer = graph component get primary viewer ( ) ; layout < abstract test vertex , test edge > layout = viewer get graph layout ( ) ; rectangle v bounds = graph viewer utils get vertex bounds in layout space ( viewer , v ) ; boolean hit = false ; collection < abstract test vertex > others = new hash set < > ( graph get vertices ( ) ) ; others remove ( v ) ; for ( abstract test vertex other : others ) { rectangle other bounds = graph viewer utils get vertex bounds in layout space ( viewer , other ) ; if ( v bounds intersects ( other bounds ) ) { hit = true ; point p = v bounds get location ( ) ; int w = ( int ) v bounds get width ( ) ; int h = ( int ) v bounds get height ( ) ; point new point = new point ( p x + w , p y + h ) ; swing ( ( ) - > layout set location ( v , new point ) ) ; viewer repaint ( ) ; sleep ( 50 ) ; / / let us see the effect wait for swing ( ) ; } } if ( hit ) { / / keep moving until we are clear of other vertices isolate vertex ( v ) ; } }


allows any currently running runnable to finish , clears any queued runnables , and then queues the given runnable to be run after the current runnable finishes see the class header for more info

public void run next ( monitored runnable runnable , string task name , int show progress delay ) { if ( runnable = = null ) { throw new illegal argument exception ( " runnable cannot be null ! " ) ; } worker clear pending jobs ( ) ; worker schedule ( new runner job ( this , task name , runnable , show progress delay ) ) ; }


find the sum of a window of values if all values are missingnull na n , the return value will be 0 0

public static double sum ( double [ ] values ) { if ( values length = = 0 ) { return 0 0 ; } return arrays stream ( values ) map ( value - > { if ( double is na n ( value ) = = false ) { return value ; } return 0 0 ; } ) sum ( ) ; }


returns true if the reference is to data

public boolean is data ( ) { return false ; }


public void test asm bug 3 1 7 7 8 5 ( ) { int result = test class for stack map frame test input for asm bug 3 1 7 7 8 5 ( ) ; assert that ( result ) is equal to ( 20 ) ; }


copies { @ code original } into a new entry chained to { @ code new next } returns the new entry , or { @ code null } if { @ code original } was already garbage collected

reference entry < k , v > copy entry ( reference entry < k , v > original , reference entry < k , v > new next ) { if ( original get key ( ) = = null ) { / / key collected return null ; } value reference < k , v > value reference = original get value reference ( ) ; v value = value reference get ( ) ; if ( ( value = = null ) & & value reference is active ( ) ) { / / value collected return null ; } reference entry < k , v > new entry = map entry factory copy entry ( this , original , new next ) ; new entry set value reference ( value reference copy for ( this value reference queue , value , new entry ) ) ; return new entry ; }


deprecated : change usages of this to { @ link # on execution error } invoked after failed execution of { @ link hystrix command # run ( ) } with thrown exception

public < t > exception on run error ( hystrix command < t > command instance , exception e ) { / / pass - thru by default return e ; }


tests that - - features = - thin lto overrides - - features = autofdo implicit thinlto and prevents enabling thin l t o for afdo with llvm

public void test auto fdo implicit thin lto disabled option ( ) throws exception { scratch file ( " pkg / build " , " " , " cc binary ( name = ' bin ' , " , " srcs = [ ' binfile cc ' , ] , " , " malloc = ' / / base : system malloc ' ) " ) ; scratch file ( " pkg / binfile cc " , " int main ( ) { } " ) ; scratch file ( " pkg / profile afdo " , " " ) ; setup auto fdo thin lto crosstool ( ) ; use configuration ( " - - fdo optimize = pkg / profile afdo " , " - - compilation mode = opt " , " - - features = autofdo implicit thinlto " , " - - features = - thin lto " ) ; artifact bin artifact = get files to build ( get configured target ( " / / pkg : bin " ) ) get singleton ( ) ; cpp link action link action = ( cpp link action ) get generating action ( bin artifact ) ; assert that ( link action get outputs ( ) ) contains exactly ( bin artifact ) ; lto backend action backend action = ( lto backend action ) get predecessor by input name ( link action , " pkg / bin lto / pkg / objs / bin / binfile o " ) ; / / we should not have a thin l t o backend action assert that ( backend action ) is null ( ) ; }


number of times that the job woke up to write documents

public long get trigger count ( ) { return trigger count ; }


void activate ( long total ) { assert namesystem has write lock ( ) ; assert status = = b m safe mode status off ; start time = monotonic now ( ) ; set block total ( total ) ; if ( are thresholds met ( ) ) { boolean exit result = leave safe mode ( false ) ; preconditions check state ( exit result , " failed to leave safe mode " ) ; } else { / / enter safe mode status = b m safe mode status pending threshold ; initialize repl queues if necessary ( ) ; report status ( " state * safe mode on " , true ) ; last status report = monotonic now ( ) ; } }


sets the records to be returned by this iterator each record ' s { @ link record and position } will have the same offset ( for { @ link record and position # get offset ( ) } the first returned record will have a records - to - skip count of { @ code skip count of first + 1 } , following the contract that each record needs to point to the position after itself ( because a checkpoint taken after the record was emitted needs to resume from after that record )

public void set ( final e [ ] records , final int num , final long offset , final long skip count of first ) { this records = records ; this num = num ; this pos = 0 ; this record and position set ( null , offset , skip count of first ) ; }


get the password to use in secret managers this is a constant ; its just recalculated every time to stop findbugs highlighting security risks of shared mutable byte arrays

protected static byte [ ] get secret manager passsword ( ) { return " non - password " get bytes ( charset for name ( " utf - 8 " ) ) ; }


instructs the { @ link interner builder } to build a strong interner

public interner builder strong ( ) { this strong = true ; return this ; }


sets whether the default visibility is set in the build file

public builder set default visibility set ( boolean default visibility set ) { this default visibility set = default visibility set ; return this ; }


returns the signed distance for a given point for points " inside " , this is the distance to the closest " outside " pixel for points " outside " , this is the negative distance to the closest " inside " pixel if no pixel of different color is found within a radius of { @ code spread } , returns the { @ code - spread } or { @ code spread } , respectively

private float find signed distance ( final int center x , final int center y , boolean [ ] [ ] bitmap ) { final int width = bitmap [ 0 ] length ; final int height = bitmap length ; final boolean base = bitmap [ center y ] [ center x ] ; final int delta = ( int ) math ceil ( spread ) ; final int start x = math max ( 0 , center x - delta ) ; final int end x = math min ( width - 1 , center x + delta ) ; final int start y = math max ( 0 , center y - delta ) ; final int end y = math min ( height - 1 , center y + delta ) ; int closest square dist = delta * delta ; for ( int y = start y ; y < = end y ; + + y ) { for ( int x = start x ; x < = end x ; + + x ) { if ( base ! = bitmap [ y ] [ x ] ) { final int square dist = square dist ( center x , center y , x , y ) ; if ( square dist < closest square dist ) { closest square dist = square dist ; } } } } float closest dist = ( float ) math sqrt ( closest square dist ) ; return ( base ? 1 : - 1 ) * math min ( closest dist , spread ) ; }


delete purchase order by id for valid response try integer i ds with value & lt ; 1000 anything above 1000 or nonintegers will generate api errors

public void delete order ( string order id , api client auth info auth info , handler < async result < void > > result handler ) { object local var body = null ; / / verify the required parameter ' order id ' is set if ( order id = = null ) { result handler handle ( api exception fail ( 400 , " missing the required parameter ' order id ' when calling delete order " ) ) ; return ; } / / create path and map variables string local var path = " / store / order / { order id } " replace all ( " \ \ { " + " order id " + " \ \ } " , encode parameter ( order id to string ( ) ) ) ; / / query params list < pair > local var query params = new array list < > ( ) ; / / header params multi map local var header params = multi map case insensitive multi map ( ) ; / / cookie params multi map local var cookie params = multi map case insensitive multi map ( ) ; / / form params / / todo : sending files within multipart / form - data is not supported yet ( because of vertx web - client ) map < string , object > local var form params = new hash map < > ( ) ; string [ ] local var accepts = { } ; string [ ] local var content types = { } ; string [ ] local var auth names = new string [ ] { } ; api client invoke a p i ( local var path , " delete " , local var query params , local var body , local var header params , local var cookie params , local var form params , local var accepts , local var content types , local var auth names , auth info , null , result handler ) ; }


returns the directory where archived application extensions are stored

public final resource file get extension archive dir ( ) { return extension archive dir ; }


the locality associated with the endpoint a locality corresponds to a failure domain ( e g , countryregionzone ) arbitrary failure domain hierarchies can be represented by separating each encapsulating failure domain by for example , the locality of an an endpoint in us , in us - east - 1 region , within availability zone az - 1 , in data center rack r 1 1 can be represented as usus - east - 1az - 1r 1 1 istio will configure the sidecar to route to endpoints within the same locality as the sidecar if none of the endpoints in the locality are available , endpoints parent locality ( but within the same network id ) will be chosen for example , if there are two endpoints in same network ( network i d " n 1 " ) , say e 1 with locality usus - east - 1az - 1r 1 1 and e 2 with locality usus - east - 1az - 2r 1 2 , a sidecar from usus - east - 1az - 1r 1 1 locality will prefer e 1 from the same locality over e 2 from a different locality endpoint e 2 could be the ip associated with a gateway ( that bridges networks n 1 and n 2 ) , or the ip associated with a standard service endpoint < code > string locality = 5 ; < code >

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


yarn job submission uses { @ link token cache # obtain tokens for namenodes ( credentials , path [ ] , configuration ) } for token retrieval : call it here to verify it works

public void test yarn credential pickup ( ) throws throwable { describe ( " verify tokens are picked up by the yarn " + " token cache obtain tokens for namenodes ( ) api call " ) ; credentials cred = new credentials ( ) ; path yarn path = path ( " test yarn credential pickup " ) ; path [ ] paths = new path [ ] { yarn path } ; configuration conf = get configuration ( ) ; s 3 a file system fs = get file system ( ) ; token cache obtain tokens for namenodes ( cred , paths , conf ) ; assert not null ( " no token in credentials file " , lookup token ( cred , fs get uri ( ) , get token kind ( ) ) ) ; }


creates a new { @ link configuration } from the given { @ link properties }

public static configuration create configuration ( properties properties ) { final configuration configuration = new configuration ( ) ; final set < string > property names = properties string property names ( ) ; for ( string property name : property names ) { configuration set string ( property name , properties get property ( property name ) ) ; } return configuration ; }


public static string hex encode ( final string data ) { try { val result = hex encode hex ( data get bytes ( standard charsets utf 8 ) ) ; return new string ( result ) ; } catch ( final exception e ) { return null ; } }


public void options changed ( tool options options , string option name , object old value , object new value ) { if ( options get name ( ) equals ( " byte viewer " ) ) { if ( option name equals ( option current view cursor color ) ) { panel set current cursor color ( ( color ) new value ) ; } else if ( option name equals ( option cursor color ) ) { panel set cursor color ( ( color ) new value ) ; } else if ( option name equals ( option current line color ) ) { panel set current cursor line color ( ( color ) new value ) ; } else if ( option name equals ( option edit color ) ) { panel set edit color ( ( color ) new value ) ; } else if ( option name equals ( option separator color ) ) { panel set separator color ( ( color ) new value ) ; } else if ( option name equals ( option nonfocus cursor color ) ) { panel set non focus cursor color ( ( color ) new value ) ; } else if ( option name equals ( option font ) ) { set font ( system utilities adjust for font size override ( ( font ) new value ) ) ; } } else if ( options get name ( ) equals ( category browser fields ) ) { if ( option name equals ( cursor highlight button name ) ) { cursor mouse button names mouse button = ( cursor mouse button names ) new value ; panel set highlight button ( mouse button get mouse event i d ( ) ) ; } else if ( option name equals ( highlight color name ) ) { panel set mouse button highlight color ( ( color ) new value ) ; } } }


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

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


populate the reverse map for the library symbols in the latest program

private void map results to latest libs ( ) { symbol table latest symbol manager = latest pgm get symbol table ( ) ; string [ ] latest names = latest ext mgr get external library names ( ) ; for ( string latest name : latest names ) { symbol library symbol = latest symbol manager get library symbol ( latest name ) ; long latest i d = library symbol get i d ( ) ; long result i d ; try { result i d = get result i d from latest i d ( latest i d ) ; } catch ( no value exception e ) { result i d = latest i d ; } if ( result i d ! = - 1 ) { result to latest map put ( result i d , latest i d ) ; } } }


configure whether to verify certificate and hostname when making https requests default to true note : do not set to false in production code , otherwise you would face multiple types of cryptographic attacks

public api client set verifying ssl ( boolean verifying ssl ) { this verifying ssl = verifying ssl ; apply ssl settings ( ) ; return this ; }


returns the value associated with the given key as a double

public double get double ( string key , double default value ) { return get raw value ( key ) map ( configuration utils : : convert to double ) or else ( default value ) ; }


shuts down the given executor service gradually , first disabling new submissions and later , if necessary , cancelling remaining tasks the method takes the following steps : calls { @ link executor service # shutdown ( ) } , disabling acceptance of new submitted tasks awaits executor service termination for half of the specified timeout if the timeout expires , it calls { @ link executor service # shutdown now ( ) } , cancelling pending tasks and interrupting running tasks awaits executor service termination for the other half of the specified timeout if , at any step of the process , the calling thread is interrupted , the method calls { @ link executor service # shutdown now ( ) } and returns

public static boolean shutdown and await termination ( executor service service , duration timeout ) { return shutdown and await termination ( service , to nanos saturated ( timeout ) , time unit nanoseconds ) ; }


write 8 byte fixed length integer to byte buffers

public void write int 8 ( final long value ) { byte buf write long l e ( value ) ; }


private void inline subroutines ( ) { if ( configuration verbose ) { system out println ( " inlining subroutines " ) ; } / / perform the actual inlining new subroutine inliner ( configuration ) execute ( program class pool ) ; }


store a working range information into a list for later use by { @ link layout state }

protected static void register working range ( string name , working range working range , component component , string global key ) { if ( component m working range registrations = = null ) { component m working range registrations = new array list < > ( ) ; } component m working range registrations add ( new working range container registration ( name , working range , component , global key ) ) ; }


fills alias result with empty entries for requested indices when no specific aliases were requested

static immutable open map < string , list < alias metadata > > post process ( get aliases request request , string [ ] concrete indices , immutable open map < string , list < alias metadata > > aliases , cluster state state , boolean system index access allowed , system indices system indices ) { boolean no aliases specified = request get original aliases ( ) = = null | | request get original aliases ( ) length = = 0 ; immutable open map builder < string , list < alias metadata > > map builder = immutable open map builder ( aliases ) ; for ( string index : concrete indices ) { if ( aliases get ( index ) = = null & & no aliases specified ) { list < alias metadata > previous = map builder put ( index , collections empty list ( ) ) ; assert previous = = null ; } } final immutable open map < string , list < alias metadata > > final response = map builder build ( ) ; if ( system index access allowed = = false ) { check system index access ( request , system indices , state , final response ) ; } return final response ; }


boolean is consent required ( service service , registered service registered service , authentication authentication , request context request context ) ;


fits this rectangle around another rectangle while maintaining aspect ratio this scales and centers the rectangle to the other rectangle ( e g having a camera translate and scale to show a given area )

public rectangle fit outside ( rectangle rect ) { float ratio = get aspect ratio ( ) ; if ( ratio > rect get aspect ratio ( ) ) { / / wider than tall set size ( rect height * ratio , rect height ) ; } else { / / taller than wide set size ( rect width , rect width / ratio ) ; } set position ( ( rect x + rect width / 2 ) - width / 2 , ( rect y + rect height / 2 ) - height / 2 ) ; return this ; }


public boolean matches ( t target ) { return target get annotation type ( ) as erasure ( ) get name ( ) equals ( annotation type name ) ; }


sets this matrix to a translation matrix

public affine 2 set to translation ( float x , float y ) { m 0 0 = 1 ; m 0 1 = 0 ; m 0 2 = x ; m 1 0 = 0 ; m 1 1 = 1 ; m 1 2 = y ; return this ; }


post the provided { @ link com google devtools build lib events extended event handler postable } to the { @ link event bus } and all the { @ link extended event handler } registered in this reporter

public void post ( extended event handler postable obj ) { if ( event bus ! = null ) { event bus post ( obj ) ; } for ( event handler event handler : event handlers ) { if ( event handler instanceof extended event handler ) { ( ( extended event handler ) event handler ) post ( obj ) ; } } }


creates a key for evaluation of { @ link collect targets in package function } see that class ' s comment for what callers should have done beforehand

public static collect targets in package key key ( package identifier package id , filtering policy filtering policy ) { return collect targets in package key create ( package id , filtering policy ) ; }


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

public static fields find by name ( string name ) { return by name get ( name ) ; }


return the internal { @ link byte buf } on the specified offset note that updating the indexes of the returned buffer will lead to an undefined behavior of this buffer

public byte buf internal component at offset ( int offset ) { return find component ( offset ) slice ( ) ; }


returns the { @ code long } value of a header with the specified name if there is more than one value for the specified name , the first value in insertion order is returned


guaranteed to throw an exception and leave the table unmodified

public final void clear ( ) { throw new unsupported operation exception ( ) ; }


sets the { @ link http 2 connection } to use

protected b connection ( http 2 connection connection ) { enforce constraint ( " connection " , " max reserved streams " , max reserved streams ) ; enforce constraint ( " connection " , " server " , is server ) ; enforce constraint ( " connection " , " codec " , decoder ) ; enforce constraint ( " connection " , " codec " , encoder ) ; this connection = check not null ( connection , " connection " ) ; return self ( ) ; }


increase resource usage for this queue and all parent queues

protected void inc used resource ( resource res ) { synchronized ( resource usage ) { resources add to ( resource usage , res ) ; if ( parent ! = null ) { parent inc used resource ( res ) ; } } }


create { @ link test output topic } to be used for reading records from topic

public final < k , v > test output topic < k , v > create output topic ( final string topic name , final deserializer < k > key deserializer , final deserializer < v > value deserializer ) { return new test output topic < > ( this , topic name , key deserializer , value deserializer ) ; }


adds the given element to this queue if the queue is currently full , the element at the head of the queue is evicted to make room

public boolean add ( e e ) { check not null ( e ) ; / / check before removing if ( max size = = 0 ) { return true ; } if ( size ( ) = = max size ) { delegate remove ( ) ; } delegate add ( e ) ; return true ; }


get the code value for a particular integer error code

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


reads the centroid values from a broadcast variable into a collection

public void open ( configuration parameters ) throws exception { this centroids = get runtime context ( ) get broadcast variable ( " centroids " ) ; this acc = new custom accumulator ( ) ; get runtime context ( ) add accumulator ( " my acc " , this acc ) ; }


public static bitmap get bitmap ( @ non null final string key , @ non null final cache double utils cache double utils ) { return cache double utils get bitmap ( key ) ; }


test json serialization of form data < b > 200 < b > - successful operation

public void test json form data ( string param , string param 2 , map < string , object > params ) throws i o exception { test json form data for http response ( param , param 2 , params ) ; }


public string to string ( ) { return " [ " + n + " ; " + e + ( value = = null ? " ] " : " ] value = " + double double to long bits ( value ) ) ; }


the first character position this span applies to , in utf - 16 offset < code > optional uint 3 2 first char = 2 ; < code >

public int get first char ( ) { return first char ; }


picks the most recent entry in the subset that is most agreeable on the specified field 1 ) if a majority of the collection has the same value for the field , the first sorted entry within the subset the matches the majority value 2 ) otherwise the first sorted entry in the set of all entries

private membership state get representative quorum ( collection < membership state > records ) { / / collate objects by field value : field value - > order set of records map < federation namenode service state , tree set < membership state > > occurence map = new hash map < > ( ) ; for ( membership state record : records ) { federation namenode service state state = record get state ( ) ; tree set < membership state > matching set = occurence map get ( state ) ; if ( matching set = = null ) { / / tree set orders elements by descending date via comparators matching set = new tree set < > ( ) ; occurence map put ( state , matching set ) ; } matching set add ( record ) ; } / / select largest group tree set < membership state > largest set = new tree set < > ( ) ; for ( tree set < membership state > matching set : occurence map values ( ) ) { if ( largest set size ( ) < matching set size ( ) ) { largest set = matching set ; } } / / if quorum , use the newest element here if ( largest set size ( ) > records size ( ) / 2 ) { return largest set first ( ) ; / / otherwise , return most recent by class comparator } else if ( records size ( ) > 0 ) { tree set < membership state > sorted list = new tree set < > ( records ) ; log debug ( " quorum failed , using most recent : { } " , sorted list first ( ) ) ; return sorted list first ( ) ; } else { return null ; } }


set the content of the request body as a byte array if the supplied byte array represents text such as xml or json , the { @ link # set character encoding character encoding } should typically be set as well

public void set content ( @ nullable byte [ ] content ) { this content = content ; this input stream = null ; this reader = null ; }


helper for differential analysis which aggregates the test summary for an individual target , reporting runs on the event bus if necessary

synchronized test summary aggregate and report summary ( boolean skip targets on failure ) { / / if already reported by the listener , no work remains for this target if ( remaining runs is empty ( ) ) { return summary build ( ) ; } / / we will get back multiple test result instances if test had to be retried several / / times before passing sharding and multiple runs of the same test without retries / / will be represented by separate artifacts and will produce exactly one test result for ( artifact test status : test provider get test status artifacts ( test target ) ) { / / when a build is interrupted ( eg a broken target with - - nokeep going ) run result could / / be null for an unrelated test because we were not able to even try to execute the test / / in that case , for tests that were previously passing we return null ( = = no status ) , / / because checking if the cached test target is up - to - date would require running the / / dependency checker transitively test result run result = status map get ( test status ) ; boolean is incomplete run = remaining runs contains ( test status ) ; if ( run result = = null ) { mark incomplete ( skip targets on failure ) ; } else if ( is incomplete run ) { incremental analyze ( run result ) ; } } / / the target was not posted by the listener and must be posted now test summary result = summary build ( ) ; policy event bus post ( result ) ; return result ; }


open the atomic file for reading if there previously was an incomplete write , this will roll back to the last good data before opening for read note that if another thread is currently performing a write , this will incorrectly consider it to be in the state of a bad write and roll back , causing the new data currently being written to be dropped you must do your own threading protection for access to atomic file

public input stream open read ( ) throws file not found exception { restore backup ( ) ; return new file input stream ( base name ) ; }


gets symbol id groups for each library symbol that was in the original program < br > note : this method excludes any new library symbols in original whose matching result id has already been placed in the result i ds in a group set otherwise , each id group that has a result id will add it to the result i ds in a group set

private list < i d group > get groups for original libs ( ) { list < i d group > id groups = new array list < > ( ) ; string [ ] original names = original ext mgr get external library names ( ) ; symbol table original symbol table = original pgm get symbol table ( ) ; symbol table latest symbol table = latest pgm get symbol table ( ) ; symbol table my symbol table = my pgm get symbol table ( ) ; for ( string original name : original names ) { symbol original library symbol = original symbol table get library symbol ( original name ) ; long original i d = original library symbol get i d ( ) ; long result i d = get result i d from original i d ( original i d ) ; long latest i d = ( latest symbol table get symbol ( original i d ) ! = null ) ? original i d : - 1 ; long my i d = ( my symbol table get symbol ( original i d ) ! = null ) ? original i d : - 1 ; if ( result i ds in a group contains ( result i d ) ) { continue ; / / already have this result as an i d group } id groups add ( new i d group ( result i d , original i d , latest i d , my i d ) ) ; if ( result i d ! = - 1 ) { result i ds in a group add ( result i d ) ; } } return id groups ; }


finds the first { @ link view } with the specified tag in the rendered hierarchy

public @ nullable view find view with tag ( object tag ) { if ( tag = = null ) { return null ; } return find view with tag transversal ( m litho view , tag ) ; }


test ordinary addresses sort before private addresses

public void test sort key site local ( ) throws exception { inet address site local = inet address get by name ( " 172 16 0 1 " ) ; assert site local is site local address ( ) ; inet address ordinary = inet address get by name ( " 192 192 192 192 " ) ; assert true ( network utils sort key ( ordinary , true ) < network utils sort key ( site local , true ) ) ; assert true ( network utils sort key ( ordinary , false ) < network utils sort key ( site local , false ) ) ; inet address site local 6 = inet address get by name ( " fec 0 : : 1 " ) ; assert site local 6 is site local address ( ) ; inet address ordinary 6 = inet address get by name ( " fddd : : 1 " ) ; assert true ( network utils sort key ( ordinary 6 , true ) < network utils sort key ( site local 6 , true ) ) ; assert true ( network utils sort key ( ordinary 6 , false ) < network utils sort key ( site local 6 , false ) ) ; }


returns desugar - shadowed api adapters with desugar - mirrored types

public map based class file provider get api adapters ( ) { return map based class file provider builder ( ) set tag ( " shadowed api adapters " ) set file contents ( maps transform entries ( type adapters , ( class name , cw ) - > file content provider from bytes ( class name class file path name ( ) , cw to byte array ( ) ) ) ) build ( ) ; }


performs a two argument substitution for the ' message pattern ' passed as parameter for example , message formatter format ( & quot ; hi { } my name is { } & quot ; , & quot ; alice & quot ; , & quot ; bob & quot ; ) ; will return the string " hi alice my name is bob "

final public static formatting tuple format ( final string message pattern , object arg 1 , object arg 2 ) { return array format ( message pattern , new object [ ] { arg 1 , arg 2 } ) ; }


get number of reducers that were started

public long get reduce started ( ) { return reduce started ; }


sets the number of minimal prefix characters that must match in order be a candidate suggestion defaults to 1 increasing this number improves suggest performance usually misspellings don ' t occur in the beginning of terms

public term suggestion builder prefix length ( int prefix length ) { if ( prefix length < 0 ) { throw new illegal argument exception ( " prefix length must be positive " ) ; } this prefix length = prefix length ; return this ; }


returns the { @ link pdb reader options } for this pdb

public pdb reader options get pdb reader options ( ) { return reader options ; }


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