aes - ctr will consume all of the input data it requires enough space in the destination buffer to decrypt entire input buffer

public void decrypt ( byte buffer in buffer , byte buffer out buffer ) throws i o exception { process ( in buffer , out buffer ) ; }


for name node , verify that the current andor previous exist as indicated by the method parameters if previous exists , verify that it hasn ' t been modified by comparing the checksum of all it ' s containing files with their original checksum it is assumed that the server has recovered

void check result name node ( string [ ] base dirs , boolean current should exist , boolean previous should exist ) throws i o exception { if ( current should exist ) { for ( int i = 0 ; i < base dirs length ; i + + ) { assert true ( new file ( base dirs [ i ] , " current " ) is directory ( ) ) ; assert true ( new file ( base dirs [ i ] , " current / version " ) is file ( ) ) ; assert not null ( f s image test util find newest image file ( base dirs [ i ] + " / current " ) ) ; assert true ( new file ( base dirs [ i ] , " current / seen txid " ) is file ( ) ) ; } } if ( previous should exist ) { for ( int i = 0 ; i < base dirs length ; i + + ) { assert true ( new file ( base dirs [ i ] , " previous " ) is directory ( ) ) ; assert equals ( upgrade utilities checksum contents ( name node , new file ( base dirs [ i ] , " previous " ) , false ) , upgrade utilities checksum master name node contents ( ) ) ; } } }


return the runtime jars of the transitive closure of the target , excluding the first level of dependencies and the current target itself this particular set of jars is used by the persistent test runner , to create a classloader for the transitive dependencies the target itself and its direct dependencies are loaded into a different classloader

public nested set < artifact > get runtime classpath excluding direct ( ) { nested set builder < artifact > classpath = new nested set builder < > ( order stable order ) ; targets treated as deps ( classpath type runtime only ) stream ( ) map ( java info : : get java info ) filter ( objects : : non null ) for each ( j - > classpath add transitive ( j get transitive only runtime jars ( ) ) ) ; return classpath build ( ) ; }


launch the service and exit parse the command line build the service configuration from it start the service if it is a { @ link launchable service } : execute it otherwise : wait for it to finish exit passing the status code to the { @ link # exit ( int , string ) } method

public void launch service and exit ( list < string > args ) { string builder builder = new string builder ( ) ; for ( string arg : args ) { builder append ( ' " ' ) append ( arg ) append ( " \ " " ) ; } string argument string = builder to string ( ) ; if ( log is debug enabled ( ) ) { log debug ( startup shutdown message ( service name , args ) ) ; log debug ( argument string ) ; } register failure handling ( ) ; / / set up the configs , using reflection to push in the - site xml files load configuration classes ( ) ; configuration conf = create configuration ( ) ; for ( url resource url : conf resource urls ) { conf add resource ( resource url ) ; } bind command options ( ) ; exit util exit exception exit exception ; try { list < string > processed args = extract command options ( conf , args ) ; exit exception = launch service ( conf , processed args , true , true ) ; } catch ( exit util exit exception e ) { exit exception = e ; note exception ( exit exception ) ; } if ( exit exception get exit code ( ) = = launcher exit codes exit usage ) { / / something went wrong print the usage and commands system err println ( get usage message ( ) ) ; system err println ( " command : " + argument string ) ; } system out flush ( ) ; system err flush ( ) ; exit ( exit exception ) ; }


save target consistency protocol metadata

public void load ( final map < string , map < string , object > > map map ) { map map for each ( ( s , map ) - > { meta data map compute if absent ( s , meta data : : new ) ; final meta data data = meta data map get ( s ) ; map for each ( data : : put ) ; } ) ; }


register a listener that will be called when this model is unbound from a view the listener will contribute to this model ' s hash code state per the { @ link com airbnb epoxy epoxy attribute option # do not hash } rules you may clear the listener by setting a null value , or by calling { @ link # reset ( ) }

public list subtype model view model on unbind ( on model unbound listener < list subtype model view model , list subtype model view > listener ) { on mutation ( ) ; this on model unbound listener epoxy generated model = listener ; return this ; }


converts all data types in the data type manager into ansi - c code

public void write ( data type manager data type manager , task monitor monitor ) throws i o exception , cancelled exception { write ( data type manager get root category ( ) , monitor ) ; }


confirms if all messages have been consumed by all event processors

private boolean has backlog ( ) { final long cursor = ring buffer get cursor ( ) ; return consumer repository has backlog ( cursor , false ) ; }


step out from some existing vertex terms looking for useful connections

synchronized void expand ( ) { if ( has timed out ( ) ) { timed out set ( true ) ; listener on response ( build response ( ) ) ; return ; } map < string , set < vertex > > last hop findings = hop findings get ( current hop number ) ; if ( ( current hop number > = ( request get hop numbers ( ) - 1 ) ) | | ( last hop findings = = null ) | | ( last hop findings size ( ) = = 0 ) ) { / / either we gathered no leads from the last hop or we have / / reached the final hop listener on response ( build response ( ) ) ; return ; } hop last hop = request get hop ( current hop number ) ; current hop number + + ; hop current hop = request get hop ( current hop number ) ; final search request search request = new search request ( request indices ( ) ) indices options ( request indices options ( ) ) ; if ( request routing ( ) ! = null ) { search request routing ( request routing ( ) ) ; } bool query builder root bool = query builders bool query ( ) ; / / a single sample pool of docs is built at the root of the aggs tree / / for quality ' s sake it might have made more sense to sample top docs / / for each of the terms from the previous hop ( e g an initial query for " beatles " / / may have separate doc - sample pools for significant root terms " john " , " paul " , " yoko " etc ) / / but i found this dramatically slowed down execution - each pool typically had different docs which / / each had non - overlapping sets of terms that needed frequencies looking up for significant terms / / a common sample pool reduces the specialization that can be given to each root term but / / ultimately is much faster to run because of the shared vocabulary in a single sample set aggregation builder sample agg = null ; if ( request sample diversity field ( ) ! = null ) { diversified aggregation builder diversified sample agg = aggregation builders diversified sampler ( " sample " ) shard size ( request sample size ( ) ) ; diversified sample agg field ( request sample diversity field ( ) ) ; diversified sample agg max docs per value ( request max docs per diversity value ( ) ) ; sample agg = diversified sample agg ; } else { sample agg = aggregation builders sampler ( " sample " ) shard size ( request sample size ( ) ) ; } / / add any user - supplied criteria to the root query as a must clause root bool must ( current hop guiding query ( ) ) ; / / build a must clause that matches one of either / / a : ) include clauses supplied by the client or / / b : ) vertex terms from the previous hop bool query builder source terms or clause = query builders bool query ( ) ; add user defined includes to query ( current hop , source terms or clause ) ; add big or clause ( last hop findings , source terms or clause ) ; root bool must ( source terms or clause ) ; / / now build the agg tree that will channel the content - > / / base agg is terms agg for terms from last wave ( one per field ) , / / under each is a sig terms agg to find next candidates ( again , one per field ) for ( int field num = 0 ; field num < last hop get number vertex requests ( ) ; field num + + ) { vertex request last vr = last hop get vertex request ( field num ) ; set < vertex > last wave vertices for field = last hop findings get ( last vr field name ( ) ) ; if ( last wave vertices for field = = null ) { continue ; } string [ ] terms = new string [ last wave vertices for field size ( ) ] ; int i = 0 ; for ( vertex v : last wave vertices for field ) { terms [ i + + ] = v get term ( ) ; } terms aggregation builder last wave terms agg = aggregation builders terms ( " field " + field num ) include exclude ( new include exclude ( terms , null ) ) shard min doc count ( 1 ) field ( last vr field name ( ) ) min doc count ( 1 ) / / map execution mode used because sampler agg keeps us / / focused on smaller sets of high quality docs and therefore / / examine smaller volumes of terms execution hint ( " map " ) size ( terms length ) ; sample agg sub aggregation ( last wave terms agg ) ; for ( int f = 0 ; f < current hop get number vertex requests ( ) ; f + + ) { vertex request vr = current hop get vertex request ( f ) ; int size = vr size ( ) ; if ( vr field name ( ) equals ( last vr field name ( ) ) ) { / / we have the potential for self - loops as we are looking at the same field so add 1 to the requested size / / because we need to eliminate field a : term a - > field a : term a links that are likely to be in the results size + + ; } if ( request use significance ( ) ) { significant terms aggregation builder next wave sig terms = aggregation builders significant terms ( " field " + f ) field ( vr field name ( ) ) min doc count ( vr min doc count ( ) ) shard min doc count ( vr shard min doc count ( ) ) execution hint ( " map " ) size ( size ) ; / / next wave sig terms significance heuristic ( new percentage score percentage score builder ( ) ) ; / / had some issues with no significant terms being returned when asking for small / / number of final results ( eg 1 ) and only one shard setting shard size higher helped if ( size < 10 ) { next wave sig terms shard size ( 10 ) ; } / / alternative choices of significance algo didn ' t seem to be improvements / / next wave sig terms significance heuristic ( new gnd g n d builder ( true ) ) ; / / next wave sig terms significance heuristic ( new chi square chi square builder ( false , true ) ) ; if ( vr has include clauses ( ) ) { string [ ] includes = vr include values as string array ( ) ; next wave sig terms include exclude ( new include exclude ( includes , null ) ) ; / / originally i thought users would always want the / / same number of results as listed in the include / / clause but it may be the only want the most / / significant e g in the lastfm example of / / plotting a single user ' s tastes and how that maps / / into a network showing only the most interesting / / band connections so line below commmented out / / next wave sig terms size ( includes length ) ; } else if ( vr has exclude clauses ( ) ) { next wave sig terms include exclude ( new include exclude ( null , vr excludes as array ( ) ) ) ; } last wave terms agg sub aggregation ( next wave sig terms ) ; } else { terms aggregation builder next wave popular terms = aggregation builders terms ( " field " + f ) field ( vr field name ( ) ) min doc count ( vr min doc count ( ) ) shard min doc count ( vr shard min doc count ( ) ) / / map execution mode used because sampler agg keeps us / / focused on smaller sets of high quality docs and therefore / / examine smaller volumes of terms execution hint ( " map " ) size ( size ) ; if ( vr has include clauses ( ) ) { string [ ] includes = vr include values as string array ( ) ; next wave popular terms include exclude ( new include exclude ( includes , null ) ) ; / / next wave popular terms size ( includes length ) ; } else if ( vr has exclude clauses ( ) ) { next wave popular terms include exclude ( new include exclude ( null , vr excludes as array ( ) ) ) ; } last wave terms agg sub aggregation ( next wave popular terms ) ; } } } / / execute the search search source builder source = new search source builder ( ) query ( root bool ) aggregation ( sample agg ) size ( 0 ) ; if ( request timeout ( ) ! = null ) { source timeout ( time value time value millis ( time remaining millis ( ) ) ) ; } search request source ( source ) ; / / system out println ( source ) ; logger trace ( " executing expansion graph search request " ) ; client search ( search request , new action listener < search response > ( ) { @ override public void on response ( search response search response ) { / / system out println ( search response ) ; add shard failures ( search response get shard failures ( ) ) ; array list < connection > new connections = new array list < connection > ( ) ; array list < vertex > new vertices = new array list < vertex > ( ) ; sampler sample = search response get aggregations ( ) get ( " sample " ) ; / / we think of the total scores as the energy - level pouring / / out of all the last hop ' s connections / / each new node encountered is given a score which is / / normalized between zero and one based on / / what percentage of the total scores its own score / / provides double total signal output = get expand total signal strength ( last hop , current hop , sample ) ; / / signal output can be zero if we did not encounter any new / / terms as part of this stage if ( total signal output > 0 ) { add and score new vertices ( last hop , current hop , sample , total signal output , new connections , new vertices ) ; trim new additions ( current hop , new connections , new vertices ) ; } / / potentially run another round of queries to perform next " hop " - will terminate if no new additions expand ( ) ; } / / add new vertices and apportion share of total signal along / / connections private void add and score new vertices ( hop last hop , hop current hop , sampler sample , double total signal output , array list < connection > new connections , array list < vertex > new vertices ) { / / gather all matching terms into the graph and propagate / / signals for ( int j = 0 ; j < last hop get number vertex requests ( ) ; j + + ) { vertex request last vr = last hop get vertex request ( j ) ; terms last wave terms = sample get aggregations ( ) get ( " field " + j ) ; if ( last wave terms = = null ) { / / there were no terms from the previous phase that needed pursuing continue ; } list < ? extends terms bucket > buckets = last wave terms get buckets ( ) ; for ( org elasticsearch search aggregations bucket terms terms bucket last wave term : buckets ) { vertex from vertex = get vertex ( last vr field name ( ) , last wave term get key as string ( ) ) ; for ( int k = 0 ; k < current hop get number vertex requests ( ) ; k + + ) { vertex request vr = current hop get vertex request ( k ) ; / / as we travel further out into the graph we apply a / / decay to the signals being propagated down the various channels double decay = 0 9 5d ; if ( request use significance ( ) ) { significant terms significant terms = last wave term get aggregations ( ) get ( " field " + k ) ; if ( significant terms ! = null ) { for ( bucket bucket : significant terms get buckets ( ) ) { if ( ( vr field name ( ) equals ( from vertex get field ( ) ) ) & & ( bucket get key as string ( ) equals ( from vertex get term ( ) ) ) ) { / / avoid self - joins continue ; } double signal strength = bucket get significance score ( ) / total signal output ; / / decay the signal by the weight attached to the source vertex signal strength = signal strength * math min ( decay , from vertex get weight ( ) ) ; vertex to vertex = get vertex ( vr field name ( ) , bucket get key as string ( ) ) ; if ( to vertex = = null ) { to vertex = add vertex ( vr field name ( ) , bucket get key as string ( ) , signal strength , current hop number , bucket get superset df ( ) , bucket get subset df ( ) ) ; new vertices add ( to vertex ) ; } else { to vertex set weight ( to vertex get weight ( ) + signal strength ) ; / / we cannot ( without further querying ) determine an accurate number / / for the foreground count of the to vertex term - if we sum the values / / from each from vertex term we may actually double - count occurrences so / / the best we can do is take the maximum foreground value we have observed to vertex set fg ( math max ( to vertex get fg ( ) , bucket get subset df ( ) ) ) ; } new connections add ( add connection ( from vertex , to vertex , signal strength , bucket get doc count ( ) ) ) ; } } } else { terms terms = last wave term get aggregations ( ) get ( " field " + k ) ; if ( terms ! = null ) { for ( org elasticsearch search aggregations bucket terms terms bucket bucket : terms get buckets ( ) ) { double signal strength = bucket get doc count ( ) / total signal output ; / / decay the signal by the weight attached to the source vertex signal strength = signal strength * math min ( decay , from vertex get weight ( ) ) ; vertex to vertex = get vertex ( vr field name ( ) , bucket get key as string ( ) ) ; if ( to vertex = = null ) { to vertex = add vertex ( vr field name ( ) , bucket get key as string ( ) , signal strength , current hop number , 0 , 0 ) ; new vertices add ( to vertex ) ; } else { to vertex set weight ( to vertex get weight ( ) + signal strength ) ; } new connections add ( add connection ( from vertex , to vertex , signal strength , bucket get doc count ( ) ) ) ; } } } } } } } / / having let the signals from the last results rattle around the graph / / we have adjusted weights for the various vertices we encountered / / now we review these new additions and remove those with the / / weakest weights / / a priority queue is used to trim vertices according to the size settings / / requested for each field private void trim new additions ( hop current hop , array list < connection > new connections , array list < vertex > new vertices ) { set < vertex > evictions = new hash set < > ( ) ; for ( int k = 0 ; k < current hop get number vertex requests ( ) ; k + + ) { / / for each of the fields vertex request vr = current hop get vertex request ( k ) ; if ( new vertices size ( ) < = vr size ( ) ) { / / nothing to trim continue ; } / / get the top vertices for this field vertex priority queue pq = new vertex priority queue ( vr size ( ) ) ; for ( vertex vertex : new vertices ) { if ( vertex get field ( ) equals ( vr field name ( ) ) ) { vertex eviction = pq insert with overflow ( vertex ) ; if ( eviction ! = null ) { evictions add ( eviction ) ; } } } } / / remove weak new nodes and their dangling connections from the main graph if ( evictions size ( ) > 0 ) { for ( connection connection : new connections ) { if ( evictions contains ( connection get to ( ) ) ) { connections remove ( connection get id ( ) ) ; remove vertex ( connection get to ( ) ) ; } } } } / / todo right now we only trim down to the best n vertices we might also want to offer / / clients the option to limit to the best m connections one scenario where this is required / / is if the " from " and " to " nodes are a client - supplied set of includes e g a list of / / music artists then the client may be wanting to draw only the most - interesting connections / / between them see https : / / github com / elastic / x - plugins / issues / 518 # issuecomment - 160186424 / / i guess clients could trim the returned connections ( which all have weights ) but i wonder if / / we can do something server - side here / / helper method - compute the total signal of all scores in the search results private double get expand total signal strength ( hop last hop , hop current hop , sampler sample ) { double total signal output = 0 ; for ( int j = 0 ; j < last hop get number vertex requests ( ) ; j + + ) { vertex request last vr = last hop get vertex request ( j ) ; terms last wave terms = sample get aggregations ( ) get ( " field " + j ) ; if ( last wave terms = = null ) { continue ; } list < ? extends terms bucket > buckets = last wave terms get buckets ( ) ; for ( org elasticsearch search aggregations bucket terms terms bucket last wave term : buckets ) { for ( int k = 0 ; k < current hop get number vertex requests ( ) ; k + + ) { vertex request vr = current hop get vertex request ( k ) ; if ( request use significance ( ) ) { / / signal is based on significance score significant terms significant terms = last wave term get aggregations ( ) get ( " field " + k ) ; if ( significant terms ! = null ) { for ( bucket bucket : significant terms get buckets ( ) ) { if ( ( vr field name ( ) equals ( last vr field name ( ) ) ) & & ( bucket get key as string ( ) equals ( last wave term get key as string ( ) ) ) ) { / / don ' t count self joins ( term a obviously co - occurs with term a ) continue ; } else { total signal output + = bucket get significance score ( ) ; } } } } else { / / signal is based on popularity ( number of / / documents ) terms terms = last wave term get aggregations ( ) get ( " field " + k ) ; if ( terms ! = null ) { for ( org elasticsearch search aggregations bucket terms terms bucket bucket : terms get buckets ( ) ) { if ( ( vr field name ( ) equals ( last vr field name ( ) ) ) & & ( bucket get key as string ( ) equals ( last wave term get key as string ( ) ) ) ) { / / don ' t count self joins ( term a obviously co - occurs with term a ) continue ; } else { total signal output + = bucket get doc count ( ) ; } } } } } } } return total signal output ; } @ override public void on failure ( exception e ) { listener on failure ( e ) ; } } ) ; }


test restricting privileges to no permissions actually works

public void test restrict privileges ( ) { assume true ( " test requires security manager " , system get security manager ( ) ! = null ) ; try { system get property ( " user home " ) ; } catch ( security exception e ) { fail ( " this test needs to be fixed : user home not available by policy " ) ; } permission collection no permissions = new permissions ( ) ; access control context no permissions acc = new access control context ( new protection domain [ ] { new protection domain ( null , no permissions ) } ) ; try { access controller do privileged ( new privileged action < void > ( ) { public void run ( ) { system get property ( " user home " ) ; fail ( " access should have been denied " ) ; return null ; } } , no permissions acc ) ; } catch ( security exception expected ) { / / expected exception } }


get the partition number for a given key ( hence record ) given the total number of partitions i e number of reduce - tasks for the job typically a hash function on a all or a subset of the key

public abstract int get partition ( key key , value value , int num partitions ) ;


parse a { @ link distance } from a given string

private static distance parse distance ( string distance , distance unit default unit ) { for ( distance unit unit : values ( ) ) { for ( string name : unit names ) { if ( distance ends with ( name ) ) { return new distance ( double parse double ( distance substring ( 0 , distance length ( ) - name length ( ) ) ) , unit ) ; } } } return new distance ( double parse double ( distance ) , default unit ) ; }


get an existing buffer that uses a shadow buffer for byte values if they haven ' t been explicitly changed in this buffer this method should be used with care to avoid providing an improper id a database transaction must be in progress when invoking the various put , delete and set size methods on the returned buffer

public d b buffer get buffer ( int id , d b buffer shadow buffer ) throws i o exception { return new d b buffer ( this , new chained buffer ( buffer mgr , id , shadow buffer buf , 0 ) ) ; }


gets the a register number , as a nibble this will throw if the value is out of the range of an unsigned nibble

public final short get a nibble ( ) { int a = get a ( ) ; if ( ( a & ~ 0xf ) ! = 0 ) { throw new dex exception 2 ( " register a out of range : " + hex u 8 ( a ) ) ; } return ( short ) a ; }


returns whether the system publisher is enabled

public static boolean system metrics publisher enabled ( configuration conf ) { return conf get boolean ( yarn configuration system metrics publisher enabled , yarn configuration default system metrics publisher enabled ) ; }


set this matrix to the specified translation and rotation

public matrix 4 set ( vector 3 position , quaternion orientation ) { return set ( position x , position y , position z , orientation x , orientation y , orientation z , orientation w ) ; }


public list < g p u image filter > get filters ( ) { return filters ; }


sets the log file size limit ; if unset or 0 , log size is unlimited if unset , the value of " rotate limit bytes " from the jvm logging configuration for { @ link simple log handler } will be used ; and if that ' s unset , the log fie size is unlimited

public builder set rotate limit bytes ( int rotate limit bytes ) { this rotate limit bytes = integer value of ( rotate limit bytes ) ; return this ; }


like j unit ' s assert assert equals , but handles " regexp : " strings like html selenese

public static void assert equals ( string s 1 , string s 2 ) { selenese test base assert equals ( s 1 , s 2 ) ; }


removes the highlight for the given token

public void remove ( clang token t ) { highlights by token remove ( get key ( t ) ) ; }


checks if the given type is a composite type use { @ link # get field count ( logical type ) } , { @ link # get field names ( logical type ) } , { @ link # get field types ( logical type ) } for unified handling of composite types

public static boolean is composite type ( logical type logical type ) { if ( logical type instanceof distinct type ) { return is composite type ( ( ( distinct type ) logical type ) get source type ( ) ) ; } logical type root type root = logical type get type root ( ) ; return type root = = logical type root structured type | | type root = = logical type root row ; }


a set of configuration paremeters associated with the describe streams api may be used if : 1 ) an legacy client wants to consume from kinesis 2 ) a current client wants to consumer from dynamo d b streams in the context of 1 ) , the set of configurations needs to be translated to the corresponding configurations in the kinesis list shards api in the mean time , keep these configs since they are applicable in the context of 2 ) , i e , polling data from a dynamo d b stream

public static properties backfill consumer keys ( properties config props ) { hash map < string , string > old key to new keys = new hash map < > ( ) ; old key to new keys put ( consumer config constants stream describe backoff base , consumer config constants list shards backoff base ) ; old key to new keys put ( consumer config constants stream describe backoff max , consumer config constants list shards backoff max ) ; old key to new keys put ( consumer config constants stream describe backoff exponential constant , consumer config constants list shards backoff exponential constant ) ; for ( map entry < string , string > entry : old key to new keys entry set ( ) ) { string old key = entry get key ( ) ; string new key = entry get value ( ) ; if ( config props contains key ( old key ) ) { config props set property ( new key , config props get property ( old key ) ) ; / / do not remove the old key since they may be used in the context of talking to / / dynamo d b streams } } return config props ; }


{ @ inherit doc } the requested scope must not include any scope not originally granted by the resource owner , and if omitted is treated as equal to the scope originally granted by the resource owner

protected set < string > extract requested scopes by token ( final set < string > requested scopes , final o auth 2 0 token token , final http servlet request request ) { if ( ! requested scopes is empty ( ) & & ! requested scopes equals ( token get scopes ( ) ) ) { logger error ( " requested scopes [ { } ] exceed the granted scopes [ { } ] for token [ { } ] " , requested scopes , token get scopes ( ) , token get id ( ) ) ; throw new o auth 2 0 unauthorized scope request exception ( token get id ( ) ) ; } return new tree set < > ( token get scopes ( ) ) ; }


returns true if any of the nodes used a noop breaker

private boolean noop breaker used ( ) { nodes stats response stats = client ( ) admin ( ) cluster ( ) prepare nodes stats ( ) set breaker ( true ) get ( ) ; for ( node stats node stats : stats get nodes ( ) ) { if ( node stats get breaker ( ) get stats ( circuit breaker request ) get limit ( ) = = noop circuit breaker limit ) { return true ; } if ( node stats get breaker ( ) get stats ( circuit breaker in flight requests ) get limit ( ) = = noop circuit breaker limit ) { return true ; } if ( node stats get breaker ( ) get stats ( circuit breaker fielddata ) get limit ( ) = = noop circuit breaker limit ) { return true ; } } return false ; }


oldest entries are evicted to support newer ones

@ test public void writer eviction ( ) throws i o exception { list < header > header block = header entries ( " custom - foo " , " custom - header " , " custom - bar " , " custom - header " , " custom - baz " , " custom - header " ) ; bytes in write byte ( 0x 4 0 ) ; / / literal indexed bytes in write byte ( 0x 0a ) ; / / literal name ( len = 10 ) bytes in write utf 8 ( " custom - foo " ) ; bytes in write byte ( 0x 0d ) ; / / literal value ( len = 13 ) bytes in write utf 8 ( " custom - header " ) ; bytes in write byte ( 0x 4 0 ) ; / / literal indexed bytes in write byte ( 0x 0a ) ; / / literal name ( len = 10 ) bytes in write utf 8 ( " custom - bar " ) ; bytes in write byte ( 0x 0d ) ; / / literal value ( len = 13 ) bytes in write utf 8 ( " custom - header " ) ; bytes in write byte ( 0x 4 0 ) ; / / literal indexed bytes in write byte ( 0x 0a ) ; / / literal name ( len = 10 ) bytes in write utf 8 ( " custom - baz " ) ; bytes in write byte ( 0x 0d ) ; / / literal value ( len = 13 ) bytes in write utf 8 ( " custom - header " ) ; / / set to only support 110 bytes ( enough for 2 headers ) / / use a new writer because we don ' t support change the dynamic table / / size after writer constructed hpack writer writer = new hpack writer ( 110 , false , bytes out ) ; writer write headers ( header block ) ; assert that ( bytes out ) is equal to ( bytes in ) ; assert that ( writer header count ) is equal to ( 2 ) ; int table length = writer dynamic table length ; header entry = writer dynamic table [ table length - 1 ] ; check entry ( entry , " custom - bar " , " custom - header " , 55 ) ; entry = writer dynamic table [ table length - 2 ] ; check entry ( entry , " custom - baz " , " custom - header " , 55 ) ; }


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


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


helper method to set jackson ' s { @ link object mapper }

public api client set object mapper ( object mapper mapper ) { this default mapper = mapper ; return this ; }


configures a failure handling strategy in case a request to elasticsearch fails this strategy ignores failures and drops the request

public elasticsearch failure handler ignore ( ) { internal properties put string ( connector failure handler , elasticsearch validator connector failure handler value ignore ) ; return this ; }


sets the doc to use for updates when a script is not specified

public update request doc ( byte [ ] source , x content type x content type ) { safe doc ( ) source ( source , x content type ) ; return this ; }


get the value of the < code > name < code > property as a < code > double < code > if no such property exists , the provided default value is returned , or if the specified value is not a valid < code > double < code > , then an error is thrown

public double get double ( string name , double default value ) { string value string = get trimmed ( name ) ; if ( value string = = null ) return default value ; return double parse double ( value string ) ; }


public static string field name to method name ( string method prefix , string field name , boolean ignore first letter case ) { string method name = null ; if ( field name ! = null & & field name length ( ) > 0 ) { if ( ignore first letter case ) { method name = method prefix + field name ; } else { method name = method prefix + field name substring ( 0 , 1 ) to upper case ( ) + field name substring ( 1 ) ; } } else { method name = method prefix ; } return method name ; }


returns the least value present in { @ code array }

public static long min ( long array ) { check argument ( array length > 0 ) ; long min = array [ 0 ] ; for ( int i = 1 ; i < array length ; i + + ) { if ( array [ i ] < min ) { min = array [ i ] ; } } return min ; }


returns if the component is reserved note that some components are only reserved under certain directories , e g " reserved " is reserved , while " hadoop reserved " is not

public static boolean is reserved path component ( string component ) { for ( string reserved : hdfs server constants reserved path components ) { if ( component equals ( reserved ) ) { return true ; } } return false ; }


builder method ( http method http method ) ;


a multi - bucket agg needs to first reduce the buckets and their pipelines before allowing sibling pipelines to materialize

public final internal aggregation reduce pipelines ( internal aggregation reduced aggs , reduce context reduce context , pipeline tree pipeline tree ) { assert reduce context is final reduce ( ) ; internal aggregation reduced = this ; if ( pipeline tree has sub trees ( ) ) { list < b > materialized buckets = reduce pipeline buckets ( reduce context , pipeline tree ) ; reduced = create ( materialized buckets ) ; } return super reduce pipelines ( reduced , reduce context , pipeline tree ) ; }


public static list < activity > get activity list ( ) { return utils bridge get activity list ( ) ; }


private boolean initialize when gpu requested ( container container ) throws container execution exception { if ( ! requests gpu ( container ) ) { return false ; } / / do lazy initialization of gpu - docker plugin if ( additional commands = = null ) { init ( ) ; } return true ; }


public static string get rules ( ) { string rule string = null ; if ( rules ! = null ) { string builder sb = new string builder ( ) ; for ( rule rule : rules ) { sb append ( rule to string ( ) ) append ( " \ n " ) ; } rule string = sb to string ( ) trim ( ) ; } return rule string ; }


public void clear ( ) { linker clear ( ) ; assembly set text ( " " ) ; }


this test simulates disk balancer c l i report command run from a shell with a generic option ' fs '

public void test report with generic option f s ( ) throws exception { final string top report arg = " 5 " ; final string report args = string format ( " - % s file : % s - % s - % s % s " , " fs " , cluster json get path ( ) , report , " top " , top report arg ) ; final string cmd line = string format ( " % s " , report args ) ; final list < string > outputs = run command ( cmd line ) ; assert that ( outputs get ( 0 ) , contains string ( " processing report command " ) ) ; assert that ( outputs get ( 1 ) , is ( all of ( contains string ( " reporting top " ) , contains string ( top report arg ) , contains string ( " data node ( s ) benefiting from running disk balancer " ) ) ) ) ; }


generate expected colors as in checked page

private set < string > generate expected colors ( final int initial color , final int step color , final int n x , final int n y ) { set < string > colors = new tree set < > ( ) ; int cnt = 1 ; for ( int i = 1 ; i < n x ; i + + ) { for ( int j = 1 ; j < n y ; j + + ) { int color = initial color + ( cnt * step color ) ; string hex = string format ( " # % 0 2x % 0 2x % 0 2x " , ( ( color & 0x f f 0 0 0 0 ) > > 16 ) , ( ( color & 0x 0 0 f f 0 0 ) > > 8 ) , ( ( color & 0x 0 0 0 0 f f ) ) ) ; colors add ( hex ) ; cnt + + ; } } return colors ; }


public void test multi threaded edit log ( ) throws i o exception { test edit log ( 2048 ) ; / / force edit buffer to automatically sync on each log of edit log entry test edit log ( 1 ) ; }


return the blur bitmap fast zoom out , blur , zoom in

public static bitmap fast blur ( final bitmap src , @ float range ( from = 0 , to = 1 , from inclusive = false ) final float scale , @ float range ( from = 0 , to = 25 , from inclusive = false ) final float radius , final boolean recycle , final boolean is return scale ) { if ( is empty bitmap ( src ) ) return null ; int width = src get width ( ) ; int height = src get height ( ) ; matrix matrix = new matrix ( ) ; matrix set scale ( scale , scale ) ; bitmap scale bitmap = bitmap create bitmap ( src , 0 , 0 , src get width ( ) , src get height ( ) , matrix , true ) ; paint paint = new paint ( paint filter bitmap flag | paint anti alias flag ) ; canvas canvas = new canvas ( ) ; porter duff color filter filter = new porter duff color filter ( color transparent , porter duff mode src atop ) ; paint set color filter ( filter ) ; canvas scale ( scale , scale ) ; canvas draw bitmap ( scale bitmap , 0 , 0 , paint ) ; if ( build version sdk int > = build version codes jelly bean mr1 ) { scale bitmap = render script blur ( scale bitmap , radius , recycle ) ; } else { scale bitmap = stack blur ( scale bitmap , ( int ) radius , recycle ) ; } if ( scale = = 1 | | is return scale ) { if ( recycle & & ! src is recycled ( ) & & scale bitmap ! = src ) src recycle ( ) ; return scale bitmap ; } bitmap ret = bitmap create scaled bitmap ( scale bitmap , width , height , true ) ; if ( ! scale bitmap is recycled ( ) ) scale bitmap recycle ( ) ; if ( recycle & & ! src is recycled ( ) & & ret ! = src ) src recycle ( ) ; return ret ; }


make sure the polar regions are handled properly mercator projection does not show anything above 85 or below - 85 , so ensure they are clipped correctly

public void test singularity at poles ( ) { double min lat = - geo tile utils latitude mask ; double max lat = geo tile utils latitude mask ; double lon = random int between ( - 180 , 180 ) ; double lat = random boolean ( ) ? random double between ( - 90 , min lat , true ) : random double between ( max lat , 90 , true ) ; double clipped lat = math min ( math max ( lat , min lat ) , max lat ) ; int zoom = random int between ( 0 , max zoom ) ; string tile index = string encode ( long encode ( lon , lat , zoom ) ) ; string clipped tile index = string encode ( long encode ( lon , clipped lat , zoom ) ) ; assert equals ( tile index , clipped tile index ) ; }


executes the given { @ link listener invocation } on { @ link # listener } does nothing if { @ link # release } has been called on this instance

public void invoke ( listener invocation listener invocation ) { if ( ! released ) { listener invocation invoke listener ( listener ) ; } }


debugging information entries for dwarf v 2

public string section name info ( ) { return prefix + " debug info " ; }


involves a user with a process instance the type of identity link is defined by the given identity link type

void add user identity link ( string process instance id , string user id , string identity link type ) ;


tests the specifying job manager total process memory with config default value for job manager and task manager

public void test job manager memory property with config default value ( ) throws exception { int proc memory = 2048 ; final configuration configuration = create configuration with jm and tm total memory ( proc memory ) ; final flink yarn session cli flink yarn session cli = create flink yarn session cli ( configuration ) ; final command line command line = flink yarn session cli parse command line options ( new string [ 0 ] , false ) ; configuration add all ( flink yarn session cli to configuration ( command line ) ) ; final cluster client factory < application id > client factory = get cluster client factory ( configuration ) ; final cluster specification cluster specification = client factory get cluster specification ( configuration ) ; assert that ( cluster specification get master memory m b ( ) , is ( proc memory ) ) ; assert that ( cluster specification get task manager memory m b ( ) , is ( proc memory ) ) ; }


queues the key and value for serialization as a entries entry

public void queue for serialization ( data key key , data value value ) { entries put ( key , value ) ; }


index of the action in question in the node keyed by { @ link # get action lookup key } should be passed to { @ link com google devtools build lib actions action lookup value # get action }

int get action index ( ) { return action index ; }


convenience function to report non - attribute - specific errors in the current rule and then throw a { @ link rule error exception } , immediately exiting the current rule , and shutting down the invocation in a no - keep - going build if multiple errors are present , invoke { @ link # rule error } to collect additional error information before calling this method

default rule error exception throw with rule error ( string message ) throws rule error exception { rule error ( message ) ; throw new rule error exception ( message ) ; }


continues a project join transformation and adds fields of the second join input to the projection if the second join input is a { @ link tuple } { @ link data set } , fields can be selected by their index if the second join input is not a tuple data set , no parameters should be passed additional fields of the first and second input can be added by chaining the method calls of { @ link org apache flink api java operators join operator project join # project first ( int ) } and { @ link org apache flink api java operators join operator project join # project second ( int ) } < b > note : with the current implementation , the project transformation loses type information < b >

public < out extends tuple > project join < i1 , i2 , out > project second ( int second field indexes ) { join proj = join proj project second ( second field indexes ) ; return join proj project tuple x ( ) ; }


key set add will not add the element if it already exists in the set

public void test add 2 ( ) { set full = populated set ( 3 ) ; assert false ( full add ( one ) ) ; assert equals ( 3 , full size ( ) ) ; }


create a meta block and obtain an output stream for adding data into the block there can only be one block appender stream active at any time regular blocks may not be created after the first meta blocks the caller must call block appender close ( ) to conclude the block creation

public block appender prepare meta block ( string name , string compression name ) throws i o exception , meta block already exists { return prepare meta block ( name , compression get compression algorithm by name ( compression name ) ) ; }


a query that matches documents within an range of terms

public static range query builder range query ( string name ) { return new range query builder ( name ) ; }


public map < string , list < integer > > get map array integer ( ) { return map array integer ; }


public void add instance ( string namespace id , string service name , boolean ephemeral , instance ips ) throws nacos exception { string key = key builder build instance list key ( namespace id , service name , ephemeral ) ; service service = get service ( namespace id , service name ) ; synchronized ( service ) { list < instance > instance list = add ip addresses ( service , ephemeral , ips ) ; instances instances = new instances ( ) ; instances set instance list ( instance list ) ; consistency service put ( key , instances ) ; } }


creates an { @ link action config } from a { @ link starlark info }

static action config action config from starlark ( starlark info action config struct ) throws eval exception { check right provider type ( action config struct , " action config " ) ; string action name = get mandatory field from starlark provider ( action config struct , " action name " , string class ) ; if ( action name = = null | | action name is empty ( ) ) { throw info error ( action config struct , " the ' action name ' field of action config must be a nonempty string " ) ; } if ( ! action name matches ( " ^ [ a - z 0 - 9 + \ \ - \ \ ] * $ " ) ) { throw info error ( action config struct , " an action config ' s name must consist solely of lowercase ascii letters , digits , " + " ' ' , ' ' , ' + ' , and ' - ' , got ' % s ' " , action name ) ; } boolean enabled = get mandatory field from starlark provider ( action config struct , " enabled " , boolean class ) ; immutable list builder < cc toolchain features tool > tool builder = immutable list builder ( ) ; immutable list < starlark info > tool structs = get starlark provider list from starlark field ( action config struct , " tools " ) ; for ( starlark info tool struct : tool structs ) { tool builder add ( tool from starlark ( tool struct ) ) ; } immutable list builder < flag set > flag set builder = immutable list builder ( ) ; immutable list < starlark info > flag sets = get starlark provider list from starlark field ( action config struct , " flag sets " ) ; for ( starlark info flag set : flag sets ) { flag set builder add ( flag set from starlark ( flag set , action name ) ) ; } immutable list < string > implies = get string list from starlark provider field ( action config struct , " implies " ) ; return new action config ( action name , action name , tool builder build ( ) , flag set builder build ( ) , enabled , implies ) ; }


this class needs to listen for changes to the domain object ( tag create , delete , etc ) so it can update the display accordingly

public void domain object changed ( domain object changed event ev ) { if ( ! is visible ( ) ) { return ; } if ( ev contains event ( domain object do object restored ) | | ev contains event ( change manager docr function tag created ) | | ev contains event ( change manager docr function tag deleted ) | | ev contains event ( change manager docr tag removed from function ) | | ev contains event ( change manager docr tag added to function ) ) { updater update later ( ) ; return ; } if ( ev contains event ( change manager docr function tag changed ) ) { repaint ( ) ; } }


this method is invoked to finish current bundle and start a new one when the trigger was fired

void finish bundle ( ) throws exception ;


public void execute ( file system fs ) throws i o exception { fs rename snapshot ( path , old snapshot name , snapshot name ) ; return null ; }


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


tests saslplain authentication failure over ssl with old version of client that does not support sasl authenticate headers and new version of server

public void old sasl plain ssl client without sasl authenticate header failure ( ) throws exception { verify sasl authenticate header interop with failure ( true , false , security protocol sasl ssl , " plain " ) ; }


tests the convert method of the wrapped converter class , verifying the properties listed in the javadoc listed for { @ link # add equality group }

public converter tester test convert ( ) { tester test equals ( ) ; test items ( ) ; return this ; }


public execution config get execution config ( ) { if ( execution config = = null ) { throw new runtime exception ( " execution config has not been set properly for this plan " ) ; } return execution config ; }


assert that the upstream signaled the specified values in order and then failed with a specific class or subclass of { @ link throwable }

public final u assert failure ( @ non null class < ? extends throwable > error , @ non null t values ) { return assert subscribed ( ) assert values ( values ) assert error ( error ) assert not complete ( ) ; }


returns a formatter for a two digit hour of day ( hh )

public static date time formatter hour ( ) { return constants hde ; }


stops the timer , tasks will not be executed and time that passes will not be applied to the task delays

public void stop ( ) { synchronized ( thread lock ) { thread ( ) instances remove value ( this , true ) ; } }


private patch info create his t patch ( string target version , i logger logger ) throws i o exception , patch exception { patch info his patch info = his patch infos get ( target version ) ; string patch name = " patch - " + current build patch info get patch version ( ) + " @ " + his patch info get patch version ( ) ; file dest t path tmp folder = new file ( t patch tmp folder , patch name ) ; dest t path tmp folder mkdirs ( ) ; file info file = new file ( dest t path tmp folder , " patch info " ) ; file utils write string to file ( info file , patch name ) ; file cur t patch unzip folder = unzip cur t patch folder ( patch name ) ; / / list < bundle patch > bundle patches = diff patch ( his patch info , current build patch info ) ; patch info new patch info = process bundle patch ( his patch info , bundle patches , cur t patch unzip folder ) ; / / patch bundle info cur main bundle info = get main bundle info ( current build patch info ) ; patch bundle info main bundle info = new patch bundle info ( ) ; main bundle info set main bundle ( true ) ; main bundle info set new bundle ( false ) ; if ( null ! = cur main bundle info ) { file main bundle file = new file ( cur t patch unzip folder , cur main bundle info get name ( ) + " so " ) ; file utils copy file to directory ( main bundle file , dest t path tmp folder ) ; main bundle info set version ( cur main bundle info get version ( ) ) ; main bundle info set pkg name ( cur main bundle info get pkg name ( ) ) ; main bundle info set base version ( cur main bundle info get base version ( ) ) ; main bundle info set unit tag ( cur main bundle info get unit tag ( ) ) ; main bundle info set src unit tag ( cur main bundle info get src unit tag ( ) ) ; main bundle info set name ( cur main bundle info get name ( ) ) ; main bundle info set pkg name ( cur main bundle info get pkg name ( ) ) ; main bundle info set application name ( cur main bundle info get application name ( ) ) ; new patch info get bundles ( ) add ( main bundle info ) ; } / / for ( patch bundle info bundle info : new patch info get bundles ( ) ) { if ( bundle info get main bundle ( ) | | bundle info get new bundle ( ) | | no patch bundles contains ( bundle info get pkg name ( ) ) ) { file bundle folder = new file ( dest t path tmp folder , bundle info get name ( ) ) ; file so file = new file ( dest t path tmp folder , bundle info get name ( ) + " so " ) ; if ( so file exists ( ) | | bundle info get version ( ) equals ( rollback version ) ) { continue ; } command utils exec ( bundle folder , " zip - r " + so file get absolute path ( ) + " - x * / - x * " ) ; / / zip bunlde so ( bundle folder , so file ) ; file utils delete directory ( bundle folder ) ; } } file t patch file = new file ( patchs folder , new patch info get file name ( ) ) ; if ( t patch file exists ( ) ) { file utils delete quietly ( t patch file ) ; } command utils exec ( dest t path tmp folder , " zip - r " + t patch file get absolute path ( ) + " - x * / - x * " ) ; if ( null ! = logger ) { logger info ( " [ t patch file ] " + t patch file get absolute path ( ) ) ; } return new patch info ; }


converts a listener to a { @ link bi consumer } for compatibility with the { @ link java util concurrent completable future } api

static < response > bi consumer < response , exception > to bi consumer ( action listener < response > listener ) { return ( response , throwable ) - > { if ( throwable = = null ) { listener on response ( response ) ; } else { listener on failure ( throwable ) ; } } ; }


set the { @ link servlet config } that this object runs in invoked after population of normal bean properties but before an init callback like initializing bean ' s { @ code after properties set } or a custom init - method invoked after application context aware ' s { @ code set application context }

void set servlet config ( servlet config servlet config ) ;


schedules application of audio attributes

public builder set audio attributes ( audio attributes audio attributes , boolean handle audio focus ) { return apply ( new set audio attributes ( tag , audio attributes , handle audio focus ) ) ; }


tests that the { @ link allocated slot report } contains up to date information and not stale information about the allocated slots on the { @ link job master } this is a probabilistic test case which only fails if executed repeatedly without the fix for flink - 12863

public void test allocated slot report does not contain stale information ( ) throws exception { final completable future < void > assertion future = new completable future < > ( ) ; final unresolved task manager location unresolved task manager location = new local unresolved task manager location ( ) ; final atomic boolean terminate heartbeat verification = new atomic boolean ( false ) ; final one shot latch has received slot offers = new one shot latch ( ) ; final testing task executor gateway task executor gateway = new testing task executor gateway builder ( ) set heartbeat job manager consumer ( ( task manager id , allocated slot report ) - > { try { if ( has received slot offers is triggered ( ) ) { assert that ( allocated slot report get allocated slot infos ( ) , has size ( 1 ) ) ; } else { assert that ( allocated slot report get allocated slot infos ( ) , empty ( ) ) ; } } catch ( assertion error e ) { assertion future complete exceptionally ( e ) ; } if ( terminate heartbeat verification get ( ) ) { assertion future complete ( null ) ; } } ) create testing task executor gateway ( ) ; rpc service register gateway ( task executor gateway get address ( ) , task executor gateway ) ; final job manager shared services job manager shared services = new testing job manager shared services builder ( ) build ( ) ; final job master job master = new job master builder ( job graph test utils create single vertex job graph ( ) , rpc service ) with heartbeat services ( new heartbeat services ( 5l , 1000l ) ) with slot pool factory ( new testing slot pool factory ( has received slot offers ) ) create job master ( ) ; job master start ( ) ; try { final job master gateway job master gateway = job master get self gateway ( job master gateway class ) ; / / register task manager will trigger monitor heartbeat target , schedule heartbeat / / request at interval time completable future < registration response > registration response = job master gateway register task manager ( task executor gateway get address ( ) , unresolved task manager location , testing timeout ) ; / / wait for the completion of the registration registration response get ( ) ; final slot offer slot offer = new slot offer ( new allocation i d ( ) , 0 , resource profile any ) ; final completable future < collection < slot offer > > slot offer future = job master gateway offer slots ( unresolved task manager location get resource i d ( ) , collections singleton ( slot offer ) , testing timeout ) ; assert that ( slot offer future get ( ) , contains in any order ( slot offer ) ) ; terminate heartbeat verification set ( true ) ; / / make sure that no assertion has been violated assertion future get ( ) ; } finally { rpc utils terminate rpc endpoint ( job master , testing timeout ) ; job manager shared services shutdown ( ) ; } }


restore the information saved in the ticket and return the service

protected service restore delegated authentication request ( final request context request context , final web context web context , final transient session ticket ticket ) { val service = ticket get service ( ) ; logger trace ( " restoring requested service [ { } ] back in the authentication flow " , service ) ; web utils put service into flow scope ( request context , service ) ; web context set request attribute ( cas protocol constants parameter service , service ) ; val theme param name = cas properties get theme ( ) get param name ( ) ; val local param name = cas properties get locale ( ) get param name ( ) ; val properties = ticket get properties ( ) ; web context set request attribute ( theme param name , properties get ( theme param name ) ) ; web context set request attribute ( local param name , properties get ( local param name ) ) ; web context set request attribute ( cas protocol constants parameter method , properties get ( cas protocol constants parameter method ) ) ; return service ; }


returns a { @ link set } of all the results


public static boolean tx timeout check lock ( ) { return get root session manager ( ) scheduled lock ( tx timeout check ) ; }


returns whether this version is considered stable

public boolean is stable version ( ) { return is stable ; }


all of the named writeables needed to deserialize the instances of { @ linkplain hit extractor }

public static list < named writeable registry entry > get named writeables ( ) { list < named writeable registry entry > entries = new array list < > ( hit extractors get named writeables ( ) ) ; entries add ( new entry ( hit extractor class , field hit extractor name , field hit extractor : : new ) ) ; entries add ( new entry ( hit extractor class , score extractor name , in - > score extractor instance ) ) ; return entries ; }


public int get listing count ( ) { return listing count ; }


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

public java util list < com alibaba nacos istio model server > get servers list ( ) { return servers ; }


test serialization and deserialization of job

public void test job serialize and deserialize ( ) throws exception { balance job builder builder = new balance job builder < record procedure > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { record procedure r = new record procedure ( " record - " + i , 1000l ) ; builder next procedure ( r ) ; } builder next procedure ( new retry procedure ( " retry " , 1000 , 3 ) ) ; balance job < record procedure > job = builder build ( ) ; job set id ( balance procedure scheduler allocate job id ( ) ) ; / / serialize byte array output stream bao = new byte array output stream ( ) ; job write ( new data output stream ( bao ) ) ; bao flush ( ) ; byte array input stream bai = new byte array input stream ( bao to byte array ( ) ) ; / / deserialize balance job new job = new balance job builder < > ( ) build ( ) ; new job read fields ( new data input stream ( bai ) ) ; assert equals ( job , new job ) ; }


do the action for updating multiple rows it will check the validity of conditions , then update rows in database if the format of conditions is invalid , throw lite pal support exception

private int do update all action ( string table name , content values values , string conditions ) { base utility check conditions correct ( conditions ) ; if ( values size ( ) > 0 ) { return m database update ( table name , values , get where clause ( conditions ) , get where args ( conditions ) ) ; } return 0 ; }


atomic operation to collect a record and update state to the sequence number of the record this method is called from the record emitter responsible for tracking per shard watermarks and emit timestamps extracted from the record , when a watermark assigner was configured

private void emit record and update state ( record wrapper < t > rw ) { synchronized ( checkpoint lock ) { if ( rw get value ( ) ! = null ) { source context collect with timestamp ( rw get value ( ) , rw timestamp ) ; shard watermark state < t > sws = shard watermarks get ( rw shard state index ) ; sws last emitted record watermark = rw watermark ; } else { log warn ( " skipping non - deserializable record at sequence number { } of shard { } " , rw last sequence number , subscribed shards state get ( rw shard state index ) get stream shard handle ( ) ) ; } update state ( rw shard state index , rw last sequence number ) ; } }


get the minimum storage size in bytes for a given size in bits this does not consider the bit offset which may increase the required storage

public static int get minimum storage size ( int bit size ) { return get minimum storage size ( bit size , 0 ) ; }


public void execute ( ) throws api exception { this execute with http info ( ) get data ( ) ; }


configures ssltls for https jetty client

public static ssl context factory create client side ssl context factory ( worker config config ) { map < string , object > ssl config values = config values with prefix all or nothing ( " listeners https " ) ; final ssl context factory client ssl = new ssl context factory client ( ) ; configure ssl context factory key store ( ssl , ssl config values ) ; configure ssl context factory trust store ( ssl , ssl config values ) ; configure ssl context factory algorithms ( ssl , ssl config values ) ; configure ssl context factory endpoint identification ( ssl , ssl config values ) ; return ssl ; }


public void processed ( ) { processed = true ; }


read and return the next value in the file

public synchronized writable next ( writable value ) throws i o exception { return next ( key , value ) ? value : null ; }


get the aggregate of all the allocations count

public long get aggregate allocation count ( ) { return get aggregate operation count ( operation allocation ) ; }


aligns the current index on the specified alignment value for example , if current index was 123 and align value was 16 , then current index would become 128

public int align ( int align value ) { long align = current index % align value ; if ( align = = 0 ) { return 0 ; } current index = current index + ( align value - align ) ; return ( int ) ( align value - align ) ; }


get an iterator over the long address keys which contain a property value

public address key iterator get address key iterator ( address start , address end , boolean at start ) throws i o exception { if ( property table = = null ) { return new address key iterator ( ) ; } if ( at start ) { return new address key iterator ( property table , addr map , start , end , start , true ) ; } return new address key iterator ( property table , addr map , start , end , end , false ) ; }


required : the protocol exposed on the port must be one of http | https | grpc | http2 | mongo | tcp | tls tls implies the connection will be routed based on the sni header to the destination without terminating the tls connection < code > string protocol = 2 ; < code >

public java lang string get protocol ( ) { java lang object ref = protocol ; if ( ! ( ref instanceof java lang string ) ) { com google protobuf byte string bs = ( com google protobuf byte string ) ref ; java lang string s = bs to string utf 8 ( ) ; protocol = s ; return s ; } else { return ( java lang string ) ref ; } }


return true if this varnode is stored in the symbolic stack space

public boolean is stack symbolic space ( varnode varnode ) { / / symbolic spaces are off of a register , find the space address space reg space = addr factory get address space ( varnode get space ( ) ) ; return valid symbolic stack names contains ( reg space get name ( ) ) ; }


invoked when the response is getting committed allowing sub - classes to make apply header values to the underlying response note that most sub - classes use an { @ link http headers } instance that wraps an adapter to the native response headers such that changes are propagated to the underlying response on the go that means this callback is typically not used other than for specialized updates such as setting the content type or character encoding fields in a servlet response

protected abstract void apply headers ( ) ;


public void set entry points ( boolean b ) { entry points = b ; }


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


modifies the data type of an accumulator regarding data views for performance reasons , each data view is wrapped into a raw type which gives it { @ link lazy binary format } semantics and avoids multiple deserialization steps during access furthermore , a data view will not be serialized if a state backend is used ( the serializer of the raw type will be a { @ link null serializer } in this case )

public static data type adjust data views ( data type accumulator data type , boolean has state backed data views ) { final function < data type , type serializer < ? > > serializer ; if ( has state backed data views ) { serializer = data type - > null serializer instance ; } else { serializer = external serializer : : of ; } return data type utils transform ( accumulator data type , new data views transformation ( serializer ) ) ; }


public string to string ( ) { return to human ( ) ; }


checks the address to make sure the listing won ' t navigate outside the addresses it currently has loaded if it is not a valid address it will set a status message on the dual listing

private boolean validate address ( address addr ) { if ( addr = = null ) { return false ; } address set view addresses = is left side ? dual listing get left addresses ( ) : dual listing get right addresses ( ) ; if ( ! addresses contains ( addr ) ) { dual listing set status info ( " \ " " + addr to string ( ) + " \ " is outside the current listing ' s view " ) ; return false ; } return true ; }


returns the ratio of foreground playbacks which reached the ended state at least once , or { @ code 0 0 } if no playback has been in foreground

public float get ended ratio ( ) { return foreground playback count = = 0 ? 0f : ( float ) ended count / foreground playback count ; }


any int or non - null < code > integer < code > since mockito 2 1 0 , only allow valued < code > integer < code > , thus < code > null < code > is not anymore a valid value as primitive wrappers are nullable , the suggested api to match < code > null < code > wrapper would be { @ link # is null ( ) } we felt this change would make tests harness much safer that it was with mockito 1 x see examples in javadoc for { @ link argument matchers } class

public static int any int ( ) { report matcher ( new instance of ( integer class , " < any integer > " ) ) ; return 0 ; }


protected icon get tool bar icon ( ) { return create new comparison icon ; }


public void int 3 2 test ( ) { / / todo : test int 3 2 }


{ @ link org greenrobot greendao async async operation } flags set for all operations ( will be o red with call flags )

public int get session flags ( ) { return session flags ; }


return the parent document , or null if this is the root document

public document get parent ( ) { return parent ; }


factory method for a commons disk file item factory instance default implementation returns a standard disk file item factory can be overridden to use a custom subclass , e g for testing purposes

protected disk file item factory new file item factory ( ) { return new disk file item factory ( ) ; }


private int write default file region ( channel outbound buffer in , default file region region ) throws exception { final long region count = region count ( ) ; final long offset = region transferred ( ) ; if ( offset > = region count ) { in remove ( ) ; return 0 ; } final long flushed amount = socket send file ( region , region position ( ) , offset , region count - offset ) ; if ( flushed amount > 0 ) { in progress ( flushed amount ) ; if ( region transferred ( ) > = region count ) { in remove ( ) ; } return 1 ; } else if ( flushed amount = = 0 ) { validate file region ( region , offset ) ; } return write status sndbuf full ; }


return the additional ( undeclared ) property

public map < string , list > get additional properties ( ) { return additional properties ; }


returns the target model class that should be used to deserialize the input data this function can be invoked for any ofone of composed models with discriminator mappings the discriminator mappings are used to determine the target model class

class < ? > get class for element ( json node node , set < class < ? > > visited classes ) { if ( visited classes contains ( model class ) ) { / / class has already been visited return null ; } / / determine the value of the discriminator property in the input data string discr value = get discriminator value ( node ) ; if ( discr value = = null ) { return null ; } class < ? > cls = discriminator mappings get ( discr value ) ; / / it may not be sufficient to return this cls directly because that target class / / may itself be a composed schema , possibly with its own discriminator visited classes add ( model class ) ; for ( class < ? > child class : discriminator mappings values ( ) ) { class discriminator mapping child cdm = model discriminators get ( child class ) ; if ( child cdm = = null ) { continue ; } if ( ! discriminator name equals ( child cdm discriminator name ) ) { discr value = get discriminator value ( node ) ; if ( discr value = = null ) { continue ; } } if ( child cdm ! = null ) { / / recursively traverse the discriminator mappings class < ? > child discr = child cdm get class for element ( node , visited classes ) ; if ( child discr ! = null ) { return child discr ; } } } return cls ; }


public int get major version ( ) { return 0 ; }


returns the executor on which this resolver should execute long - running or io bound work null if no executor was set

public executor get offload executor ( ) { return executor ; }


returns a { @ link transition factory } that wraps a static split transition

public static < t > transition factory < t > split ( split transition split transition ) { return new auto value transition factories split transition factory < t > ( split transition ) ; }


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


sets the default strategies to use if none are supplied by the user replaces any previously set default strategies

public test executor builder set default strategies ( string strategies ) { strategy registry builder set default strategies ( immutable list copy of ( strategies ) ) ; return this ; }


public void shutdown ( final boolean interrupt ) { super shutdown ( interrupt ) ; try { this server socket channel close ( ) ; this selector close ( ) ; } catch ( i o exception e ) { log error ( " accept socket service shutdown exception " , e ) ; } }


public valuein get current value ( ) throws i o exception , interrupted exception { return this value ; }


public < t extends transitive info provider > rule configured target builder add providers ( transitive info provider map providers ) { providers builder add all ( providers ) ; return this ; }


overides equals method by comparing keys

public boolean equals ( object obj ) { if ( obj instanceof edge ) { return key = = ( ( edge ) obj ) key ( ) ; } return false ; }


regression test for issue # 1295 $ e v yields incorrect value 0 in " e returns [ int v ] : ' 1 ' { $ v = 1 ; } | ' ( ' e ' ) ' { $ v = $ e v ; } ; " https : github comantlrantlr 4issues 1 2 9 5

@ test public void test rule refs recursive ( ) throws exception { string recursive template = " recursive template ( inline ) : : = < < \ n " + " parser grammar a ; \ n " + " e returns [ int v ] \ n " + " : int { $ v = $ int int ; } \ n " + " | ' ( ' e ' ) ' { \ n " + " # inline # < inline > # end - inline # \ n " + " } \ n " + " ; \ n " + " > > " ; string left recursive template = " recursive template ( inline ) : : = < < \ n " + " parser grammar a ; \ n " + " e returns [ int v ] \ n " + " : a = e op = ( ' * ' | ' / ' ) b = e { $ v = eval ( $ a v , $ op type , $ b v ) ; } \ n " + " | int { $ v = $ int int ; } \ n " + " | ' ( ' e ' ) ' { \ n " + " # inline # < inline > # end - inline # \ n " + " } \ n " + " ; \ n " + " > > " ; / / ref to value returned from recursive call to rule string action = " $ v = $ e v ; " ; string expected = " ( ( e context ) localctx ) v = ( ( e context ) localctx ) e v ; " ; test actions ( recursive template , " inline " , action , expected ) ; test actions ( left recursive template , " inline " , action , expected ) ; / / ref to predefined attribute obtained from recursive call to rule action = " $ v = $ e text length ( ) ; " ; expected = " ( ( e context ) localctx ) v = ( ( ( e context ) localctx ) e ! = null ? input get text ( ( ( e context ) localctx ) e start , ( ( e context ) localctx ) e stop ) : null ) length ( ) ; " ; test actions ( recursive template , " inline " , action , expected ) ; test actions ( left recursive template , " inline " , action , expected ) ; }


create the sse - c structure for the aws sdk , if the encryption secrets contain the informationsettings for this this will contain a secret extracted from the bucketconfiguration

private optional < s s e customer key > generate s s e customer key ( ) { return encryption secret operations create s s e customer key ( encryption secrets ) ; }


remove { @ code listener } from the list of parse listeners if { @ code listener } is { @ code null } or has not been added as a parse listener , this method does nothing

public void remove parse listener ( parse tree listener listener ) { if ( parse listeners ! = null ) { if ( parse listeners remove ( listener ) ) { if ( parse listeners is empty ( ) ) { parse listeners = null ; } } } }


specify an exception handler to be used for event handlers and worker pools created by this disruptor the exception handler will be used by existing and future event handlers and worker pools created by this disruptor instance

public void set default exception handler ( final exception handler < ? super t > exception handler ) { check not started ( ) ; if ( ! ( this exception handler instanceof exception handler wrapper ) ) { throw new illegal state exception ( " set default exception handler can not be used after handle exceptions with " ) ; } ( ( exception handler wrapper < t > ) this exception handler ) switch to ( exception handler ) ; }


sets the title for the left side ' s listing

public void set left title ( string left title ) { this left title = left title ; set title ( title panels [ left ] , left title prefix , left title ) ; }


generates x content without the startend object

public void to x content fragment ( x content builder builder ) throws i o exception { builder field ( user fields username get preferred name ( ) , user principal ( ) ) ; builder array ( user fields roles get preferred name ( ) , user roles ( ) ) ; builder field ( user fields full name get preferred name ( ) , user full name ( ) ) ; builder field ( user fields email get preferred name ( ) , user email ( ) ) ; builder field ( user fields metadata get preferred name ( ) , user metadata ( ) ) ; builder field ( user fields enabled get preferred name ( ) , user enabled ( ) ) ; builder start object ( user fields authentication realm get preferred name ( ) ) ; builder field ( user fields realm name get preferred name ( ) , get authenticated by ( ) get name ( ) ) ; builder field ( user fields realm type get preferred name ( ) , get authenticated by ( ) get type ( ) ) ; builder end object ( ) ; builder start object ( user fields lookup realm get preferred name ( ) ) ; if ( get looked up by ( ) ! = null ) { builder field ( user fields realm name get preferred name ( ) , get looked up by ( ) get name ( ) ) ; builder field ( user fields realm type get preferred name ( ) , get looked up by ( ) get type ( ) ) ; } else { builder field ( user fields realm name get preferred name ( ) , get authenticated by ( ) get name ( ) ) ; builder field ( user fields realm type get preferred name ( ) , get authenticated by ( ) get type ( ) ) ; } builder end object ( ) ; builder field ( user fields authentication type get preferred name ( ) , get authentication type ( ) name ( ) to lower case ( locale root ) ) ; }


resolves the given parameter type and value name into an argument value

protected abstract object resolve argument internal ( method parameter parameter , message < ? > message , string name ) throws exception ;


creates a binary log that writes to a temp file < b > warning : < b > this implementation is not performance optimized , and r p cs will experience back pressure if disk io does not keep up

public static binary log create binary log ( ) throws i o exception { return new binary log provider impl ( ) ; }


public void remove ( merged context configuration key , @ nullable hierarchy mode hierarchy mode ) { assert not null ( key , " key must not be null " ) ; / / start key is the level at which to begin clearing the cache , / / depending on the configured hierarchy mode s merged context configuration start key = key ; if ( hierarchy mode = = hierarchy mode exhaustive ) { merged context configuration parent = start key get parent ( ) ; while ( parent ! = null ) { start key = parent ; parent = start key get parent ( ) ; } } list < merged context configuration > removed contexts = new array list < > ( ) ; remove ( removed contexts , start key ) ; / / remove all remaining references to any removed contexts from the / / hierarchy map for ( merged context configuration current key : removed contexts ) { for ( set < merged context configuration > children : this hierarchy map values ( ) ) { children remove ( current key ) ; } } / / remove empty entries from the hierarchy map for ( map entry < merged context configuration , set < merged context configuration > > entry : this hierarchy map entry set ( ) ) { if ( entry get value ( ) is empty ( ) ) { this hierarchy map remove ( entry get key ( ) ) ; } } }


create the builder ready for any final configuration options picks up connection settings from the hadoop configuration , including proxy secrets

public static a w s security token service client builder builder ( final configuration conf , final string bucket , final a w s credentials provider credentials , final string sts endpoint , final string sts region ) throws i o exception { final client configuration aws conf = s 3 a utils create aws conf ( conf , bucket , constants aws service identifier sts ) ; return builder ( credentials , aws conf , sts endpoint , sts region ) ; }


return { @ code true } if the cookie has the " http only " attribute

public boolean is http only ( ) { return this http only ; }


public void run from config ( server config config ) throws i o exception , admin server exception { log info ( " starting server " ) ; file txn snap log txn log = null ; try { try { metrics provider = metrics provider bootstrap start metrics provider ( config get metrics provider class name ( ) , config get metrics provider configuration ( ) ) ; } catch ( metrics provider life cycle exception error ) { throw new i o exception ( " cannot boot metrics provider " + config get metrics provider class name ( ) , error ) ; } server metrics metrics provider initialized ( metrics provider ) ; provider registry initialize ( ) ; / / note that this thread isn ' t going to be doing anything else , / / so rather than spawning another thread , we will just call / / run ( ) in this thread / / create a file logger url from the command line args txn log = new file txn snap log ( config data log dir , config data dir ) ; jvm pause monitor jvm pause monitor = null ; if ( config jvm pause monitor to run ) { jvm pause monitor = new jvm pause monitor ( config ) ; } final zoo keeper server zk server = new zoo keeper server ( jvm pause monitor , txn log , config tick time , config min session timeout , config max session timeout , config listen backlog , null , config initial config ) ; txn log set server stats ( zk server server stats ( ) ) ; / / registers shutdown handler which will be used to know the / / server error or shutdown state changes final count down latch shutdown latch = new count down latch ( 1 ) ; zk server register server shutdown handler ( new zoo keeper server shutdown handler ( shutdown latch ) ) ; / / start admin server admin server = admin server factory create admin server ( ) ; admin server set zoo keeper server ( zk server ) ; admin server start ( ) ; boolean need start z k server = true ; if ( config get client port address ( ) ! = null ) { cnxn factory = server cnxn factory create factory ( ) ; cnxn factory configure ( config get client port address ( ) , config get max client cnxns ( ) , config get client port listen backlog ( ) , false ) ; cnxn factory startup ( zk server ) ; / / zk server has been started so we don ' t need to start it again in secure cnxn factory need start z k server = false ; } if ( config get secure client port address ( ) ! = null ) { secure cnxn factory = server cnxn factory create factory ( ) ; secure cnxn factory configure ( config get secure client port address ( ) , config get max client cnxns ( ) , config get client port listen backlog ( ) , true ) ; secure cnxn factory startup ( zk server , need start z k server ) ; } container manager = new container manager ( zk server get z k database ( ) , zk server first processor , integer get integer ( " znode container check interval ms " , ( int ) time unit minutes to millis ( 1 ) ) , integer get integer ( " znode container max per minute " , 10000 ) , long get long ( " znode container max never used interval ms " , 0 ) ) ; container manager start ( ) ; z k audit provider add z k start stop audit log ( ) ; / / watch status of zoo keeper server it will do a graceful shutdown / / if the server is not running or hits an internal error shutdown latch await ( ) ; shutdown ( ) ; if ( cnxn factory ! = null ) { cnxn factory join ( ) ; } if ( secure cnxn factory ! = null ) { secure cnxn factory join ( ) ; } if ( zk server can shutdown ( ) ) { zk server shutdown ( true ) ; } } catch ( interrupted exception e ) { / / warn , but generally this is ok log warn ( " server interrupted " , e ) ; } finally { if ( txn log ! = null ) { txn log close ( ) ; } if ( metrics provider ! = null ) { try { metrics provider stop ( ) ; } catch ( throwable error ) { log warn ( " error while stopping metrics " , error ) ; } } } }


public string get task id ( ) { return task i d downgrade ( super get task i d ( ) ) to string ( ) ; }


read an xml document from the given string

public document read document from string ( string document content ) { input source is = new input source ( new string reader ( document content ) ) ; try { return this reader do load document ( is , get resource ( ) ) ; } catch ( exception ex ) { throw new bean definition store exception ( " failed to read xml document " , ex ) ; } }


confirm that the requested number of errors are produced by { @ link embedded connect cluster # validate connector config }

protected optional < boolean > check validation errors ( string connector class , map < string , string > conn config , int num errors , bi function < integer , integer , boolean > comp ) { try { int num errors produced = connect validate connector config ( connector class , conn config ) error count ( ) ; return optional of ( comp apply ( num errors produced , num errors ) ) ; } catch ( exception e ) { log error ( " could not check config validation error count " , e ) ; return optional empty ( ) ; } }


see { @ link args # get scheduled executor service }

public builder set scheduled executor service ( scheduled executor service scheduled executor service ) { this scheduled executor service = check not null ( scheduled executor service ) ; return this ; }


gets the register that begins the method ' s parameter range ( including the ' this ' parameter for non - static methods ) the range continues until { @ code reg size }

private int get param base ( ) { return reg size - desc get parameter types ( ) get word count ( ) - ( is static ? 0 : 1 ) ; }


returns a fixed - size list backed by the specified array , similar to { @ link arrays # as list ( object [ ] ) } the list supports { @ link list # set ( int , object ) } , but any attempt to set a value to { @ code null } will result in a { @ link null pointer exception } the returned list maintains the values , but not the identities , of { @ code byte } objects written to or read from it for example , whether { @ code list get ( 0 ) = = list get ( 0 ) } is true for the returned list is unspecified

public static list < byte > as list ( byte backing array ) { if ( backing array length = = 0 ) { return collections empty list ( ) ; } return new byte array as list ( backing array ) ; }


prepare filter before execution and provide optional

protected optional < object > prepare filter before execution ( final http servlet response http servlet response , final http servlet request http servlet request ) { return optional empty ( ) ; }


sets the settings and mappings as a single source

public create index request source ( x content builder source ) { return source ( bytes reference bytes ( source ) , source content type ( ) ) ; }


return the { @ link http message writer http message writers } to be used for response body conversion

list < http message writer < ? > > message writers ( ) ;


return the name of the affected property , if available

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


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


returns a comma separated list of the enabled { @ link agent protocol # get name ( ) } implementations so that clients can avoid creating additional work for the server attempting to connect with unsupported protocols

public string get agent protocol names ( ) { return string utils join ( jenkins get ( ) get agent protocols ( ) , " , " ) ; }


sets the doc to use for updates when a script is not specified , the doc provided is a field and value pairs

public update request builder set doc ( object source ) { request doc ( source ) ; return this ; }


enables unaligned checkpoints , which greatly reduce checkpointing times under backpressure unaligned checkpoints contain data stored in buffers as part of the checkpoint state , which allows checkpoint barriers to overtake these buffers thus , the checkpoint duration becomes independent of the current throughput as checkpoint barriers are effectively not embedded into the stream of data anymore unaligned checkpoints can only be enabled if { @ link # checkpointing mode } is { @ link checkpointing mode # exactly once }

public void enable unaligned checkpoints ( ) { enable unaligned checkpoints ( true ) ; }


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


this interface handles one task at a time

public void handle task ( task task ) throws interrupted exception { var time = task get time ( ) ; thread sleep ( time ) ; logger info ( " it takes " + time + " milliseconds to finish the task " ) ; task set finished ( ) ; }


read the next character from the serialized { @ code string value }

private static char read string char ( data input view source ) throws i o exception { int c = source read byte ( ) & 0x f f ; if ( c > = high bit ) { int shift = 7 ; int curr ; c = c & 0x 7 f ; while ( ( curr = source read byte ( ) & 0x f f ) > = high bit ) { c | = ( curr & 0x 7 f ) < < shift ; shift + = 7 ; } c | = curr < < shift ; } return ( char ) c ; }


set the alpha value ( transparency ) that is used for drawing the highlight indicator bar min = 0 ( fully transparent ) , max = 255 ( fully opaque )

public void set high light alpha ( int alpha ) { m high light alpha = alpha ; }


find purchase order by id for valid response try integer i ds with value & lt ; & # x 3 d ; 5 or & gt ; 10 other values will generated exceptions

public order get order by id ( long order id ) throws api exception { api response < order > local var resp = get order by id with http info ( order id ) ; return local var resp get data ( ) ; }


public index lifecycle client index lifecycle ( ) { return ilm client ; }


get the starting position of the block in the file

public long get start pos ( ) { return r blk state get block region ( ) get offset ( ) ; }


returns a configured s s l server socket factory

public s s l server socket factory create s s l server socket factory ( ) throws general security exception , i o exception { if ( mode ! = mode server ) { throw new illegal state exception ( " factory is not in server mode actual mode is " + mode to string ( ) ) ; } return context get server socket factory ( ) ; }


log a message at level info according to the specified format and argument this form avoids superfluous object creation when the logger is disabled for the info level

public void info ( string format , object arg ) { if ( logger is info enabled ( ) ) { formatting tuple ft = message formatter format ( format , arg ) ; logger log ( fqcn , level info , ft get message ( ) , ft get throwable ( ) ) ; } }


a meaningless value used to test that plugin suggesters can add fields to their options

public string get dummy ( ) { return dummy ; }


sets the transformation that is to be applied to the image

public animated image result builder set bitmap transformation ( @ nullable bitmap transformation bitmap transformation ) { m bitmap transformation = bitmap transformation ; return this ; }


get the setting for { @ link # force unigrams ( ) }

public boolean force unigrams ( ) { return this force unigrams ; }


public long get modified time ( ) { return modified time ; }


public static void put ticket granting ticket ( final request context context , final ticket granting ticket ticket ) { context get flow scope ( ) put ( " ticket granting ticket " , ticket ) ; }


public void test arguments ( ) throws i o exception { string [ ] args = new string [ ] { " - input " , " a " , " - whitelist " , " b " , " - blacklist " , " c " , " - fs " , " hdfs : / / c : 8020 " , " - target " , " d " , " - initial replication " , " 100 " , " - acceptable replication " , " 120 " , " - final replication " , " 140 " , " - timeout " , " 10 " } ; framework uploader uploader = new framework uploader ( ) ; boolean success = uploader parse arguments ( args ) ; assert assert true ( " expected to print help " , success ) ; assert assert equals ( " input mismatch " , " a " , uploader input ) ; assert assert equals ( " whitelist mismatch " , " b " , uploader whitelist ) ; assert assert equals ( " blacklist mismatch " , " c " , uploader blacklist ) ; assert assert equals ( " target mismatch " , " hdfs : / / c : 8020 / d " , uploader target ) ; assert assert equals ( " initial replication mismatch " , 100 , uploader initial replication ) ; assert assert equals ( " acceptable replication mismatch " , 120 , uploader acceptable replication ) ; assert assert equals ( " final replication mismatch " , 140 , uploader final replication ) ; assert assert equals ( " timeout mismatch " , 10 , uploader timeout ) ; }


this test validates the correctness of the metric : submitted apps successfully

public void test succeeded apps submitted ( ) { long total good before = metrics get num succeeded apps submitted ( ) ; good sub cluster submit application ( 100 ) ; assert assert equals ( total good before + 1 , metrics get num succeeded apps submitted ( ) ) ; assert assert equals ( 100 , metrics get latency succeeded apps submitted ( ) , 0 ) ; good sub cluster submit application ( 200 ) ; assert assert equals ( total good before + 2 , metrics get num succeeded apps submitted ( ) ) ; assert assert equals ( 150 , metrics get latency succeeded apps submitted ( ) , 0 ) ; }


public id to digest id ( string digest ) { return new id ( scheme digest , digest ) ; }


discuss waiting strategy between calls sleeping seems to be very inaccurate ( see below ) on the other hand calling system nano time ( ) a lot ( especially from different threads seems to impact its accuracy http : shipilev netblog 2 0 1 4nanotrusting - nanotime on my system the overhead of lock support park ( long ) seems to average at ~ 55 micros try to sleep for 1 nanosecond and measure how long it actually takes long start = system nano time ( ) ; int i = 0 ; while ( i < 10000 ) { lock support park nanos ( 1 ) ; i + + ; } long end = system nano time ( ) ; system out println ( ( end - start ) 10000 ) ;

public histogram call ( ) throws exception { long now = system nano time ( ) ; long next rpc = now ; long i = 0 ; while ( i < num rpcs ) { now = system nano time ( ) ; if ( next rpc - now < = 0 ) { / / todo : add option to print how far we have been off from the target delay in micros next rpc + = next delay ( target qps ) ; new rpc ( stub ) ; i + + ; } } wait for rpcs to complete ( 1 ) ; return histogram ; }


return whether the charset of file is utf 8

public static boolean is utf 8 ( final string file path ) { return is utf 8 ( get file by path ( file path ) ) ; }


handles the erasure coding reconstruction work commands

public void process erasure coding tasks ( collection < block e c reconstruction info > ec tasks ) { for ( block e c reconstruction info recon info : ec tasks ) { int xmits submitted = 0 ; try { striped reconstruction info striped recon info = new striped reconstruction info ( recon info get extended block ( ) , recon info get erasure coding policy ( ) , recon info get live block indices ( ) , recon info get source dn infos ( ) , recon info get target dn infos ( ) , recon info get target storage types ( ) , recon info get target storage i ds ( ) ) ; / / it may throw illegal argument exception from task # striped reader / / constructor final striped block reconstructor task = new striped block reconstructor ( this , striped recon info ) ; if ( task has valid targets ( ) ) { / / see hdfs - 12044 we increase xmits in progress even the task is only / / enqueued , so that / / 1 ) nn will not send more tasks than what dn can execute and / / 2 ) dn will not throw away reconstruction tasks , and instead keeps / / an unbounded number of tasks in the executor ' s task queue xmits submitted = math max ( ( int ) ( task get xmits ( ) * xmit weight ) , 1 ) ; get datanode ( ) increment xmits in process ( xmits submitted ) ; striped reconstruction pool submit ( task ) ; } else { log warn ( " no missing internal block skip reconstruction for task : { } " , recon info ) ; } } catch ( throwable e ) { get datanode ( ) decrement xmits in progress ( xmits submitted ) ; log warn ( " failed to reconstruct striped block { } " , recon info get extended block ( ) get local block ( ) , e ) ; } } }


constructs the java source info provider from the provided java sources

public java source info provider build ( ) { return new java source info provider ( source files , source jars , jar files , source jars for jar files , resources ) ; }


whether phrase queries should be automatically generated for multi terms synonyms defaults to { @ code true }

public boolean auto generate synonyms phrase query ( ) { return auto generate synonyms phrase query ; }


process all of the keys and values start up the application if we haven ' t started it yet

public void reduce ( k2 key , iterator < v2 > values , output collector < k3 , v3 > output , reporter reporter ) throws i o exception { is ok = false ; start application ( output , reporter ) ; downlink reduce key ( key ) ; while ( values has next ( ) ) { downlink reduce value ( values next ( ) ) ; } if ( skipping ) { / / flush the streams on every record input if running in skip mode / / so that we don ' t buffer other records surrounding a bad record downlink flush ( ) ; } is ok = true ; }


expect bazel to fail this method is needed when the exact error code can not be specified

public builder runner should fail ( ) { this should fail = true ; return this ; }


insert the { @ link job entity } , similar to { @ link # insert ( job entity ) } , but returns a boolean in case the insert did not go through this could happen if the execution related to the { @ link job entity } has been removed

boolean insert job entity ( job entity timer job entity ) ;


this method expects that the current field name is the concatenation of a type , a delimiter and a name ( ex : terms # foo where " terms " refers to the type of a registered { @ link named x content registry entry } , " # " is the delimiter and " foo " the name of the object to parse ) it also expected that following this field name is either an object or an array x content structure and the cursor points to the start token of this structure the method splits the field ' s name to extract the type and name and then parses the object using the { @ link x content parser # named object ( class , string , object ) } method

public static < t > void parse typed keys object ( x content parser parser , string delimiter , class < t > object class , consumer < t > consumer ) throws i o exception { if ( parser current token ( ) ! = token start object & & parser current token ( ) ! = token start array ) { throw unknown token ( parser current token ( ) , parser get token location ( ) ) ; } string current field name = parser current name ( ) ; if ( strings has length ( current field name ) ) { int position = current field name index of ( delimiter ) ; if ( position > 0 ) { string type = current field name substring ( 0 , position ) ; string name = current field name substring ( position + 1 ) ; consumer accept ( parser named object ( object class , type , name ) ) ; return ; } / / if we didn ' t find a delimiter we ignore the object or array for forward compatibility instead of throwing an error parser skip children ( ) ; } else { throw new parsing exception ( parser get token location ( ) , " failed to parse object : empty key " ) ; } }


public to string creator append ( object value ) { this styler style value ( this buffer , value ) ; return this ; }


converts the provided map as a json object according to the configured json mapper

public string to json ( @ nullable map < string , object > map ) { if ( map = = null | | map is empty ( ) ) { return null ; } try ( string writer writer = new string writer ( buffer size ) ) { object mapper write value ( writer , map ) ; if ( does append line separator ) { writer append ( core constants line separator ) ; } return writer to string ( ) ; } catch ( i o exception e ) { throw new illegal argument exception ( " unable to format map as a json " , e ) ; } }


send an { @ link android util log # error } log message send wtf soft error report ( sampled ) note : this is not equivalent of { @ link android util log # wtf }


returns a string , of length at least { @ code min length } , consisting of { @ code string } prepended with as many copies of { @ code pad char } as are necessary to reach that length for example , { @ code pad start ( " 7 " , 3 , ' 0 ' ) } returns { @ code " 007 " } { @ code pad start ( " 2010 " , 3 , ' 0 ' ) } returns { @ code " 2010 " } see { @ link java util formatter } for a richer set of formatting capabilities

public static string pad start ( string string , int min length , char pad char ) { check not null ( string ) ; / / eager for gwt if ( string length ( ) > = min length ) { return string ; } string builder sb = new string builder ( min length ) ; for ( int i = string length ( ) ; i < min length ; i + + ) { sb append ( pad char ) ; } sb append ( string ) ; return sb to string ( ) ; }