get pet { pet id } : find pet by id returns a single pet

default response entity < pet > get pet by id ( @ api param ( value = " id of pet to return " , required = true ) @ path variable ( " pet id " ) long pet id ) { get request ( ) if present ( request - > { for ( media type media type : media type parse media types ( request get header ( " accept " ) ) ) { if ( media type is compatible with ( media type value of ( " application / json " ) ) ) { string example string = " { \ " photo urls \ " : [ \ " photo urls \ " , \ " photo urls \ " ] , \ " name \ " : \ " doggie \ " , \ " id \ " : 0 , \ " category \ " : { \ " name \ " : \ " default - name \ " , \ " id \ " : 6 } , \ " tags \ " : [ { \ " name \ " : \ " name \ " , \ " id \ " : 1 } , { \ " name \ " : \ " name \ " , \ " id \ " : 1 } ] , \ " status \ " : \ " available \ " } " ; api util set example response ( request , " application / json " , example string ) ; break ; } if ( media type is compatible with ( media type value of ( " application / xml " ) ) ) { string example string = " < pet > < id > 123456789 < / id > < name > doggie < / name > < photo urls > < photo urls > aeiou < / photo urls > < / photo urls > < tags > < / tags > < status > aeiou < / status > < / pet > " ; api util set example response ( request , " application / xml " , example string ) ; break ; } } } ) ; return new response entity < > ( http status not implemented ) ; }


returns an artifact for a tool at the given root - relative path under the given root , creating it if not found this method only works for normalized , relative paths the root must be below the exec root parent , and the exec path of the resulting artifact is computed as { @ code root get relative ( root relative path ) relative to ( root exec root ) }

public artifact derived artifact get derived artifact ( path fragment root relative path , artifact root root , artifact owner owner ) { return get derived artifact ( root relative path , root , owner , / * content based path = * / false ) ; }


registers a callback to be notified when the given component has been parented to a docking window manager

public static void register component loaded listener ( component component , component loaded listener listener ) { component add hierarchy listener ( new hierarchy listener ( ) { @ override public void hierarchy changed ( hierarchy event e ) { long change flags = e get change flags ( ) ; if ( hierarchy event displayability changed ! = ( change flags & hierarchy event displayability changed ) ) { return ; } / / check for the first time we are put together boolean is displayable = component is displayable ( ) ; if ( ! is displayable ) { return ; } component remove hierarchy listener ( this ) ; docking window manager dwm = get instance ( component ) ; component provider provider = null ; if ( dwm ! = null ) { provider = dwm get component provider ( component ) ; } listener component loaded ( dwm , provider ) ; } } ) ; }


appends a named { @ code float } value to the stream

public u b json writer set ( string name , float value ) throws i o exception { return name ( name ) value ( value ) ; }


in this test , some pools have minimum shares set pool 1 has a min share of 20 so it gets 20 slots pool 2 also has a min share of 20 , but its demand is only 10 so it can only get 10 slots the remaining pools have 10 slots to split between them pool 4 gets 3 slots because its demand is only 3 , and pool 3 gets the remaining 7 slots pool 4 also had a min share of 2 slots but this should not affect the outcome

public void test min shares ( ) { scheds add ( new fake schedulable ( 20 ) ) ; scheds add ( new fake schedulable ( 18 ) ) ; scheds add ( new fake schedulable ( 0 ) ) ; scheds add ( new fake schedulable ( 2 ) ) ; compute fair shares compute shares ( scheds , resources create resource ( 40 ) , resource information memory mb get name ( ) ) ; verify memory shares ( 20 , 18 , 0 , 2 ) ; }


returns the index of the first whole word occurrence of the search word within the given text a whole word is defined as the character before and after the occurrence must not be a java identifier part

public static int index of word ( string text , string search word ) { int index = 0 ; while ( index < text length ( ) ) { index = text index of ( search word , index ) ; if ( index < 0 ) { return - 1 ; } if ( is whole word ( text , index , search word length ( ) ) ) { return index ; } index + = search word length ( ) ; } return - 1 ; }


using big decimal so we can throw if we are overflowing the long max

private static double multiply ( double first , double second ) { big decimal first val = new big decimal ( first ) ; big decimal second val = new big decimal ( second ) ; return first val multiply ( second val ) set scale ( precision , rounding mode half up ) double value ( ) ; }


projects a pair of joined elements to a { @ link tuple } with the previously selected fields requires the classes of the fields of the resulting tuples


process an actual rollback the completed flag has already been checked

private mono < void > process rollback ( transaction synchronization manager synchronization manager , generic reactive transaction status ) { return trigger before completion ( synchronization manager , status ) then ( mono defer ( ( ) - > { if ( status is new transaction ( ) ) { if ( status is debug ( ) ) { logger debug ( " initiating transaction rollback " ) ; } return do rollback ( synchronization manager , status ) ; } else { mono < void > before completion = mono empty ( ) ; / / participating in larger transaction if ( status has transaction ( ) ) { if ( status is debug ( ) ) { logger debug ( " participating transaction failed - marking existing transaction as rollback - only " ) ; } before completion = do set rollback only ( synchronization manager , status ) ; } else { logger debug ( " should roll back transaction but cannot - no transaction available " ) ; } return before completion ; } } ) ) on error resume ( error predicates runtime or error , ex - > trigger after completion ( synchronization manager , status , transaction synchronization status unknown ) then ( mono error ( ex ) ) ) then ( mono defer ( ( ) - > trigger after completion ( synchronization manager , status , transaction synchronization status rolled back ) ) ) on error resume ( ex - > cleanup after completion ( synchronization manager , status ) then ( mono error ( ex ) ) ) then ( cleanup after completion ( synchronization manager , status ) ) ; }


specify whether the database uses lower case for identifiers

protected void set stores lower case identifiers ( boolean stores lower case identifiers ) { this stores lower case identifiers = stores lower case identifiers ; }


returns type information for flink value types ( classes that implement { @ link org apache flink types value } ) built - in value types do not support null values ( except for { @ link org apache flink types string value } ) value types describe their serialization and deserialization manually instead of going through a general purpose serialization framework a value type is reasonable when general purpose serialization would be highly inefficient the wrapped value can be altered , allowing programmers to reuse objects and take pressure off the garbage collector flink provides built - in value types for all java primitive types ( such as { @ link org apache flink types boolean value } , { @ link org apache flink types int value } ) as well as { @ link org apache flink types string value } , { @ link org apache flink types null value } , { @ link org apache flink types list value } , and { @ link org apache flink types map value }

public static < v extends value > type information < v > value ( class < v > value type ) { return new value type info < > ( value type ) ; }


returns the amount of free physical memory in bytes

public long get free physical memory size ( ) { if ( get free physical memory size = = null ) { logger warn ( " get free physical memory size is not available " ) ; return 0 ; } try { final long free mem = ( long ) get free physical memory size invoke ( os mx bean ) ; if ( free mem < 0 ) { logger debug ( " os reported a negative free memory value [ { } ] " , free mem ) ; return 0 ; } return free mem ; } catch ( exception e ) { logger warn ( " exception retrieving free physical memory " , e ) ; return 0 ; } }


creates list of users with given input array

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


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

public builder set encoder padding ( int encoder padding ) { this encoder padding = encoder padding ; return this ; } / / text specific


init load balance if invokers is not empty , init from the first invoke ' s url and invocation if invokes is empty , init a default load balance ( random load balance )

protected load balance init load balance ( list < invoker < t > > invokers , invocation invocation ) { if ( collection utils is not empty ( invokers ) ) { return extension loader get extension loader ( load balance class ) get extension ( invokers get ( 0 ) get url ( ) get method parameter ( rpc utils get method name ( invocation ) , loadbalance key , default loadbalance ) ) ; } else { return extension loader get extension loader ( load balance class ) get extension ( default loadbalance ) ; } }


blocks until { @ link block manager # low redundancy blocks count } reaches a certain value

protected void wait for low redundancy count ( final long cnt ) throws timeout exception , interrupted exception { final block manager bm = cluster get namesystem ( ) get block manager ( ) ; generic test utils wait for ( ( ) - > cnt = = bm get low redundancy blocks count ( ) , 2 * wait poll interval large ms , wait for redundancy ms ) ; }


finds expanded variable with the name < code > name < code > to be used in the reference to it at < code > offset < code > returns null if nothing was found

public string find expanded variable ( long offset , string name ) { return find by name and offset recursively ( offset , name , scope - > scope expanded variables ) ; }


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


public string get job name ( ) { return datum get job name ( ) to string ( ) ; }


actually load bean definitions from the specified xml file

protected int do load bean definitions ( input source input source , resource resource ) throws bean definition store exception { try { document doc = do load document ( input source , resource ) ; int count = register bean definitions ( doc , resource ) ; if ( logger is debug enabled ( ) ) { logger debug ( " loaded " + count + " bean definitions from " + resource ) ; } return count ; } catch ( bean definition store exception ex ) { throw ex ; } catch ( s a x parse exception ex ) { throw new xml bean definition store exception ( resource get description ( ) , " line " + ex get line number ( ) + " in xml document from " + resource + " is invalid " , ex ) ; } catch ( s a x exception ex ) { throw new xml bean definition store exception ( resource get description ( ) , " xml document from " + resource + " is invalid " , ex ) ; } catch ( parser configuration exception ex ) { throw new bean definition store exception ( resource get description ( ) , " parser configuration exception parsing xml from " + resource , ex ) ; } catch ( i o exception ex ) { throw new bean definition store exception ( resource get description ( ) , " i o exception parsing xml document from " + resource , ex ) ; } catch ( throwable ex ) { throw new bean definition store exception ( resource get description ( ) , " unexpected exception parsing xml document from " + resource , ex ) ; } }


d b d value cloneable clone value ( d b r progress monitor monitor ) throws d b c exception ;


checks to see if a specified package should be considered a match due to previous matches

private boolean is matching package ( string s ) { int slash index = s last index of ( ' / ' ) ; string package name ; if ( slash index = = - 1 ) { package name = " " ; } else { package name = s substring ( 0 , slash index ) ; } return match packages contains ( package name ) ; }


resolve the argument also matching to the given type

public method parameter arg ( class < ? > type , resolvable type generic , resolvable type generics ) { return arg ( to resolvable type ( type , generic , generics ) ) ; }


default implementation that does nothing

public void close ( ) throws i o exception { }


returns the number of elements that have been written to the buffer


same as { @ link # refresh if unauthenticated async } but calling a synchronous code block

public static < v > v refresh if unauthenticated ( callable < v > call , call credentials provider call credentials provider ) throws i o exception , interrupted exception { preconditions check not null ( call ) ; preconditions check not null ( call credentials provider ) ; try { return call call ( ) ; } catch ( exception e ) { io grpc status status = io grpc status from throwable ( e ) ; if ( status ! = null & & ( status get code ( ) = = io grpc status code unauthenticated | | status get code ( ) = = io grpc status code permission denied ) ) { try { call credentials provider refresh ( ) ; return call call ( ) ; } catch ( exception ex ) { e add suppressed ( ex ) ; } } throwables throw if instance of ( e , i o exception class ) ; throwables throw if instance of ( e , interrupted exception class ) ; throwables throw if unchecked ( e ) ; throw new assertion error ( e ) ; } }


returns host that is used as a parameter in { @ link socks cmd type }

public string host ( ) { return address type = = socks address type domain ? idn to unicode ( host ) : host ; }


add additional config entries from the flink config to the yarn config

public static yarn configuration get yarn configuration ( org apache flink configuration configuration flink config ) { final yarn configuration yarn config = new yarn configuration ( ) ; for ( string key : flink config key set ( ) ) { for ( string prefix : flink config prefixes ) { if ( key starts with ( prefix ) ) { string new key = key substring ( " flink " length ( ) ) ; string value = flink config get string ( key , null ) ; yarn config set ( new key , value ) ; log debug ( " adding flink config entry for { } as { } = { } to yarn config " , key , new key , value ) ; } } } return yarn config ; }


wait for datanode to reach alive or dead state for wait time given in milliseconds

public static void wait for datanode state ( final mini d f s cluster cluster , final string node i d , final boolean alive , int wait time ) throws timeout exception , interrupted exception { generic test utils wait for ( new supplier < boolean > ( ) { @ override public boolean get ( ) { f s namesystem namesystem = cluster get namesystem ( ) ; final datanode descriptor dd = block manager test util get datanode ( namesystem , node i d ) ; return ( dd is alive ( ) = = alive ) ; } } , 100 , wait time ) ; }


return the alias names for the bean , as specified directly for the bean definition

public string [ ] get aliases ( ) { return this aliases ; }


deregister the { @ link channel } of the { @ link channel promise } from { @ link event loop } and notify the { @ link channel promise } once the operation was complete

void deregister ( channel promise promise ) ;


returns true if the action may create output artifacts whose contents aren ' t generated by this action , and also , this action does not consume its input artifacts ' contents this is rarely true symlink actions are an example where this is true : their outputs ' contents are equal to their inputs ' contents , and a symlink action does not consume its inputs ' contents this property is relevant for action rewinding and top - level output fetching

default boolean may insensitively propagate inputs ( ) { return false ; }


convert response parameters from jetty format ( http fields )

private static map < string , string > convert http fields to map ( http fields http fields ) { map < string , string > headers = new hash map < string , string > ( ) ; if ( http fields = = null | | http fields size ( ) = = 0 ) return headers ; for ( http field field : http fields ) { headers put ( field get name ( ) , field get value ( ) ) ; } return headers ; }


creates an returns a new { @ link object } that can be used and later recycled via { @ link handle # recycle ( object ) }


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


copies the content of a jar zip archive into the receiver archive < p > an optional { @ link i zip entry filter } allows to selectively choose which files to copy over

public void write zip ( input stream input , i zip entry filter filter ) throws i o exception , i zip entry filter zip abort exception { zip input stream zis = new zip input stream ( input ) ; try { / / loop on the entries of the intermediary package and put them in the final package zip entry entry ; while ( ( entry = zis get next entry ( ) ) ! = null ) { string name = entry get name ( ) ; / / do not take directories or anything inside a potential meta - inf folder if ( entry is directory ( ) | | name starts with ( " meta - inf / " ) ) { continue ; } / / if we have a filter , we check the entry against it if ( filter ! = null & & filter check entry ( name ) = = false ) { continue ; } jar entry new entry ; / / preserve the stored method of the input entry if ( entry get method ( ) = = jar entry stored ) { new entry = new jar entry ( entry ) ; } else { / / create a new entry so that the compressed len is recomputed new entry = new jar entry ( name ) ; } write entry ( zis , new entry ) ; zis close entry ( ) ; } } finally { zis close ( ) ; } }


creates invalidate api key request for given realm and user name

public static invalidate api key request using realm and user name ( string realm name , string user name ) { return new invalidate api key request ( realm name , user name , null , false , null ) ; }


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

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


creates runtime decoder implementation that is configured to produce data of the given data type

i create runtime decoder ( dynamic table source context context , data type physical data type ) ;


inspects the annotations on an interface method to construct a reusable service method that speaks http this requires potentially - expensive reflection so it is best to build each service method only once and reuse it

static < response t , return t > http service method < response t , return t > parse annotations ( retrofit retrofit , method method , request factory request factory ) { boolean is kotlin suspend function = request factory is kotlin suspend function ; boolean continuation wants response = false ; boolean continuation body nullable = false ; annotation [ ] annotations = method get annotations ( ) ; type adapter type ; if ( is kotlin suspend function ) { type [ ] parameter types = method get generic parameter types ( ) ; type response type = utils get parameter lower bound ( 0 , ( parameterized type ) parameter types [ parameter types length - 1 ] ) ; if ( get raw type ( response type ) = = response class & & response type instanceof parameterized type ) { / / unwrap the actual body type from response < t > response type = utils get parameter upper bound ( 0 , ( parameterized type ) response type ) ; continuation wants response = true ; } else { / / todo figure out if type is nullable or not / / metadata metadata = method get declaring class ( ) get annotation ( metadata class ) / / find the entry for method / / determine if return type is nullable or not } adapter type = new utils parameterized type impl ( null , call class , response type ) ; annotations = skip callback executor impl ensure present ( annotations ) ; } else { adapter type = method get generic return type ( ) ; } call adapter < response t , return t > call adapter = create call adapter ( retrofit , method , adapter type , annotations ) ; type response type = call adapter response type ( ) ; if ( response type = = okhttp 3 response class ) { throw method error ( method , " ' " + get raw type ( response type ) get name ( ) + " ' is not a valid response body type did you mean response body ? " ) ; } if ( response type = = response class ) { throw method error ( method , " response must include generic type ( e g , response < string > ) " ) ; } / / todo support unit for kotlin ? if ( request factory http method equals ( " head " ) & & ! void class equals ( response type ) ) { throw method error ( method , " head method must use void as response type " ) ; } converter < response body , response t > response converter = create response converter ( retrofit , method , response type ) ; okhttp 3 call factory call factory = retrofit call factory ; if ( ! is kotlin suspend function ) { return new call adapted < > ( request factory , call factory , response converter , call adapter ) ; } else if ( continuation wants response ) { / / noinspection unchecked kotlin compiler guarantees return t to be object return ( http service method < response t , return t > ) new suspend for response < > ( request factory , call factory , response converter , ( call adapter < response t , call < response t > > ) call adapter ) ; } else { / / noinspection unchecked kotlin compiler guarantees return t to be object return ( http service method < response t , return t > ) new suspend for body < > ( request factory , call factory , response converter , ( call adapter < response t , call < response t > > ) call adapter , continuation body nullable ) ; } }


boolean front vowel ( int at ) { if ( ( ( char at ( at ) = = ' e ' ) | | ( char at ( at ) = = ' i ' ) | | ( char at ( at ) = = ' y ' ) ) ) { return true ; } return false ; }


resolve the given destination name , convert the payload request object to serialized form , possibly using a { @ link org springframework messaging converter message converter } , wrap it as a message and send it to the resolved destination , receive a reply and convert its body to the specified target class

< t > t convert send and receive ( string destination name , object request , class < t > target class ) throws messaging exception ;


public void on resume ( ) { if ( surface view instanceof g l surface view ) { ( ( g l surface view ) surface view ) on resume ( ) ; } else if ( surface view instanceof g l texture view ) { ( ( g l texture view ) surface view ) on resume ( ) ; } }


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


transform the map with accumulators into a map containing only the results

public static map < string , optional failure < object > > to result map ( map < string , accumulator < ? , ? > > accumulators ) { map < string , optional failure < object > > result map = new hash map < > ( ) ; for ( map entry < string , accumulator < ? , ? > > entry : accumulators entry set ( ) ) { result map put ( entry get key ( ) , wrap unchecked ( entry get key ( ) , ( ) - > entry get value ( ) get local value ( ) ) ) ; } return result map ; }


test that if the % of timeouts is higher than the threshold that the circuit trips

public void test trip circuit on timeouts above threshold ( ) { string key = " cmd - e " ; try { hystrix command < boolean > cmd 1 = new success command ( key , 60 ) ; hystrix circuit breaker cb = cmd 1 circuit breaker ; / / this should start as allowing requests assert true ( cb allow request ( ) ) ; assert false ( cb is open ( ) ) ; / / success with high latency cmd 1 execute ( ) ; hystrix command < boolean > cmd 2 = new success command ( key , 1 ) ; cmd 2 execute ( ) ; hystrix command < boolean > cmd 3 = new timeout command ( key ) ; cmd 3 execute ( ) ; hystrix command < boolean > cmd 4 = new success command ( key , 1 ) ; cmd 4 execute ( ) ; hystrix command < boolean > cmd 5 = new timeout command ( key ) ; cmd 5 execute ( ) ; hystrix command < boolean > cmd 6 = new timeout command ( key ) ; cmd 6 execute ( ) ; hystrix command < boolean > cmd 7 = new success command ( key , 1 ) ; cmd 7 execute ( ) ; hystrix command < boolean > cmd 8 = new timeout command ( key ) ; cmd 8 execute ( ) ; hystrix command < boolean > cmd 9 = new timeout command ( key ) ; cmd 9 execute ( ) ; / / this should trip the circuit as the error percentage is above the threshold thread sleep ( 100 ) ; assert true ( cb is open ( ) ) ; } catch ( exception e ) { e print stack trace ( ) ; fail ( " error occurred : " + e get message ( ) ) ; } }


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


creates a label with the { @ link label # flag debug only } flag set , if there is no already existing label for the given bytecode offset ( otherwise does nothing ) the label is created with a call to { @ link # read label }

private void create debug label ( final int bytecode offset , final label [ ] labels ) { if ( labels [ bytecode offset ] = = null ) { read label ( bytecode offset , labels ) flags | = label flag debug only ; } }


handle the rest requests when stopping is true

private void handle rest request ( ) { int remain nums = store requests size ( ) ; for ( int i = 0 ; i < remain nums ; i + + ) { handle store request ( store requests poll ( ) ) ; } }


public static final string escape hidden dir prefix chars ( string name ) { int prefix count = count hidden dir prefix chars ( name ) ; if ( prefix count = = 0 ) { return name ; } string builder buf = new string builder ( ) ; / / keep number of hidden prefix chars even for ( int i = 0 ; i < prefix count ; + + i ) { buf append ( hidden dir prefix char ) ; } buf append ( name ) ; return buf to string ( ) ; }


test a point for containment in this fixture

public boolean test point ( vector 2 p ) { return jni test point ( addr , p x , p y ) ; }


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


this method should handle commands from standby namenode except dna register which should be handled earlier itself

private boolean process command from standby ( datanode command cmd , b p service actor actor ) throws i o exception { switch ( cmd get action ( ) ) { case datanode protocol dna accesskeyupdate : log info ( " datanode command action from standby : dna accesskeyupdate " ) ; if ( dn is block token enabled ) { dn block pool token secret manager add keys ( get block pool id ( ) , ( ( key update command ) cmd ) get exported keys ( ) ) ; } break ; case datanode protocol dna transfer : case datanode protocol dna invalidate : case datanode protocol dna shutdown : case datanode protocol dna finalize : case datanode protocol dna recoverblock : case datanode protocol dna balancerbandwidthupdate : case datanode protocol dna cache : case datanode protocol dna uncache : case datanode protocol dna erasure coding reconstruction : log warn ( " got a command from standby nn - ignoring command : " + cmd get action ( ) ) ; break ; default : log warn ( " unknown datanode command action : " + cmd get action ( ) ) ; } return true ; }


construct a new { @ link java util set } that is the intersection of the given sets

public static < t > set < t > intersection ( set < ? extends t > set 1 , set < ? extends t > set 2 ) { set < t > result = helpers < t > copy to set ( set 1 ) ; result retain all ( set 2 ) ; return result ; }


assign the long value to the given property name

public void put long ( string property name , long value ) { map put ( property name , new pair < property entry type , string > ( property entry type long type , long to string ( value ) ) ) ; }


removes the given listener from the set of listeners managed by this lifecycle implementation , returning { @ code true } if the listener was removed successfully , and { @ code false } otherwise this is an optimization only , there is no guarantee that every added listener will eventually be removed

void remove listener ( @ non null lifecycle listener listener ) ;


all tests run as a an administrative user but use < code > es - shield - runas - user < code > to become a less privileged user

protected settings rest client settings ( ) { return settings builder ( ) put ( thread context prefix + " authorization " , user token ) build ( ) ; }


public void upload file test ( ) { long pet id = null ; string additional metadata = null ; org apache cxf jaxrs ext multipart attachment file = null ; / / model api response response = api upload file ( pet id , additional metadata , file ) ; / / assert not null ( response ) ; / / todo : test validations }


get all the private methods of intercept points that need custom enhancements

private hash map < string , element matcher > get enhance classes ( ) { return ( hash map < string , element matcher > ) context enhance classes ; }


processes the single argument given to determine if the argument is ( i ) a valid string , ( ii ) a valid integer , or ( iii ) an invalid argument if the argument is a valid string , it can either be in the form ' a ' , or ' a , b ' or ' a , b , c ' where a and b are the start and end of the range respectively , and c is the optional step argument in the case where ' a ' is the only argument , ' a ' becomes the range end ( exclusive ) and 0 becomes the default range start if the argument is a valid integer , it can will default to become the range end , and 0 defaults to become the range start in all other cases , the argument is considered invalid

private object create range with one given argument ( object [ ] args ) { object range = args [ 0 ] ; int range start = default start ; int range end = 0 ; int range step = default step ; / / check for valid string argument ( s ) if ( range ! = null & & range instanceof string ) { string range string = ( ( string ) range ) trim ( ) ; string [ ] range values = range string split ( separator ) ; if ( has comma as last character ( range string ) ) { return new eval error ( " the last character in the input string should not be a comma " ) ; } try { if ( range values length = = 1 ) { range end = integer parse int ( range values [ 0 ] trim ( ) ) ; return create range ( range start , range end , range step ) ; } else if ( range values length = = 2 ) { range start = integer parse int ( range values [ 0 ] trim ( ) ) ; range end = integer parse int ( range values [ 1 ] trim ( ) ) ; return create range ( range start , range end , range step ) ; } else if ( range values length = = 3 ) { range start = integer parse int ( range values [ 0 ] trim ( ) ) ; range end = integer parse int ( range values [ 1 ] trim ( ) ) ; range step = integer parse int ( range values [ 2 ] trim ( ) ) ; return create range ( range start , range end , range step ) ; } } catch ( number format exception nfe ) { return new eval error ( control function registry get function name ( this ) + " expects a string of the form ' a , b , c ' or integers a , b , c where a and b " + " are the start and the end of the range respectively and c is the step ( increment ) " ) ; } } / / check for valid negative integer argument if ( range ! = null & & range instanceof double & & ( double ) range % 1 = = 0 ) { range = ( ( double ) range ) int value ( ) ; return create range ( default start , range end , default step ) ; } / / check for valid positive integer argument if ( range ! = null ) { try { range end = integer parse int ( string value of ( range ) ) ; return create range ( default start , range end , default step ) ; } catch ( number format exception nfe ) { return new eval error ( control function registry get function name ( this ) + " expects a string of the form ' a , b , c ' or integers a , b , c where a and b " + " are the start and the end of the range respectively and c is the step ( increment ) " ) ; } } return new eval error ( control function registry get function name ( this ) + " expects a string of the form ' a , b , c ' or integers a , b , c where a and b " + " are the start and the end of the range respectively and c is the step ( increment ) " ) ; }


post fakeouterstring test serialization of outer string types

public response entity < string > fake outer string serialize ( @ api param ( value = " input string as post body " ) @ valid @ request body ( required = false ) string body ) { return new response entity < > ( http status not implemented ) ; }


get a list of container statuses running on this node manager

public get container statuses response get container statuses ( get container statuses request request ) throws yarn exception , i o exception { list < container status > succeeded requests = new array list < container status > ( ) ; map < container id , serialized exception > failed requests = new hash map < container id , serialized exception > ( ) ; user group information remote ugi = get remote ugi ( ) ; n m token identifier identifier = select n m token identifier ( remote ugi ) ; if ( identifier = = null ) { throw r p c util get remote exception ( invalid nmtoken msg ) ; } string remote user = remote ugi get user name ( ) ; for ( container id id : request get container ids ( ) ) { try { container status status = get container status internal ( id , identifier , remote user ) ; succeeded requests add ( status ) ; } catch ( yarn exception e ) { failed requests put ( id , serialized exception new instance ( e ) ) ; } } return get container statuses response new instance ( succeeded requests , failed requests ) ; }


cast an i binder object into an com taobao atlas dexmerge i dex merge callback interface , generating a proxy if needed

public static i dex merge callback as interface ( android os i binder obj ) { if ( ( obj = = null ) ) { return null ; } android os i interface iin = obj query local interface ( descriptor ) ; if ( ( ( iin ! = null ) & & ( iin instanceof i dex merge callback ) ) ) { return ( ( i dex merge callback ) iin ) ; } return new proxy ( obj ) ; }


public void test nested rewrites ( ) throws i o exception { field sort builder sort builder = new field sort builder ( mapped string fieldname ) ; range query builder range query = new range query builder ( " field name " ) { @ override public query builder do rewrite ( query rewrite context query shard context ) throws i o exception { return new match none query builder ( ) ; } } ; nested sort builder nested sort = new nested sort builder ( " path " ) ; nested sort set filter ( range query ) ; sort builder set nested sort ( nested sort ) ; field sort builder rewritten = sort builder rewrite ( create mock shard context ( ) ) ; assert not same ( range query , rewritten get nested sort ( ) get filter ( ) ) ; }


public dyld architecture get architecture ( ) { return architecture ; }


replaces the specified backing index with a new index and returns a new { @ code data stream } instance with the modified backing indices an { @ code illegal argument exception } is thrown if the index to be replaced is not a backing index for this data stream or if it is the { @ code data stream } ' s write index

public data stream replace backing index ( index existing backing index , index new backing index ) { list < index > backing indices = new array list < > ( indices ) ; int backing index position = backing indices index of ( existing backing index ) ; if ( backing index position = = - 1 ) { throw new illegal argument exception ( string format ( locale root , " index [ % s ] is not part of data stream [ % s ] " , existing backing index get name ( ) , name ) ) ; } if ( generation = = ( backing index position + 1 ) ) { throw new illegal argument exception ( string format ( locale root , " cannot replace backing index [ % s ] of data stream [ % s ] because " + " it is the write index " , existing backing index get name ( ) , name ) ) ; } backing indices set ( backing index position , new backing index ) ; return new data stream ( name , time stamp field , backing indices , generation , metadata , hidden , replicated ) ; }


stop the current task the results are undefined if timing methods are called without invoking at least one pair of { @ code start ( ) } { @ code stop ( ) } methods

public void stop ( ) throws illegal state exception { if ( this current task name = = null ) { throw new illegal state exception ( " can ' t stop stop watch : it ' s not running " ) ; } long last time = system nano time ( ) - this start time nanos ; this total time nanos + = last time ; this last task info = new task info ( this current task name , last time ) ; if ( this keep task list ) { this task list add ( this last task info ) ; } + + this task count ; this current task name = null ; }


removes all actors and cells from the table ( same as { @ link # clear children ( ) } ) and additionally resets all table properties and cell , column , and row defaults

public void reset ( ) { clear children ( ) ; pad top = background top ; pad left = background left ; pad bottom = background bottom ; pad right = background right ; align = align center ; debug ( debug none ) ; cell defaults reset ( ) ; for ( int i = 0 , n = column defaults size ; i < n ; i + + ) { cell column cell = column defaults get ( i ) ; if ( column cell ! = null ) cell pool free ( column cell ) ; } column defaults clear ( ) ; }


called by created threads to pass on errors only the first thrown error is set once set , the shutdown process will be executed and all shard consuming threads will be interrupted

protected void stop with error ( throwable throwable ) { if ( this error compare and set ( null , throwable ) ) { shutdown fetcher ( ) ; } }


asserts that the cache contains the given data for { @ code data spec }

public static void assert data cached ( cache cache , data spec data spec , byte [ ] expected ) throws i o exception { data source data source = new cache data source ( cache , dummy data source instance , 0 ) ; byte [ ] bytes ; try { data source open ( data spec ) ; bytes = util read to end ( data source ) ; } catch ( i o exception e ) { throw new i o exception ( " opening / reading cache failed : " + data spec , e ) ; } finally { data source close ( ) ; } assert with message ( " cached data doesn ' t match expected for ' " + data spec uri + " ' , " ) that ( bytes ) is equal to ( expected ) ; }


public void test special model name ( ) { / / todo : test special model name }


public void update pet ( pet body ) throws api exception { update pet with http info ( body ) ; }


get a matching annotation or meta - annotation of the specified type , or { @ link merged annotation # missing ( ) } if none is present

< a extends annotation > merged annotation < a > get ( class < a > annotation type , @ nullable predicate < ? super merged annotation < a > > predicate , @ nullable merged annotation selector < a > selector ) ;


allocate a { @ link byte buf } which will be used for constructing a datagram packet sub - classes may override this method to return a { @ link byte buf } with a perfect matching initial capacity

protected byte buf allocate buffer ( channel handler context ctx , @ suppress warnings ( " unused " ) addressed envelope < dns query , inet socket address > msg ) throws exception { return ctx alloc ( ) io buffer ( 1024 ) ; }


public void test quota on truncate with snapshot ( ) throws exception { path root = new path ( " / " ) ; path dir path = new path ( root , " dir " ) ; assert true ( fs mkdirs ( dir path ) ) ; path file path = new path ( dir path , " file " ) ; d f s test util create file ( fs , file path , 10 , ( short ) 3 , 0 ) ; / / verify quotausage and content summary after creating snapshot fs allow snapshot ( dir path ) ; fs create snapshot ( dir path , " s 1 " ) ; assert equals ( fs get content summary ( root ) get space consumed ( ) , fs get quota usage ( root ) get space consumed ( ) ) ; / / truncating the file size to 5bytes boolean blockrecovery = fs truncate ( file path , 5 ) ; if ( ! blockrecovery ) { check block recovery ( file path , fs , 300 , 100l ) ; } / / verify quotausage and content summary after truncating file which exists / / in snapshot assert equals ( fs get content summary ( root ) get space consumed ( ) , fs get quota usage ( root ) get space consumed ( ) ) ; / / verify quotausage and content summary after deleting snapshot / / now the quota of the file shouldn ' t present in quotausage and content / / summary fs delete snapshot ( dir path , " s 1 " ) ; assert equals ( fs get content summary ( root ) get space consumed ( ) , fs get quota usage ( root ) get space consumed ( ) ) ; }


public string connection string ( ) { return connection string ; }


multicast the given application event to appropriate listeners if the { @ code event type } is { @ code null } , a default type is built based on the { @ code event } instance

void multicast event ( application event event , @ nullable resolvable type event type ) ;


the properties used to build the connection

protected properties connection properties ( ) { properties connection properties = new properties ( ) ; connection properties put ( jdbc timezone , random known time zone ( ) ) ; / / in the tests , don ' t be lenient towards multi values connection properties put ( " field multi value leniency " , " false " ) ; return connection properties ; }


returns a new instance of { @ code class name } attached with an immutable label which marks the type is not subject to further desugar operations until the final label striping

public final class name with core type immutable label ( ) { return is desugar shadowed type ( ) ? with package prefix ( immutable label label ) : this ; }


job i d name to job i d ( string name ) ;


public static file get file system path ( file base , uuid shard uuid ) { string uuid = shard uuid to string ( ) to lower case ( english ) ; return base to path ( ) resolve ( uuid substring ( 0 , 2 ) ) resolve ( uuid substring ( 2 , 4 ) ) resolve ( uuid + file extension ) to file ( ) ; }


protected http sign http user pre auth request ( final http request ) { request sign request ( duo properties get duo integration key ( ) , duo properties get duo secret key ( ) ) ; return request ; }


private int get registers size ( ) { return code get insns ( ) get registers size ( ) ; }


returns whether an animation is used to show and hide the playback controls

public boolean is animation enabled ( ) { return control view layout manager is animation enabled ( ) ; }


public long get virtual memory size ( ) { return get conf ( ) get long ( maxvmem testing property , - 1 ) ; }


clones the given writable using the { @ link i o readable writable serialization }

public static < t extends i o readable writable > t create copy writable ( t original ) throws i o exception { if ( original = = null ) { return null ; } final byte array output stream baos = new byte array output stream ( ) ; try ( data output view stream wrapper out = new data output view stream wrapper ( baos ) ) { original write ( out ) ; } final byte array input stream bais = new byte array input stream ( baos to byte array ( ) ) ; try ( data input view stream wrapper in = new data input view stream wrapper ( bais ) ) { @ suppress warnings ( " unchecked " ) t copy = ( t ) instantiate ( original get class ( ) ) ; copy read ( in ) ; return copy ; } }


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

public static fields find by thrift id ( int field id ) { switch ( field id ) { case 0 : / / success return success ; default : return null ; } }


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


compares this object with the specified object for order returns a negative integer , zero , or a positive integer as this object is less than , equal to , or greater than the specified object

public int compare to ( disk balancer data node that ) { preconditions check not null ( that ) ; if ( double compare ( this node data density - that get node data density ( ) , 0 ) < 0 ) { return - 1 ; } if ( double compare ( this node data density - that get node data density ( ) , 0 ) = = 0 ) { return 0 ; } if ( double compare ( this node data density - that get node data density ( ) , 0 ) > 0 ) { return 1 ; } return 0 ; }


protected string get requested service ( final http servlet request request ) { val target service = request get parameter ( cas protocol constants parameter target service ) ; val service = request get parameter ( cas protocol constants parameter service ) ; val service attribute = request get attribute ( cas protocol constants parameter service ) ; if ( string utils is not blank ( target service ) ) { return target service ; } if ( string utils is not blank ( service ) ) { return service ; } if ( service attribute ! = null ) { if ( service attribute instanceof service ) { return ( ( service ) service attribute ) get id ( ) ; } return service attribute to string ( ) ; } return null ; }


returns a new array that appends { @ code element } to { @ code array }

public static < t > t [ ] concat ( t [ ] array , @ nullable t element ) { t [ ] result = arrays copy of ( array , array length + 1 ) ; result [ array length ] = element ; return result ; }


whether to copy the http session id to the handshake attributes

public boolean is copy http session id ( ) { return this copy http session id ; }


public void data type added ( long data type i d , int type , object old value , object new value ) { if ( record changes ) { ( ( program d b change set ) change set ) data type added ( data type i d ) ; } changed = true ; fire event ( new program change record ( type , null , null , null , old value , new value ) ) ; }


set the ordered list of scripts to execute immediately following import and and analysis of a program if import not performed , these scripts will execute once following any pre - scripts

public void set post scripts ( list < string > post scripts ) { list < pair < string , string [ ] > > post scripts empty args = new linked list < > ( ) ; for ( string post script : post scripts ) { post scripts empty args add ( new pair < > ( post script , new string [ 0 ] ) ) ; } set post scripts with args ( post scripts empty args ) ; }


projects a { @ link tuple } { @ link data stream } to the previously selected fields

public < t0 , t1 , t2 , t3 , t4 , t5 , t6 , t7 , t8 , t9 , t10 , t11 > single output stream operator < tuple 1 2 < t0 , t1 , t2 , t3 , t4 , t5 , t6 , t7 , t8 , t9 , t10 , t11 > > project tuple 1 2 ( ) { type information < ? > [ ] f types = extract field types ( field indexes , data stream get type ( ) ) ; tuple type info < tuple 1 2 < t0 , t1 , t2 , t3 , t4 , t5 , t6 , t7 , t8 , t9 , t10 , t11 > > t type = new tuple type info < tuple 1 2 < t0 , t1 , t2 , t3 , t4 , t5 , t6 , t7 , t8 , t9 , t10 , t11 > > ( f types ) ; return data stream transform ( " projection " , t type , new stream project < in , tuple 1 2 < t0 , t1 , t2 , t3 , t4 , t5 , t6 , t7 , t8 , t9 , t10 , t11 > > ( field indexes , t type create serializer ( data stream get execution config ( ) ) ) ) ; }


register the supplied { @ link bean definition holder bean } with the supplied { @ link bean definition registry registry } subclasses can override this method to control whether or not the supplied { @ link bean definition holder bean } is actually even registered , or to register even more beans the default implementation registers the supplied { @ link bean definition holder bean } with the supplied { @ link bean definition registry registry } only if the { @ code is nested } parameter is { @ code false } , because one typically does not want inner beans to be registered as top level beans

protected void register bean definition ( bean definition holder definition , bean definition registry registry ) { bean definition reader utils register bean definition ( definition , registry ) ; }


enables named parameters in prepared s q ls

public void set named parameters enabled ( boolean enabled ) { this named parameters enabled = enabled ; }


sets whether the start position and the end position are relative to the default position in the window ( default : { @ code false } )

public builder set clip relative to default position ( boolean relative to default position ) { this clip relative to default position = relative to default position ; return this ; }


transforms a { @ code co feedback transformation } this will only transform feedback edges , the result of this transform will be wired to the second input of a co - transform the original input is wired directly to the first input of the downstream co - transform this is responsible for creating the iteration source and iteration sink which are used to feed back the elements

private < f > collection < integer > transform co feedback ( co feedback transformation < f > co iterate ) { if ( should execute in batch mode ) { throw new unsupported operation exception ( " iterations are not supported in batch " + " execution mode if you want to execute such a pipeline , please set the " + " ' " + execution options runtime mode key ( ) + " ' = " + runtime execution mode streaming name ( ) ) ; } / / for co - iteration we don ' t need to transform the input and wire the input to the / / head operator by returning the input i ds , the input is directly wired to the left / / input of the co - operation this transform only needs to return the ids of the feedback / / edges , since they need to be wired to the second input of the co - operation / / create the fake iteration source / sink pair tuple 2 < stream node , stream node > it source and sink = stream graph create iteration source and sink ( co iterate get id ( ) , get new iteration node id ( ) , get new iteration node id ( ) , co iterate get wait time ( ) , co iterate get parallelism ( ) , co iterate get max parallelism ( ) , co iterate get min resources ( ) , co iterate get preferred resources ( ) ) ; stream node it source = it source and sink f 0 ; stream node it sink = it source and sink f 1 ; / / we set the proper serializers for the sink / source stream graph set serializers ( it source get id ( ) , null , null , co iterate get output type ( ) create serializer ( execution config ) ) ; stream graph set serializers ( it sink get id ( ) , co iterate get output type ( ) create serializer ( execution config ) , null , null ) ; collection < integer > result ids = collections singleton ( it source get id ( ) ) ; / / at the iterate to the already - seen - set with the result i ds , so that we can transform / / the feedback edges and let them stop when encountering the iterate node already transformed put ( co iterate , result ids ) ; / / so that we can determine the slot sharing group from all feedback edges list < integer > all feedback ids = new array list < > ( ) ; for ( transformation < f > feedback edge : co iterate get feedback edges ( ) ) { collection < integer > feedback ids = transform ( feedback edge ) ; all feedback ids add all ( feedback ids ) ; for ( integer feedback id : feedback ids ) { stream graph add edge ( feedback id , it sink get id ( ) , 0 ) ; } } string slot sharing group = determine slot sharing group ( null , all feedback ids ) ; it sink set slot sharing group ( slot sharing group ) ; it source set slot sharing group ( slot sharing group ) ; return collections singleton ( it source get id ( ) ) ; }


string get name ( ) { return " vtshape " + index ; }


calculates this buffer ' s hash code from the remaining chars the position , limit , capacity and mark don ' t affect the hash code

public int hash code ( ) { int my position = position ; int hash = 0 ; while ( my position < limit ) { hash = hash + get ( my position + + ) ; } return hash ; }


get the field { @ code descriptor index } of the member this is just a convenient shorthand for { @ code get nat ( ) get descriptor ( ) }


public boolean is prefix ns boolean ( ) { return prefix ns boolean ; }


switches the { @ link thread # get context class loader ( ) context class loader } for the managed resources { @ link class loader } before allowing the invocation to occur

public object invoke ( string op name , object [ ] op args , string [ ] sig ) throws m bean exception , reflection exception { class loader current class loader = thread current thread ( ) get context class loader ( ) ; try { thread current thread ( ) set context class loader ( this managed resource class loader ) ; return super invoke ( op name , op args , sig ) ; } finally { thread current thread ( ) set context class loader ( current class loader ) ; } }


scroll to the index in the section with an additional offset one notable difference between this and the { @ link # request focus ( section context , int ) } api is that this will always take an action , while { @ link # request focus ( section context , int ) } will ignore the command if the item is visible on the screen

public static void request focus with offset ( section context c , int index , int offset ) { final section scoped section = c get section scope ( ) ; final section tree section tree = c get section tree ( ) ; if ( scoped section = = null | | section tree = = null ) { return ; } section tree request focus with offset ( scoped section , index , offset ) ; }


public string get name ( ) { return name ; }


based on http : www particleincell com 2 0 1 2bezier - splines


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


this is the core of build trie the interface , and stub , above , just adds an empty carried trie node ref we build trie nodes in depth first order , which is also in key space order every leaf node is referenced as a slot in a parent internal node if two adjacent slots [ in the dfo ] hold leaf nodes that have no split point , then they are not separated by a split point either , because there ' s no place in key space for that split point to exist when that happens , the leaf nodes would be semantically identical , and we reuse the object a single carried trie node ref " ref " lives for the duration of the tree - walk ref carries a potentially reusable , unsplit leaf node for such reuse until a leaf node with a split arises , which breaks the chain until we need to make a new unsplit leaf node note that this use of carried trie node ref means that for internal nodes , for internal nodes if this code is modified in any way we still need to make or fill in the subnodes in key space order

private trie node build trie rec ( binary comparable [ ] splits , int lower , int upper , byte [ ] prefix , int max depth , carried trie node ref ref ) { final int depth = prefix length ; / / we generate leaves for a single split point as well as for / / no split points if ( depth > = max depth | | lower > = upper - 1 ) { / / if we have two consecutive requests for an unsplit trie node , we / / can deliver the same one the second time if ( lower = = upper & & ref content ! = null ) { return ref content ; } trie node result = leaf trie node factory ( depth , splits , lower , upper ) ; ref content = lower = = upper ? result : null ; return result ; } inner trie node result = new inner trie node ( depth ) ; byte [ ] trial = arrays copy of ( prefix , prefix length + 1 ) ; / / append an extra byte on to the prefix int current bound = lower ; for ( int ch = 0 ; ch < 0x f f ; + + ch ) { trial [ depth ] = ( byte ) ( ch + 1 ) ; lower = current bound ; while ( current bound < upper ) { if ( splits [ current bound ] compare to ( trial , 0 , trial length ) > = 0 ) { break ; } current bound + = 1 ; } trial [ depth ] = ( byte ) ch ; result child [ 0x f f & ch ] = build trie rec ( splits , lower , current bound , trial , max depth , ref ) ; } / / pick up the rest trial [ depth ] = ( byte ) 0x f f ; result child [ 0x f f ] = build trie rec ( splits , lower , current bound , trial , max depth , ref ) ; return result ; }


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


public list < elasticsearch exception > get failures ( ) { return failures ; }


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


private void prim execute ( ) { / / put entity ' s bound in init map - it could be used by entity part on undo diagram part get diagram ( ) get visual info ( entity get object ( ) , true ) init bounds = entity part get bounds ( ) ; / / zero bounds - to let modify bounds reflect on undo / / entity part modify bounds ( new rectangle ( 0 , 0 , 0 , 0 ) ) ; / / delete entity delete relationships ( entity ) ; index = diagram part get diagram ( ) get entities ( ) index of ( entity ) ; diagram part get diagram ( ) remove entity ( entity , true ) ; }


return the original uri template used to prepare the request , if any

public string get uri template ( ) { return this uri template ; }


monitor a job and print status in real - time as progress is made and tasks fail

public boolean monitor and print job ( job conf conf , running job job ) throws i o exception , interrupted exception { return ( ( networked job ) job ) monitor and print job ( ) ; }


returns true if the dashed - line effect is enabled , false if not default : disabled

public boolean is dashed line enabled ( ) { return m dash path effect = = null ? false : true ; }


gets all { @ link service instance service instances } by the specified service name

default list < service instance > get instances ( string service name ) throws null pointer exception { list < service instance > all instances = new linked list < > ( ) ; int offset = 0 ; int page size = get default page size ( ) ; page < service instance > page = get instances ( service name , offset , page size ) ; all instances add all ( page get data ( ) ) ; while ( page has next ( ) ) { offset + = page get data size ( ) ; page = get instances ( service name , offset , page size ) ; all instances add all ( page get data ( ) ) ; } return unmodifiable list ( all instances ) ; }


tested at { @ link org apache hadoop hdfs test d f s striped output stream with failure # test block token expired ( ) }


helper method that encodes any of the three - unit register - range formats

private static void encode register range ( decoded instruction insn , code output out ) { out write ( code unit ( insn get opcode ( ) , insn get register count ( ) ) , insn get index unit ( ) , insn get a unit ( ) ) ; }


compute an environment map for local actions on windows returns a map with the same keys and values as { @ code env } overrides the value of tmp and temp ( or adds them if not present in { @ code env } ) by the same value , which is : the value of { @ code client env get ( " tmp " ) } , or if that ' s empty or null , then the value of { @ code client env get ( " temp " ) } , or if that ' s empty or null , then the value of { @ code fallback tmp dir } the values for tmp and temp will use backslashes as directory separators

public immutable map < string , string > rewrite local env ( map < string , string > env , bin tools bin tools , string fallback tmp dir ) { immutable map builder < string , string > result = immutable map builder ( ) ; result put all ( maps filter keys ( env , k - > ! k equals ( " tmp " ) & & ! k equals ( " temp " ) ) ) ; string p = client env get ( " tmp " ) ; if ( strings is null or empty ( p ) ) { p = client env get ( " temp " ) ; if ( strings is null or empty ( p ) ) { p = fallback tmp dir ; } } p = p replace ( ' / ' , ' \ \ ' ) ; result put ( " tmp " , p ) ; result put ( " temp " , p ) ; return result build ( ) ; }


return whether the setter method of the given bean property is defined in any of the given interfaces

public static boolean is setter defined in interface ( property descriptor pd , set < class < ? > > interfaces ) { method setter = pd get write method ( ) ; if ( setter ! = null ) { class < ? > target class = setter get declaring class ( ) ; for ( class < ? > ifc : interfaces ) { if ( ifc is assignable from ( target class ) & & class utils has method ( ifc , setter ) ) { return true ; } } } return false ; }


returns an unmodifiable view of { @ code iterator }

public static < t > unmodifiable iterator < t > unmodifiable iterator ( final iterator < ? extends t > iterator ) { check not null ( iterator ) ; if ( iterator instanceof unmodifiable iterator ) { @ suppress warnings ( " unchecked " ) / / since it ' s unmodifiable , the covariant cast is safe unmodifiable iterator < t > result = ( unmodifiable iterator < t > ) iterator ; return result ; } return new unmodifiable iterator < t > ( ) { @ override public boolean has next ( ) { return iterator has next ( ) ; } @ override public t next ( ) { return iterator next ( ) ; } } ; }


returns { @ link list } such that its { @ code get ( end ) } returns the concatenation of [ token start , , token end ] ( both end inclusive )

public list < string > sub sequence ( final int start ) { return new abstract list < string > ( ) { public string get ( int index ) { string builder buf = new string builder ( ) ; for ( int i = start ; i < = start + index ; i + + ) buf append ( tokens [ i ] ) ; return buf to string ( ) trim ( ) ; } public int size ( ) { return tokens length - start ; } } ; }


retrieves return a list of { @ link index template config } that represents the index templates that should be installed and managed

protected list < index template config > get legacy template configs ( ) { return collections empty list ( ) ; }


public static void set record length ( configuration conf , int record length ) { conf set int ( fixed record length , record length ) ; }


public string get cursor name ( ) throws s q l exception { return null ; }


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

protected final void resize ( int new size ) { count = new size ; values = array util grow ( values , count ) ; values cursor = 0 ; }


protected void set nodes to process ( list < disk balancer data node > nodes ) { if ( cluster = = null ) { throw new illegal state exception ( " set nodes to process invoked before " + " initializing cluster illegal usage " ) ; } cluster set nodes to process ( nodes ) ; }


unset storage policy set for a given filedirectory

public void unset storage policy ( string src ) throws i o exception { check open ( ) ; try ( trace scope ignored = new path trace scope ( " unset storage policy " , src ) ) { namenode unset storage policy ( src ) ; } catch ( remote exception e ) { throw e unwrap remote exception ( access control exception class , file not found exception class , safe mode exception class , n s quota exceeded exception class , unresolved path exception class , snapshot access control exception class ) ; } }


the children of this element < code > repeated aapt pb xml node child = 5 ; < code >

public com android aapt resources xml node get child ( int index ) { return child get ( index ) ; }


test that a failure to connect to hdfs does not cause the init ( ) method to fail

public void test init with no h d f s ( ) { string path = " hdfs : / / " + cluster get name node ( ) get host and port ( ) + " / tmp " ; shutdown hdfs ( ) ; mock sink errored = false ; init metrics system ( path , true , false ) ; assert true ( " the sink was not initialized as expected " , mock sink initialized ) ; assert false ( " the sink threw an unexpected error on initialization " , mock sink errored ) ; }


public void set text ( string text ) { text area set text ( text ) ; }


test group reduce on edges ( ) with an edge having a trg id that does not exist in the vertex data set

public void test group reduce on edges invalid edge trg id ( ) throws exception { final execution environment env = execution environment get execution environment ( ) ; env set parallelism ( parallelism ) ; graph < long , long , long > graph = graph from data set ( test graph utils get long long vertex data ( env ) , test graph utils get long long edge invalid trg data ( env ) , env ) ; try { data set < tuple 2 < long , long > > vertices with all neighbors = graph group reduce on edges ( new select neighbors value greater than four ( ) , edge direction all ) ; vertices with all neighbors output ( new discarding output format < > ( ) ) ; env execute ( ) ; fail ( " expected an exception " ) ; } catch ( exception e ) { / / we expect the job to fail with an exception } }


public void add attribute ( string name , big integer value , boolean hex ) { buffer append ( " " + name + " = \ " " ) ; if ( hex ) { buffer append ( " 0x " ) ; } buffer append ( value to string ( hex ? 16 : 10 ) ) ; buffer append ( " \ " " ) ; }


public table debug actor ( ) { super set debug ( true ) ; if ( debug ! = debug actor ) { this debug = debug actor ; invalidate ( ) ; } return this ; }


always returns { @ code false } since jaxb 2 collection http message converter does not convert collections to xml

public boolean can write ( @ nullable type type , @ nullable class < ? > clazz , @ nullable media type media type ) { return false ; }


public void set angular velocity ( float angular velocity ) { this angular velocity = angular velocity ; }


reset ( ) is not supported for hashing input stream

public void reset ( ) throws i o exception { throw new i o exception ( " reset not supported " ) ; }


this method is called when failure response headers need to be set ( at startup ) or updated ( if license state changes )

public void set headers ( map < string , list < string > > failure response headers ) { default failure response headers = failure response headers ; }


print out what ' s going on the logging a p is aren ' t used and the text delimited for more details

private void println ( string name , string text ) { system out println ( name + " : # " + text + " # " ) ; }


feeds and drains the audio processor up to the end of track one , returning the total output size in bytes

private int feed and drain audio processor to end of track one ( ) throws exception { / / feed and drain the processor , simulating a gapless transition to another track byte buffer input buffer = byte buffer allocate ( track one buffer size bytes ) ; int output size = 0 ; while ( ! trimming audio processor is ended ( ) ) { if ( input buffer has remaining ( ) ) { trimming audio processor queue input ( input buffer ) ; if ( ! input buffer has remaining ( ) ) { / / reconfigure for a next track then begin draining trimming audio processor set trim frame count ( track two trim start frame count , track two trim end frame count ) ; trimming audio processor configure ( audio format ) ; trimming audio processor queue end of stream ( ) ; } } byte buffer output buffer = trimming audio processor get output ( ) ; output size + = output buffer remaining ( ) ; output buffer clear ( ) ; } trimming audio processor reset ( ) ; return output size ; }


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

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


public source extractor get source extractor ( ) { return this source extractor ; }


void set loads ( immutable map < string , module > loads ) { pkg loads = preconditions check not null ( loads ) ; }


returns a string that summarizes this sink for printing to a console or log


put faketest - query - paramters to test the collection format in query parameters

response entity < void > test query parameter collection format ( @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " pipe " , required = true ) list < string > pipe , @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " ioutil " , required = true ) list < string > ioutil , @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " http " , required = true ) list < string > http , @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " url " , required = true ) list < string > url , @ not null @ api param ( value = " " , required = true ) @ valid @ request param ( value = " context " , required = true ) list < string > context ) ;


test if this table has an element that points into the table

private boolean table contains ( address test addr ) { address end = top address add ( this get byte length ( ) ) ; address range range = new address range impl ( top address , end ) ; return range contains ( test addr ) ; }


public static long get length ( final file file ) { if ( file = = null ) return 0 ; if ( file is directory ( ) ) { return get dir length ( file ) ; } return get file length ( file ) ; }


applies the given window function to each window the window function is called for each evaluation of the window for each key individually the output of the window function is interpreted as a regular non - windowed stream arriving data is incrementally aggregated using the given aggregate function this means that the window function typically has only a single value to process when called

public < acc , v , r > single output stream operator < r > aggregate ( aggregate function < t , acc , v > aggregate function , all window function < v , r , w > window function , type information < acc > accumulator type , type information < r > result type ) { check not null ( aggregate function , " aggregate function " ) ; check not null ( window function , " window function " ) ; check not null ( accumulator type , " accumulator type " ) ; check not null ( result type , " result type " ) ; if ( aggregate function instanceof rich function ) { throw new unsupported operation exception ( " this aggregate function cannot be a rich function " ) ; } / / clean the closures window function = input get execution environment ( ) clean ( window function ) ; aggregate function = input get execution environment ( ) clean ( aggregate function ) ; final string call location = utils get call location name ( ) ; final string udf name = " all windowed stream " + call location ; final string op name ; final key selector < t , byte > key sel = input get key selector ( ) ; one input stream operator < t , r > operator ; if ( evictor ! = null ) { @ suppress warnings ( { " unchecked " , " rawtypes " } ) type serializer < stream record < t > > stream record serializer = ( type serializer < stream record < t > > ) new stream element serializer ( input get type ( ) create serializer ( get execution environment ( ) get config ( ) ) ) ; list state descriptor < stream record < t > > state desc = new list state descriptor < > ( " window - contents " , stream record serializer ) ; op name = " trigger window ( " + window assigner + " , " + state desc + " , " + trigger + " , " + evictor + " , " + udf name + " ) " ; operator = new evicting window operator < > ( window assigner , window assigner get window serializer ( get execution environment ( ) get config ( ) ) , key sel , input get key type ( ) create serializer ( get execution environment ( ) get config ( ) ) , state desc , new internal iterable all window function < > ( new aggregate apply all window function < > ( aggregate function , window function ) ) , trigger , evictor , allowed lateness , late data output tag ) ; } else { aggregating state descriptor < t , acc , v > state desc = new aggregating state descriptor < > ( " window - contents " , aggregate function , accumulator type create serializer ( get execution environment ( ) get config ( ) ) ) ; op name = " trigger window ( " + window assigner + " , " + state desc + " , " + trigger + " , " + udf name + " ) " ; operator = new window operator < > ( window assigner , window assigner get window serializer ( get execution environment ( ) get config ( ) ) , key sel , input get key type ( ) create serializer ( get execution environment ( ) get config ( ) ) , state desc , new internal single value all window function < > ( window function ) , trigger , allowed lateness , late data output tag ) ; } return input transform ( op name , result type , operator ) force non parallel ( ) ; }


public boolean is null ( ) { return ! has value ( ) ; }


resumes the thread this call is non - blocking

public void on resume ( ) { synchronized ( this ) { paused = false ; this notify all ( ) ; } }


get a thread - local typed bytes input for the supplied { @ link data input }

public static typed bytes input get ( data input in ) { typed bytes input bin = tb in get ( ) ; bin set data input ( in ) ; return bin ; }


to test special tags to test special tags and operation id starting with number

public void call 1 2 3test special tags test ( ) throws api exception { client client = null ; client response = api call 1 2 3test special tags ( client ) ; / / todo : test validations }


set whether to make the subscription shared the shared subscription name to be used can be specified through the " subscription name " property default is " false " set this to " true " to register a shared subscription , typically in combination with a " subscription name " value ( unless your message listener class name is good enough as subscription name ) note that shared subscriptions may also be durable , so this flag can ( and often will ) be combined with " subscription durable " as well only makes sense when listening to a topic ( pub - sub domain ) , therefore this method switches the " pub sub domain " flag as well < b > requires a jms 2 0 compatible message broker < b >

public void set subscription shared ( boolean subscription shared ) { this subscription shared = subscription shared ; if ( subscription shared ) { set pub sub domain ( true ) ; } }


public void test sample asciidoc markup generation from json with content ( ) { assert assert true ( markup content contains ( " = time @ work rest api " ) , " missing main header for api spec from json : " + markup content substring ( 0 , 100 ) ) ; }


called before the shard snapshot and finalize operations , on the data and master nodes this validates that the repository password on the master node that started the snapshot operation is identical to the repository password on the local node

private void validate local repository secret ( map < string , object > snapshot user metadata ) throws repository exception { assert snapshot user metadata ! = null ; assert snapshot user metadata get ( password hash user metadata key ) instanceof string ; final string master repository password id = ( string ) snapshot user metadata get ( password hash user metadata key ) ; if ( false = = master repository password id equals ( validated local repository password hash ) ) { assert snapshot user metadata get ( password salt user metadata key ) instanceof string ; final string master repository password id salt = ( string ) snapshot user metadata get ( password salt user metadata key ) ; final string computed repository password id ; try { computed repository password id = a e s key utils compute id ( a e s key utils generate password based key ( repository password , master repository password id salt ) ) ; } catch ( exception e ) { throw new repository exception ( metadata name ( ) , " unexpected fatal internal error " , e ) ; } if ( computed repository password id equals ( master repository password id ) ) { this validated local repository password hash = computed repository password id ; } else { throw new repository exception ( metadata name ( ) , " repository password mismatch the local node ' s repository password , from the keystore setting [ " + encrypted repository plugin encryption password setting get concrete setting for namespace ( encrypted repository plugin password name setting get ( metadata settings ( ) ) ) get key ( ) + " ] , is different compared to the elected master node ' s which started the snapshot operation " ) ; } } }


helper method called by { @ link # to string ( ) } in order to convert a single map key into a string this is protected to allow subclasses to override the appearance of a given key

protected string key to string ( long key ) { return long to string ( key ) ; }


get a copy of the map ( for diagnostics )

public map < string , string > get switch map ( ) { return null ; }


returns a list of stage execution and schedulers in a postorder representation of the tree

private list < stage execution and scheduler > create streaming linked stage executions ( session session , exchange locations consumer parent , streaming sub plan plan , function < partitioning handle , node partition map > partitioning cache , table write info table write info , optional < sql stage execution > parent stage execution , boolean summarize task info , remote task factory remote task factory , split source factory split source factory , int attempt id ) { immutable list builder < stage execution and scheduler > stage execution and schedulers = immutable list builder ( ) ; plan fragment id fragment id = plan get fragment ( ) get id ( ) ; stage id stage id = new stage id ( session get query id ( ) , fragment id get id ( ) ) ; sql stage execution stage execution = create sql stage execution ( new stage execution id ( stage id , attempt id ) , plan get fragment ( ) , remote task factory , session , summarize task info , node task map , executor , failure detector , scheduler stats , table write info ) ; partitioning handle partitioning handle = plan get fragment ( ) get partitioning ( ) ; list < remote source node > remote source nodes = plan get fragment ( ) get remote source nodes ( ) ; optional < int [ ] > bucket to partition = get bucket to partition ( partitioning handle , partitioning cache , plan get fragment ( ) get root ( ) , remote source nodes ) ; / / create child stages immutable set builder < sql stage execution > child stages builder = immutable set builder ( ) ; for ( streaming sub plan stage plan : plan get children ( ) ) { list < stage execution and scheduler > sub tree = create streaming linked stage executions ( session , stage execution : : add exchange locations , stage plan with bucket to partition ( bucket to partition ) , partitioning cache , table write info , optional of ( stage execution ) , summarize task info , remote task factory , split source factory , attempt id ) ; stage execution and schedulers add all ( sub tree ) ; child stages builder add ( get last ( sub tree ) get stage execution ( ) ) ; } set < sql stage execution > child stage executions = child stages builder build ( ) ; stage execution add state change listener ( new state - > { if ( new state is done ( ) ) { child stage executions for each ( sql stage execution : : cancel ) ; } } ) ; stage linkage stage linkage = new stage linkage ( fragment id , parent , child stage executions ) ; stage scheduler stage scheduler = create stage scheduler ( split source factory , session , plan , partitioning cache , parent stage execution , stage id , stage execution , partitioning handle , table write info , child stage executions ) ; stage execution and schedulers add ( new stage execution and scheduler ( stage execution , stage linkage , stage scheduler ) ) ; return stage execution and schedulers build ( ) ; }


public void test compression ratio standardization ( ) throws exception { assert equals ( 0 55f , compression emulation util standardize compression ratio ( 0 55f ) , 0 0d ) ; assert equals ( 0 65f , compression emulation util standardize compression ratio ( 0 652f ) , 0 0d ) ; assert equals ( 0 78f , compression emulation util standardize compression ratio ( 0 777f ) , 0 0d ) ; assert equals ( 0 86f , compression emulation util standardize compression ratio ( 0 855f ) , 0 0d ) ; }


bitmap cache get - > background thread hand - off - > multiplex - > bitmap cache - > decode - > branch on separate images - > thumbnail resize and rotate - > thumbnail branch - > local content thumbnail creation - > exif thumbnail creation - > local image resize and rotate - > add meta data producer - > multiplex - > encoded cache - > ( webp transcode ) - > local content uri fetch

private synchronized producer < closeable reference < closeable image > > get local content uri fetch sequence ( ) { if ( m local content uri fetch sequence = = null ) { local content uri fetch producer local content uri fetch producer = m producer factory new local content uri fetch producer ( ) ; thumbnail producer < encoded image > [ ] thumbnail producers = new thumbnail producer [ 2 ] ; thumbnail producers [ 0 ] = m producer factory new local content uri thumbnail fetch producer ( ) ; thumbnail producers [ 1 ] = m producer factory new local exif thumbnail producer ( ) ; m local content uri fetch sequence = new bitmap cache get to local transform sequence ( local content uri fetch producer , thumbnail producers ) ; } return m local content uri fetch sequence ; }


see { @ link # supports avoiding cast ( logical type , logical type ) }

public static boolean supports avoiding cast ( list < logical type > source types , list < logical type > target types ) { if ( source types size ( ) ! = target types size ( ) ) { return false ; } for ( int i = 0 ; i < source types size ( ) ; i + + ) { if ( ! supports avoiding cast ( source types get ( i ) , target types get ( i ) ) ) { return false ; } } return true ; }


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


the sort order for the values source ( e g - 1 for descending and 1 for ascending )

int reverse mul ( ) { assert reverse mul = = - 1 | | reverse mul = = 1 ; return reverse mul ; }


encode " - arch - " some occurances are from greek roots and therefore encode to ' k ' , others are from english words and therefore encode to ' x '

boolean encode arch ( ) { if ( string at ( ( m current - 2 ) , 4 , " arch " , " " ) ) { / / " - arch - " has many combining forms where " - ch - " = > k because of its / / derivation from the greek if ( ( ( is vowel ( m current + 2 ) & & string at ( ( m current - 2 ) , 5 , " archa " , " archi " , " archo " , " archu " , " archy " , " " ) ) | | string at ( ( m current - 2 ) , 6 , " archea " , " archeg " , " archeo " , " archet " , " archel " , " arches " , " archep " , " archem " , " archen " , " " ) | | ( string at ( ( m current - 2 ) , 4 , " arch " , " " ) & & ( ( ( m current + 1 ) = = m last ) ) ) | | string at ( 0 , 7 , " menarch " , " " ) ) & & ( ! root or inflections ( m in word , " arch " ) & & ! string at ( ( m current - 4 ) , 6 , " search " , " poarch " , " " ) & & ! string at ( 0 , 9 , " archenemy " , " archibald " , " archuleta " , " archambau " , " " ) & & ! string at ( 0 , 6 , " archer " , " archie " , " " ) & & ! ( ( ( ( string at ( ( m current - 3 ) , 5 , " larch " , " march " , " parch " , " " ) | | string at ( ( m current - 4 ) , 6 , " starch " , " " ) ) & & ! ( string at ( 0 , 6 , " eparch " , " " ) | | string at ( 0 , 7 , " nomarch " , " " ) | | string at ( 0 , 8 , " exilarch " , " hipparch " , " marchese " , " " ) | | string at ( 0 , 9 , " aristarch " , " " ) | | string at ( 0 , 9 , " marchetti " , " " ) ) ) | | root or inflections ( m in word , " starch " ) ) & & ( ! string at ( ( m current - 2 ) , 5 , " archu " , " archy " , " " ) | | string at ( 0 , 7 , " starchy " , " " ) ) ) ) ) { metaph add ( " k " , " x " ) ; } else { metaph add ( " x " ) ; } m current + = 2 ; return true ; } return false ; }


private void close view ( string url path ) { if ( url path equals ( close all open views ) ) { close all views ( ) ; return ; } / / close the named view url url = ghidra u r l to u r l ( url path ) ; close view ( url ) ; }


protected string encode access token ( final o auth 2 0 access token access token , final o auth 2 0 access token response result result ) { return o auth 2 0 jwt access token encoder builder ( ) access token ( access token ) registered service ( result get registered service ( ) ) service ( result get service ( ) ) access token jwt builder ( access token jwt builder ) cas properties ( cas properties ) build ( ) encode ( ) ; }


returns the { @ link per label options } to apply to the lto backend command line , if the compiled object matches the regular expression

public immutable list < per label options > get per file lto backend opts ( ) { return immutable list copy of ( cpp options per file lto backend opts ) ; }


public static boolean move ( final file src , final file dest ) { return move ( src , dest , null ) ; }


parse an integer located between 2 given offsets in a string

private static int parse int ( string value , int begin index , int end index ) throws number format exception { if ( begin index < 0 | | end index > value length ( ) | | begin index > end index ) { throw new number format exception ( value ) ; } / / use same logic as in integer parse int ( ) but less generic we ' re not supporting negative values int i = begin index ; int result = 0 ; int digit ; if ( i < end index ) { digit = character digit ( value char at ( i + + ) , 10 ) ; if ( digit < 0 ) { throw new number format exception ( " invalid number : " + value ) ; } result = - digit ; } while ( i < end index ) { digit = character digit ( value char at ( i + + ) , 10 ) ; if ( digit < 0 ) { throw new number format exception ( " invalid number : " + value ) ; } result * = 10 ; result - = digit ; } return - result ; }


duplicates this { @ link byte buf holder } be aware that this will not automatically call { @ link # retain ( ) }


sets the working directory to use , if any

public command line builder set working directory ( path working directory ) { this working directory = working directory ; return this ; }


gets principal attributes for multifactor authentication

protected principal get principal for multifactor authentication ( final authentication authentication ) { return authentication get principal ( ) ; }


gets the owner of a file in a way that should be supported by all filesystems that have a concept of file owner

public static string get file owner ( path path ) { try { file owner attribute view view = files get file attribute view ( path , file owner attribute view class ) ; return view get owner ( ) get name ( ) ; } catch ( i o exception e ) { throw new runtime exception ( e ) ; } }


returns a list of files that are referenced in the protobuf representation returned by { @ link # as stream proto ( build event context ) } this method is different from { @ code event reporting artifacts # reported artifacts ( ) } in that it only returns files directly referenced in the protobuf returned by { @ link # as stream proto ( build event context ) } note the consistency requirement - you must not attempt to pass path objects to the { @ link path converter } unless you have returned a corresponding { @ link local file } object here

default collection < local file > referenced local files ( ) { return immutable list of ( ) ; }


throws a { @ code s a x not recognized exception } exception when the given property does not signify a lexical handler the property name for a lexical handler is { @ code http : xml orgsaxpropertieslexical - handler }

public object get property ( string name ) throws s a x not recognized exception , s a x not supported exception { if ( " http : / / xml org / sax / properties / lexical - handler " equals ( name ) ) { return this lexical handler ; } else { throw new s a x not recognized exception ( name ) ; } }


asserts that { @ link player event listener # on position discontinuity ( int ) } was not called

public void assert no position discontinuities ( ) { assert that ( discontinuity reasons ) is empty ( ) ; }


private void run command ( ) throws i o exception { process builder builder = new process builder ( get exec string ( ) ) ; timer time out timer = null ; shell timeout timer task timeout timer task = null ; timed out set ( false ) ; completed set ( false ) ; / / remove all env vars from the builder to prevent leaking of env vars from / / the parent process if ( ! inherit parent env ) { builder environment ( ) clear ( ) ; } builder environment ( ) put all ( this environment ) ; if ( dir ! = null ) { builder directory ( this dir ) ; } builder redirect error stream ( redirect error stream ) ; if ( shell windows ) { synchronized ( windows process launch lock ) { / / to workaround the race condition issue with child processes / / inheriting unintended handles during process launch that can / / lead to hangs on reading output and error streams , we / / serialize process creation more info available at : / / http : / / support microsoft com / kb / 315939 process = builder start ( ) ; } } else { process = builder start ( ) ; } waiting thread = thread current thread ( ) ; child shells put ( this , null ) ; if ( time out interval > 0 ) { time out timer = new timer ( " shell command timeout " ) ; timeout timer task = new shell timeout timer task ( this ) ; / / one time scheduling time out timer schedule ( timeout timer task , time out interval ) ; } final buffered reader err reader = new buffered reader ( new input stream reader ( process get error stream ( ) , charset default charset ( ) ) ) ; buffered reader in reader = new buffered reader ( new input stream reader ( process get input stream ( ) , charset default charset ( ) ) ) ; final string buffer err msg = new string buffer ( ) ; / / read error and input streams as this would free up the buffers / / free the error stream buffer thread err thread = new thread ( ) { @ override public void run ( ) { try { string line = err reader read line ( ) ; while ( ( line ! = null ) & & ! is interrupted ( ) ) { err msg append ( line ) append ( system get property ( " line separator " ) ) ; line = err reader read line ( ) ; } } catch ( i o exception ioe ) { / / its normal to observe a " stream closed " i / o error on / / command timeouts destroying the underlying process / / so only log a warn if the command didn ' t time out if ( ! is timed out ( ) ) { log warn ( " error reading the error stream " , ioe ) ; } else { log debug ( " error reading the error stream due to shell " + " command timeout " , ioe ) ; } } } } ; try { err thread start ( ) ; } catch ( illegal state exception ise ) { } catch ( out of memory error oe ) { log error ( " caught " + oe + " one possible reason is that ulimit " + " setting of ' max user processes ' is too low if so , do " + " ' ulimit - u < larger num > ' and try again " ) ; throw oe ; } try { parse exec result ( in reader ) ; / / parse the output / / clear the input stream buffer string line = in reader read line ( ) ; while ( line ! = null ) { line = in reader read line ( ) ; } / / wait for the process to finish and check the exit code exit code = process wait for ( ) ; / / make sure that the error thread exits join thread ( err thread ) ; completed set ( true ) ; / / the timeout thread handling / / taken care in finally block if ( exit code ! = 0 ) { throw new exit code exception ( exit code , err msg to string ( ) ) ; } } catch ( interrupted exception ie ) { interrupted i o exception iie = new interrupted i o exception ( ie to string ( ) ) ; iie init cause ( ie ) ; throw iie ; } finally { if ( time out timer ! = null ) { time out timer cancel ( ) ; } / / close the input stream try { in reader close ( ) ; } catch ( i o exception ioe ) { log warn ( " error while closing the input stream " , ioe ) ; } if ( ! completed get ( ) ) { err thread interrupt ( ) ; join thread ( err thread ) ; } try { err reader close ( ) ; } catch ( i o exception ioe ) { log warn ( " error while closing the error stream " , ioe ) ; } process destroy ( ) ; waiting thread = null ; child shells remove ( this ) ; last time = time monotonic now ( ) ; } }


public void set alt a s t pointers ( left recursive rule r , rule a s t t ) { / / system out println ( " rule : " + t to string tree ( ) ) ; block a s t rule blk = ( block a s t ) t get first child with type ( a n t l r parser block ) ; alt a s t main alt = ( alt a s t ) rule blk get child ( 0 ) ; block a s t primary blk = ( block a s t ) main alt get child ( 0 ) ; block a s t ops blk = ( block a s t ) main alt get child ( 1 ) get child ( 0 ) ; / / ( * block ) for ( int i = 0 ; i < r rec primary alts size ( ) ; i + + ) { left recursive rule alt info alt info = r rec primary alts get ( i ) ; alt info alt a s t = ( alt a s t ) primary blk get child ( i ) ; alt info alt a s t left recursive alt info = alt info ; alt info original alt a s t left recursive alt info = alt info ; / / alt info original alt a s t parent = alt info alt a s t parent ; / / system out println ( alt info alt a s t to string tree ( ) ) ; } for ( int i = 0 ; i < r rec op alts size ( ) ; i + + ) { left recursive rule alt info alt info = r rec op alts get element ( i ) ; alt info alt a s t = ( alt a s t ) ops blk get child ( i ) ; alt info alt a s t left recursive alt info = alt info ; alt info original alt a s t left recursive alt info = alt info ; / / alt info original alt a s t parent = alt info alt a s t parent ; / / system out println ( alt info alt a s t to string tree ( ) ) ; } }


filter a bean - defined listener early through checking its generically declared event type before trying to instantiate it if this method returns { @ code true } for a given listener as a first pass , the listener instance will get retrieved and fully evaluated through a { @ link # supports event ( application listener , resolvable type , class ) } call afterwards

private boolean supports event ( configurable bean factory bean factory , string listener bean name , resolvable type event type ) { class < ? > listener type = bean factory get type ( listener bean name ) ; if ( listener type = = null | | generic application listener class is assignable from ( listener type ) | | smart application listener class is assignable from ( listener type ) ) { return true ; } if ( ! supports event ( listener type , event type ) ) { return false ; } try { bean definition bd = bean factory get merged bean definition ( listener bean name ) ; resolvable type generic event type = bd get resolvable type ( ) as ( application listener class ) get generic ( ) ; return ( generic event type = = resolvable type none | | generic event type is assignable from ( event type ) ) ; } catch ( no such bean definition exception ex ) { / / ignore - no need to check resolvable type for manually registered singleton return true ; } }


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

public base model view model on visibility state changed ( on model visibility state changed listener < base model view model , base model view > listener ) { on mutation ( ) ; this on model visibility state changed listener epoxy generated model = listener ; return this ; }


test that for a large batch write request , the limit is handled correctly

private void do test batch write ( int num delete , int num put , dynamo d b metadata store ms ) throws i o exception { path path = new path ( " / i test dynamo d b metadata store test batch write " + num delete + ' ' + num put ) ; final path root = file system make qualified ( path ) ; final path old dir = new path ( root , " old dir " ) ; final path new dir = new path ( root , " new dir " ) ; log info ( " do test batch write : old dir = { } , new dir = { } " , old dir , new dir ) ; thread current thread ( ) set name ( string format ( " bulk put = % d ; delete = % d " , num put , num delete ) ) ; ancestor state put state = check not null ( ms initiate bulk write ( bulk operation state operation type put , new dir ) , " no state from initiate bulk write ( ) " ) ; ms put ( new path metadata ( dir status ( old dir ) ) , put state ) ; ms put ( new path metadata ( dir status ( new dir ) ) , put state ) ; final list < path metadata > old metas = num delete < 0 ? null : new array list < > ( num delete ) ; for ( int i = 0 ; i < num delete ; i + + ) { old metas add ( new path metadata ( basic file status ( new path ( old dir , " child " + i ) , i , false ) ) ) ; } final list < path metadata > new metas = num put < 0 ? null : new array list < > ( num put ) ; for ( int i = 0 ; i < num put ; i + + ) { new metas add ( new path metadata ( basic file status ( new path ( new dir , " child " + i ) , i , false ) ) ) ; } collection < path > paths to delete = null ; if ( old metas ! = null ) { / / put all metadata of old paths and verify ms put ( new dir listing metadata ( old dir , old metas , false ) , unchanged entries , put state ) ; assert equals ( " child count " , 0 , ms list children ( new dir ) without tombstones ( ) num entries ( ) ) ; assertions assert that ( ms list children ( old dir ) get listing ( ) ) described as ( " old directory listing " ) contains exactly in any order elements of ( old metas ) ; assert true ( collection utils is equal collection ( old metas , ms list children ( old dir ) get listing ( ) ) ) ; paths to delete = new array list < > ( old metas size ( ) ) ; for ( path metadata meta : old metas ) { paths to delete add ( meta get file status ( ) get path ( ) ) ; } } / / move the old paths to new paths and verify ancestor state state = check not null ( ms initiate bulk write ( bulk operation state operation type put , new dir ) , " no state from initiate bulk write ( ) " ) ; assert equals ( " bulk write destination " , new dir , state get dest ( ) ) ; throttle tracker throttle tracker = new throttle tracker ( ms ) ; try ( duration info ignored = new duration info ( log , true , " move " ) ) { ms move ( paths to delete , new metas , state ) ; } log info ( " throttle status { } " , throttle tracker ) ; assert equals ( " number of children in source directory " , 0 , ms list children ( old dir ) without tombstones ( ) num entries ( ) ) ; if ( new metas ! = null ) { assertions assert that ( ms list children ( new dir ) get listing ( ) ) described as ( " directory listing " ) contains all ( new metas ) ; if ( ! new metas is empty ( ) ) { assertions assert that ( state size ( ) ) described as ( " size of ancestor state " ) is greater than ( new metas size ( ) ) ; } } }