return a string representation , as hexadecimal digits , of some hash of the directory the hash itself is computed according to the design document https : github combazelbuildproposalsblobmasterdesigns 2 0 1 8 - 07 - 13 - repository - hashing md and takes enough information into account , to detect the typical non - reproducibility of source - like repository rules , while leaving out what will change from invocation to invocation of a repository rule ( in particular file owners ) and can reasonably be ignored when considering if a repository is " the same source tree "

public string get directory digest ( ) throws i o exception { list < string > entries = new array list < string > ( file system get directory entries ( this ) ) ; collections sort ( entries ) ; hasher hasher = file system get digest function ( ) get hash function ( ) new hasher ( ) ; for ( string entry : entries ) { path path = this get child ( entry ) ; file status stat = path stat ( symlinks nofollow ) ; hasher put unencoded chars ( entry ) ; if ( stat is file ( ) ) { if ( path is executable ( ) ) { hasher put char ( ' x ' ) ; } else { hasher put char ( ' - ' ) ; } hasher put bytes ( digest utils get digest with manual fallback ( path , stat get size ( ) ) ) ; } else if ( stat is directory ( ) ) { hasher put char ( ' d ' ) put unencoded chars ( path get directory digest ( ) ) ; } else if ( stat is symbolic link ( ) ) { path fragment link = path read symbolic link ( ) ; if ( link is absolute ( ) ) { try { path resolved = path resolve symbolic links ( ) ; if ( resolved is file ( ) ) { if ( resolved is executable ( ) ) { hasher put char ( ' x ' ) ; } else { hasher put char ( ' - ' ) ; } hasher put bytes ( digest utils get digest with manual fallback when size unknown ( resolved ) ) ; } else { / / link to a non - file : include the link itself in the hash hasher put char ( ' l ' ) put unencoded chars ( link to string ( ) ) ; } } catch ( i o exception e ) { / / dangling link : include the link itself in the hash hasher put char ( ' l ' ) put unencoded chars ( link to string ( ) ) ; } } else { / / relative link : include the link itself in the hash hasher put char ( ' l ' ) put unencoded chars ( link to string ( ) ) ; } } else { / / neither file , nor directory , nor symlink so do not include further information / / in the hash , asuming it will not be used during the build anyway hasher put char ( ' s ' ) ; } } return hasher hash ( ) to string ( ) ; }


if any non - retriable exceptions were encountered during metadata update , clear and throw the exception this is used by the consumer to propagate any fatal exceptions or topic exceptions for any of the topics in the consumer ' s metadata

public synchronized void maybe throw any exception ( ) { clear errors and maybe throw exception ( this : : recoverable exception ) ; }


set the query for selecting documents from the source indices

public reindex request set source query ( query builder query builder ) { if ( query builder ! = null ) { this get search request ( ) source ( ) query ( query builder ) ; } return this ; }


set the container id - to - exception map in which the exception indicates error from each container for failed requests

public abstract void set failed requests ( map < container id , serialized exception > failed requests ) ;


executes the provided action on the current thread returns the action execution value with the result , either computed here or already computed on another thread

action execution value execute action ( environment env , action action , action metadata handler metadata handler , long action start time , action lookup data action lookup data , artifact expander artifact expander , immutable map < artifact , immutable list < fileset output symlink > > expanded filesets , immutable map < artifact , immutable list < fileset output symlink > > top level filesets , @ nullable file system action file system , @ nullable object skyframe deps result , action postprocessing postprocessing , boolean has discovered inputs ) throws action execution exception , interrupted exception { if ( action file system ! = null ) { update action file system context ( action , action file system , env , metadata handler , expanded filesets ) ; } action execution context action execution context = get context ( env , action , metadata handler , artifact expander , top level filesets , action file system , skyframe deps result ) ; if ( action cache checker is action execution prohibited ( action ) ) { / / we can ' t execute an action ( e g because - - check ? ? ? up to date option was used ) fail the / / build instead string message = action pretty print ( ) + " is not up - to - date " ; detailed exit code code = create detailed exit code ( message , code action not up to date ) ; action execution exception e = new action execution exception ( message , action , false , code ) ; event error = event error ( e get message ( ) ) ; synchronized ( reporter ) { reporter handle ( error ) ; } record execution error ( ) ; throw e ; } / / use compute if absent to handle concurrent attempts to execute the same shared action action execution state active action = build action map compute if absent ( new ownerless artifact wrapper ( action get primary output ( ) ) , ( unused key ) - > new action execution state ( action lookup data , new action runner ( action , metadata handler , action start time , action execution context , action lookup data , postprocessing ) ) ) ; shared action callback callback = get shared action callback ( env get listener ( ) , has discovered inputs , action , action lookup data ) ; action execution value result = null ; action execution exception final exception = null ; try { result = active action get result or depend on future ( env , action lookup data , action , callback ) ; } catch ( action execution exception e ) { final exception = e ; } if ( result ! = null | | final exception ! = null ) { close context ( action execution context , action , final exception ) ; } return result ; }


specifies a width for a specific edge note : having a border effect with varying widths per edge is currently not supported

public builder width px ( yoga edge edge , @ px int width ) { check not built ( ) ; m border set edge width ( edge , width ) ; return this ; }


this resets the mass properties to the sum of the mass properties of the fixtures this normally does not need to be called unless you called set mass data to override the mass and you later want to reset the mass

public void reset mass data ( ) { jni reset mass data ( addr ) ; }


ensures that the default header will pass ok http 3 ' s checks for header values

static string get sanitized user agent ( ) { string default user agent = system get property ( " http agent " ) ; if ( text utils is empty ( default user agent ) ) { return default user agent ; } int length = default user agent length ( ) ; string builder sb = new string builder ( default user agent length ( ) ) ; for ( int i = 0 ; i < length ; i + + ) { char c = default user agent char at ( i ) ; if ( ( c > ' \ u 0 0 1f ' | | c = = ' \ t ' ) & & c < ' \ u 0 0 7f ' ) { sb append ( c ) ; } else { sb append ( ' ? ' ) ; } } return sb to string ( ) ; }


deletes any state in the { @ code context } when the window expires ( the watermark passes its { @ code max timestamp } + { @ code allowed lateness } )

public void clear ( context context ) throws exception { }


public type list with added type ( type type ) { int sz = size ( ) ; std type list result = new std type list ( sz + 1 ) ; for ( int i = 0 ; i < sz ; i + + ) { result set 0 ( i , get 0 ( i ) ) ; } result set ( sz , type ) ; result set immutable ( ) ; return result ; }


returns a list of { @ link media period id } s , with one element for each created media period

public list < media period id > get created media periods ( ) { return created media periods ; }


this is a helper function for launching a set of servers

protected servers launch servers ( int num servers , int num observers , integer tick time , map < string , string > other configs ) throws i o exception , interrupted exception { int server count = num servers + num observers ; quorum peer main test servers svrs = new quorum peer main test servers ( ) ; svrs client ports = new int [ server count ] ; string builder sb = new string builder ( ) ; for ( int i = 0 ; i < server count ; i + + ) { svrs client ports [ i ] = port assignment unique ( ) ; string role = i < num servers ? " participant " : " observer " ; sb append ( string format ( " server % d = 127 0 0 1 : % d : % d : % s ; 127 0 0 1 : % d \ n " , i , port assignment unique ( ) , port assignment unique ( ) , role , svrs client ports [ i ] ) ) ; } string quorum cfg section = sb to string ( ) ; svrs mt = new main thread [ server count ] ; svrs zk = new zoo keeper [ server count ] ; for ( int i = 0 ; i < server count ; i + + ) { if ( tick time ! = null ) { svrs mt [ i ] = new main thread ( i , svrs client ports [ i ] , quorum cfg section , other configs , tick time ) ; } else { svrs mt [ i ] = new main thread ( i , svrs client ports [ i ] , quorum cfg section , other configs ) ; } svrs mt [ i ] start ( ) ; svrs restart client ( i , this ) ; } wait for all ( svrs , zoo keeper states connected ) ; return svrs ; }


public boolean is fixed rotation ( ) { return body is fixed rotation ( ) ; }


< code > optional int 6 4 num = 4 ; < code >

public builder clear num ( ) { bit field 0 = ( bit field 0 & ~ 0x 0 0 0 0 0 0 0 8 ) ; num = 0l ; on changed ( ) ; return this ; }


public list < entry < k , v > > sub list ( int from index , int to index ) { throw new unsupported operation exception ( ) ; }


public object get anytype 3 ( ) { return anytype 3 ; }


a convenience method to check if there ' s some security restrictions in place

public boolean is use security ( ) { return security realm ! = security realm no authentication | | authorization strategy ! = authorization strategy unsecured ; }


message displayed in the top page can be null includes html

public string get description ( ) { return description ; }


returns the library identifier of an artifact : a string that is different for different libraries , but is the same for the shared , static and pic versions of the same library

public static string library identifier of ( artifact library artifact ) { string name = library artifact get root relative path ( ) get path string ( ) ; string basename = file system utils remove extension ( name ) ; / / need to special - case file types with double extension return name ends with ( " pic a " ) ? file system utils remove extension ( basename ) : name ends with ( " nopic a " ) ? file system utils remove extension ( basename ) : name ends with ( " pic lo " ) ? file system utils remove extension ( basename ) : basename ; }


variant of { @ link # set cors configurations ( map ) } to register one mapping at a time

public void register cors configuration ( string pattern , cors configuration config ) { this cors configurations put ( this pattern parser parse ( pattern ) , config ) ; }


tests purge where the data directory contains old snapshots and data logs , newest snapshots and data logs , ( newest + n ) snapshots and data logs

public void test snap files greater than to retain ( ) throws exception { int n recent count = 4 ; int file above recent count = 4 ; int file to purge count = 2 ; atomic integer offset = new atomic integer ( 0 ) ; file version 2 = new file ( tmp dir to string ( ) , " version - 2 " ) ; assert true ( version 2 mkdir ( ) , " failed to create version 2 dir : " + version 2 to string ( ) ) ; list < file > snaps to purge = new array list < file > ( ) ; list < file > logs to purge = new array list < file > ( ) ; list < file > snaps = new array list < file > ( ) ; list < file > logs = new array list < file > ( ) ; list < file > snaps above recent files = new array list < file > ( ) ; list < file > logs above recent files = new array list < file > ( ) ; create data dir files ( offset , file to purge count , false , version 2 , snaps to purge , logs to purge ) ; create data dir files ( offset , n recent count , false , version 2 , snaps , logs ) ; logs add ( logs to purge remove ( 0 ) ) ; / / log that precedes first retained snapshot is also retained create data dir files ( offset , file above recent count , false , version 2 , snaps above recent files , logs above recent files ) ;


by default , when restoring from a checkpoint savepoint , the consumer always ignores restored partitions that are no longer associated with the current specified topics or topic pattern to subscribe to this method configures the consumer to not filter the restored partitions , therefore always attempting to consume whatever partition was present in the previous execution regardless of the specified topics to subscribe to in the current execution

public flink kafka consumer base < t > disable filter restored partitions with subscribed topics ( ) { this filter restored partitions with current topics descriptor = false ; return this ; }


signals to perform an update see the class header for the usage of the various update methods

public void update now ( ) { super update now ( ) ; }


return the access key and secret for obs api use credentials may exist in configuration , within credential providers or indicated in the user info of the name uri param

static o b s login helper login get o b s access keys ( final uri name , final configuration conf ) throws i o exception { o b s login helper login login = o b s login helper extract login details with warnings ( name ) ; configuration c = provider utils exclude incompatible credential providers ( conf , o b s file system class ) ; string access key = get password ( c , o b s constants access key , login get user ( ) ) ; string secret key = get password ( c , o b s constants secret key , login get password ( ) ) ; string session token = get password ( c , o b s constants session token , login get token ( ) ) ; return new o b s login helper login ( access key , secret key , session token ) ; }


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


protected void reset u g i ( ) { user group information reset ( ) ; }


confirm that we don ' t send the proxy - authorization header from the request to the proxy server we used to have that behavior but it is problematic because unrelated requests end up sharing credentials worse , that approach leaks proxy credentials to the origin server

@ test public void no preemptive proxy authorization ( ) throws exception { server use https ( handshake certificates ssl socket factory ( ) , true ) ; server enqueue ( new mock response ( ) set socket policy ( socket policy upgrade to ssl at end ) clear headers ( ) ) ; server enqueue ( new mock response ( ) set body ( " response body " ) ) ; client = client new builder ( ) ssl socket factory ( handshake certificates ssl socket factory ( ) , handshake certificates trust manager ( ) ) proxy ( server to proxy address ( ) ) hostname verifier ( new recording hostname verifier ( ) ) build ( ) ; request request = new request builder ( ) url ( " https : / / android com / foo " ) header ( " proxy - authorization " , " password " ) build ( ) ; response response = client new call ( request ) execute ( ) ; assert that ( response body ( ) string ( ) ) is equal to ( " response body " ) ; recorded request connect 1 = server take request ( ) ; assert that ( connect 1 get header ( " proxy - authorization " ) ) is null ( ) ; recorded request connect 2 = server take request ( ) ; assert that ( connect 2 get header ( " proxy - authorization " ) ) is equal to ( " password " ) ; }


return the configured timeout value in milliseconds

final long get timeout value ( ) { return this timeout value ; }


adds a route to the given handler function that handles all http { @ code put } requests that match the given predicate

builder put ( request predicate predicate , handler function < server response > handler function ) ;


is the source empty ( not available ) or not

public boolean is source empty ( ) { return source = = null ; }


public test endpoint parameters oper resp spec ( consumer < response spec builder > resp spec customizer ) { resp spec customizer accept ( resp spec ) ; return this ; }


returns specified application cache directory cache directory will be created on sd card by defined path if card is mounted and app has appropriate permission else - android defines cache directory on device ' s file system

public static file get own cache directory ( context context , string cache dir , boolean prefer external ) { file app cache dir = null ; if ( prefer external & & media mounted equals ( environment get external storage state ( ) ) & & has external storage permission ( context ) ) { app cache dir = new file ( environment get external storage directory ( ) , cache dir ) ; } if ( app cache dir = = null | | ( ! app cache dir exists ( ) & & ! app cache dir mkdirs ( ) ) ) { app cache dir = context get cache dir ( ) ; } return app cache dir ; }


applies an aggregation that gives the current sum of the data stream at the given field by the given key an independent aggregate is kept per key

public single output stream operator < t > sum ( string field ) { return aggregate ( new sum aggregator < > ( field , get type ( ) , get execution config ( ) ) ) ; }


convenience method for setting the children for this datanode

public synchronized void set children ( hash set < string > children ) { this children = children ; }


sets the name of the watch to be deleted

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


set the value of the ' { @ code accept charset } ' attribute may be a runtime expression

public void set accept charset ( string accept charset ) { this accept charset = accept charset ; }


triggers { @ link # refresh ( ) } if not refreshed in the concrete context ' s constructor already

public void after properties set ( ) { if ( ! is active ( ) ) { refresh ( ) ; } }


void show add block dialog ( ) { add block model model = new add block model ( tool , program ) ; add block dialog d = new add block dialog ( model ) ; d show dialog ( tool ) ; }


get number of units in a group a group may represent multiple units shown as one entity this format does not support groups

public int get group size ( ) { return 1 ; }


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


look up a descriptor index from a type index cheaper than : { @ code open ( table of contents type ids off + ( index size of type id item ) ) read int ( ) ; }

public int descriptor index from type index ( int type index ) { check bounds ( type index , table of contents type ids size ) ; int position = table of contents type ids off + ( size of type id item * type index ) ; return data get int ( position ) ; }


public void set ( int n , cst type exception type , int handler ) { set 0 ( n , new entry ( exception type , handler ) ) ; }


registers a module to be returned in the { @ link # registered modules ( ) } string

public static synchronized void register module ( string name ) { if ( registered modules add ( name ) ) { registered modules string = registered modules string + " , " + name ; } }


test that the exception arose in the thread pool will rethrow to the main thread

public void test multi thread upload thread pool exception rethrow ( ) throws i o exception { specified exception expected exception = new specified exception ( " throw exception while multi thread upload states " ) ; checkpoint stream factory checkpoint state output stream output stream = create failing checkpoint state output stream ( expected exception ) ; checkpoint stream factory checkpoint stream factory = ( checkpointed state scope scope ) - > output stream ; file file = temporary folder new file ( string value of ( uuid random u u i d ( ) ) ) ; generate random file content ( file get path ( ) , 20 ) ; map < state handle i d , path > file paths = new hash map < > ( 1 ) ; file paths put ( new state handle i d ( " mock handle i d " ) , file to path ( ) ) ; try ( rocks d b state uploader rocks d b state uploader = new rocks d b state uploader ( 5 ) ) { rocks d b state uploader upload files to checkpoint fs ( file paths , checkpoint stream factory , new closeable registry ( ) ) ; fail ( ) ; } catch ( exception e ) { assert equals ( expected exception , e ) ; } }


returns the byte array of on - heap memory segments

public byte [ ] get array ( ) { if ( heap memory ! = null ) { return heap memory ; } else { throw new illegal state exception ( " memory segment does not represent heap memory " ) ; } }


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


< code > optional aapt pb style style = 2 ; < code >

public com android aapt resources style get style ( ) { return style = = null ? com android aapt resources style get default instance ( ) : style ; }


public string get id ( ) { return id ; }


public long get pet id ( ) { return pet id ; }


resource profile get resource profile ( ) ;


get the settings object value at the given address

public settings get settings ( address addr ) ;


tests that interned cipher suite instances remain the case across garbage collections , even if the string used to construct them is no longer strongly referenced outside of the cipher suite

@ test public void instances are interned survives garbage collection ( ) { / / we ' re not holding onto a reference to this string instance outside of the cipher suite cipher suite cs = for java name ( new string ( " fake cipher suite instances are interned " ) ) ; system gc ( ) ; / / unless cs references the string instance , it may now be garbage collected assert that ( for java name ( new string ( cs java name ( ) ) ) ) is same as ( cs ) ; }


overridden version which checks for servlet context resource and uses { @ code servlet context get resource paths } to find matching resources below the web application root directory in case of other resources , delegates to the superclass version

protected set < resource > do find path matching file resources ( resource root dir resource , string sub pattern ) throws i o exception { if ( root dir resource instanceof servlet context resource ) { servlet context resource sc resource = ( servlet context resource ) root dir resource ; servlet context sc = sc resource get servlet context ( ) ; string full pattern = sc resource get path ( ) + sub pattern ; set < resource > result = new linked hash set < > ( 8 ) ; do retrieve matching servlet context resources ( sc , full pattern , sc resource get path ( ) , result ) ; return result ; } else { return super do find path matching file resources ( root dir resource , sub pattern ) ; } }


the last value the measure funcion associated with this node { @ link component } returned for the width this is used together with { @ link internal node # get last width spec ( ) } to implement measure caching

public float get last measured width ( ) { return m last measured width ; }


persisting model class into database happens here but first { @ link # before save ( lite pal support , java util list , android content content values ) } will be called to put the values for content values when the model is saved , { @ link # after save ( lite pal support , java util list , java util list , long ) } will be called to do stuffs after model is saved note that save support won ' t help with id any developer who wants to set value to id will be ignored here the value of id will be generated by s q lite automatically

private void do save action ( lite pal support base obj , list < field > supported fields , list < field > supported generic fields ) throws security exception , illegal argument exception , no such method exception , illegal access exception , invocation target exception { values clear ( ) ; before save ( base obj , supported fields , values ) ; long id = saving ( base obj , values ) ; after save ( base obj , supported fields , supported generic fields , id ) ; }


public void map map anytype test ( ) { / / todo : test map map anytype }


test reading a unsigned leb128 that is just 1 bit too large for a java 64 bit long int

public void test toolarge unsigned ( ) throws i o exception { byte [ ] bytes = new byte [ ] { ( byte ) 0xff , ( byte ) 0xff , ( byte ) 0xff , ( byte ) 0xff , ( byte ) 0xff , ( byte ) 0xff , ( byte ) 0xff , ( byte ) 0xff , ( byte ) 0xff , ( byte ) 0x 0 2 } ; try { long value = leb128 decode ( bytes , false ) ; assert fail ( " should not be able to read a leb128 that is larger than what can fit in java 6 4bit long int : " + value ) ; } catch ( i o exception ioe ) { / / good } }


returns specified application cache directory cache directory will be created on sd card by defined path if card is mounted and app has appropriate permission else - android defines cache directory on device ' s file system

public static file get own cache directory ( context context , string cache dir ) { file app cache dir = null ; if ( media mounted equals ( environment get external storage state ( ) ) & & has external storage permission ( context ) ) { app cache dir = new file ( environment get external storage directory ( ) , cache dir ) ; } if ( app cache dir = = null | | ( ! app cache dir exists ( ) & & ! app cache dir mkdirs ( ) ) ) { app cache dir = context get cache dir ( ) ; } return app cache dir ; }


public string type ( ) { return this type ; }


checks the given program for changes and performs the save if necessary the user is prompted before the save is performed

boolean can close ( program program ) { if ( program = = null | | ( program get domain file ( ) get consumers ( ) size ( ) > 1 & & ! tool has tool listeners ( ) ) ) { return true ; } if ( acquire save lock ( program , " close " ) ) { try { return handle changed program ( program ) ; } finally { program unlock ( ) ; } } return false ; }


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


returns true if a and b are equal , whether or not either of them are null

private static boolean equals handles nulls ( local item a , local item b ) { return ( a = = b ) | | ( ( a ! = null ) & & a equals ( b ) ) ; }


public void start ( ) throws i o exception { log debug ( " initiating embedded kafka cluster startup " ) ; log debug ( " starting a zoo keeper instance " ) ; zookeeper = new embedded zookeeper ( ) ; log debug ( " zoo keeper instance is running at { } " , z k connect string ( ) ) ; broker config put ( kafka config $ module $ zk connect prop ( ) , z k connect string ( ) ) ; broker config put ( kafka config $ module $ port prop ( ) , default broker port ) ; put if absent ( broker config , kafka config $ module $ delete topic enable prop ( ) , true ) ; put if absent ( broker config , kafka config $ module $ log cleaner dedupe buffer size prop ( ) , 2 * 1024 * 1024l ) ; put if absent ( broker config , kafka config $ module $ group min session timeout ms prop ( ) , 0 ) ; put if absent ( broker config , kafka config $ module $ group initial rebalance delay ms prop ( ) , 0 ) ; put if absent ( broker config , kafka config $ module $ offsets topic replication factor prop ( ) , ( short ) 1 ) ; put if absent ( broker config , kafka config $ module $ offsets topic partitions prop ( ) , 5 ) ; put if absent ( broker config , kafka config $ module $ transactions topic partitions prop ( ) , 5 ) ; put if absent ( broker config , kafka config $ module $ auto create topics enable prop ( ) , true ) ; for ( int i = 0 ; i < brokers length ; i + + ) { broker config put ( kafka config $ module $ broker id prop ( ) , i ) ; log debug ( " starting a kafka instance on port { } " , broker config get ( kafka config $ module $ port prop ( ) ) ) ; brokers [ i ] = new kafka embedded ( broker config , time ) ; log debug ( " kafka instance is running at { } , connected to zoo keeper at { } " , brokers [ i ] broker list ( ) , brokers [ i ] zookeeper connect ( ) ) ; } }


optional : if specified , only support the specified cipher list otherwise default to the default cipher list supported by envoy < code > repeated string cipher suites = 9 ; < code >

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


args : : = kafka prop file name command disable auto terminate command : = " run " | " process "

public static void main ( final string [ ] args ) throws i o exception { if ( args length < 2 ) { system err println ( " streams smoke test are expecting two parameters : prop file , command ; but only see " + args length + " parameter " ) ; exit exit ( 1 ) ; } final string prop file name = args [ 0 ] ; final string command = args [ 1 ] ; final boolean disable auto terminate = args length > 2 ; final properties streams properties = utils load props ( prop file name ) ; final string kafka = streams properties get property ( streams config bootstrap servers config ) ; final string processing guarantee = streams properties get property ( streams config processing guarantee config ) ; if ( kafka = = null ) { system err println ( " no bootstrap kafka servers specified in " + streams config bootstrap servers config ) ; exit exit ( 1 ) ; } if ( " process " equals ( command ) ) { if ( ! streams config at least once equals ( processing guarantee ) & & ! streams config exactly once equals ( processing guarantee ) ) { system err println ( " processing guarantee must be either " + streams config at least once + " or " + streams config exactly once ) ; exit exit ( 1 ) ; } } system out println ( " streams test instance started ( streams smoke test ) " ) ; system out println ( " command = " + command ) ; system out println ( " props = " + streams properties ) ; system out println ( " disable auto terminate = " + disable auto terminate ) ; switch ( command ) { case " run " : / / this starts the driver ( data generation and result verification ) final int num keys = 10 ; final int max records per key = 500 ; if ( disable auto terminate ) { generate perpetually ( kafka , num keys , max records per key ) ; } else { / / slow down data production to span 30 seconds so that system tests have time to / / do their bounces , etc final map < string , set < integer > > all data = generate ( kafka , num keys , max records per key , duration of seconds ( 30 ) ) ; smoke test driver verify ( kafka , all data , max records per key ) ; } break ; case " process " : / / this starts the stream processing app new smoke test client ( uuid random u u i d ( ) to string ( ) ) start ( streams properties ) ; break ; default : system out println ( " unknown command : " + command ) ; } }


get x attr by name with prefix will unpack the byte [ ] until find the specific x attr

static x attr get x attr ( byte [ ] attrs , string prefixed name ) { if ( prefixed name = = null | | attrs = = null ) { return null ; } x attr x attr = x attr helper build x attr ( prefixed name ) ; for ( int i = 0 ; i < attrs length ; ) { / / big - endian int v = ints from bytes ( attrs [ i ] , attrs [ i + 1 ] , attrs [ i + 2 ] , attrs [ i + 3 ] ) ; i + = 4 ; x attr name space namespace = x attr format get namespace ( v ) ; string name = x attr format get name ( v ) ; int vlen = ( ( 0xff & attrs [ i ] ) < < 8 ) | ( 0xff & attrs [ i + 1 ] ) ; i + = 2 ; if ( x attr get name space ( ) = = namespace & & x attr get name ( ) equals ( name ) ) { if ( vlen > 0 ) { byte [ ] value = new byte [ vlen ] ; system arraycopy ( attrs , i , value , 0 , vlen ) ; return new x attr builder ( ) set name space ( namespace ) set name ( name ) set value ( value ) build ( ) ; } return x attr ; } i + = vlen ; } return null ; }


this implementation delegates to a savepoint manager for the underlying transaction , if possible

public void rollback to savepoint ( object savepoint ) throws transaction exception { get savepoint manager ( ) rollback to savepoint ( savepoint ) ; }


returns true if the path component ( i e directory ) of this uri is absolute

public boolean is uri path absolute ( ) { int start = start position without windows drive ( uri get path ( ) ) ; return uri get path ( ) starts with ( separator , start ) ; }


return true if this additional properties boolean object is equal to o

public boolean equals ( object o ) { if ( this = = o ) { return true ; } if ( o = = null | | get class ( ) ! = o get class ( ) ) { return false ; } additional properties boolean additional properties boolean = ( additional properties boolean ) o ; return objects equals ( this name , additional properties boolean name ) & & objects equals ( this additional properties , additional properties boolean additional properties ) & & super equals ( o ) ; }


public offset date time get date time ( ) { return date time ; }


resolve the target class to convert the payload to by default this is simply { @ link method parameter # get parameter type ( ) } but that can be overridden to select a more specific target type after also taking into account the " content - type " , e g return { @ code string } if target type is { @ code object } and { @ code " content - type : text " }

protected class < ? > resolve target class ( method parameter parameter , message < ? > message ) { return parameter get parameter type ( ) ; }


emits an on complete signal or an on error signal with the given error or indicates the concurrently running on next should do that

public static void on complete ( observer < ? > observer , atomic integer wip , atomic throwable errors ) { if ( wip get and increment ( ) = = 0 ) { errors try terminate consumer ( observer ) ; } }


returns the relatively qualified name for < var > file suffix < var > e g for a file suffix = ' foo xml ' , this method will return ' aspect j auto proxy creator tests - foo xml '

private string q name ( string file suffix ) { return string format ( " % s - % s " , get class ( ) get simple name ( ) , file suffix ) ; }


public data output buffer get key ( ) { return raw key ; }


displays the given address set in a table , in a dialog this method is unavailable in headless mode

public void show ( string title , address set view addresses ) throws improper use exception { if ( is running headless ( ) ) { throw new improper use exception ( " the show ( ) method can only be used when running headed ghidra " ) ; } plugin tool tool = state get tool ( ) ; if ( tool = = null ) { return ; } table service ts = tool get service ( table service class ) ; if ( ts = = null ) { println ( " unable to show addresses , no table service exists " ) ; return ; } show ( title , ts , addresses ) ; }


fulfills { @ link com google devtools build lib actions abstract action # get raw progress message ( ) }


register a custom , serializable user configuration object

public void set global job parameters ( global job parameters global job parameters ) { preconditions check not null ( global job parameters , " global job parameters shouldn ' t be null " ) ; this global job parameters = global job parameters ; }


gets the hostname of the task manager based on the network address

public static string get host name ( inet address inet address ) { string host name ; string fqdn host name = get fqdn host name ( inet address ) ; if ( fqdn host name equals ( inet address get host address ( ) ) ) { / / this happens when the name lookup fails , either due to an exception , / / or because no hostname can be found for the address / / take ip textual representation host name = fqdn host name ; log warn ( " no hostname could be resolved for the ip address { } , using ip address as host name " + " local input split assignment ( such as for hdfs files ) may be impacted " , inet address get host address ( ) ) ; } else { host name = net utils get hostname from f q d n ( fqdn host name ) ; } return host name ; }


opens the the program by the given name the path can be a simple name or a relative or absolute path to the file within the project

public program open program ( string file path ) throws exception { domain file df = get domain file ( file path ) ; if ( df = = null ) { throw new illegal argument exception ( " domain file not in project you must first call add domain file ( name ) " ) ; } program p = open program ( df ) ; return p ; }


public void set category id ( long category id ) { this category id = category id ; }


add { @ link pool chunk } and { @ code handle } to the cache if there is enough room returns { @ code true } if it fit into the cache { @ code false } otherwise

boolean add ( pool arena < ? > area , pool chunk chunk , byte buffer nio buffer , long handle , int norm capacity , size class size class ) { int size idx = area size 2 size idx ( norm capacity ) ; memory region cache < ? > cache = cache ( area , size idx , size class ) ; if ( cache = = null ) { return false ; } return cache add ( chunk , nio buffer , handle , norm capacity ) ; }


go to the given address ; update the last address so that iterator will be adjusted for next and previous

private void go to ( address p 1 address ) { p 1 current address = p 1 address ; location changed ( p 1 current address ) ; }


supply a drawable that is to be rendered on top of the contents of this image view

public void set foreground ( drawable drawable ) { if ( foreground ! = drawable ) { if ( foreground ! = null ) { foreground set callback ( null ) ; unschedule drawable ( foreground ) ; } foreground = drawable ; if ( foreground ! = null ) { foreground set bounds ( 0 , 0 , get width ( ) , get height ( ) ) ; set will not draw ( false ) ; foreground set callback ( this ) ; if ( foreground is stateful ( ) ) { foreground set state ( get drawable state ( ) ) ; } } else { set will not draw ( true ) ; } invalidate ( ) ; } }


returns an { @ link executor service } for parallel tasks the number of threads in the thread - pool is set by fs s 3a committer threads if num - threads is 0 , this will raise an exception

private synchronized executor service build thread pool ( job context context , int num threads ) { preconditions check argument ( num threads > 0 , " cannot create a thread pool with no threads " ) ; if ( thread pool = = null ) { log debug ( " { } : creating thread pool of size { } " , get role ( ) , num threads ) ; thread pool = hadoop executors new fixed thread pool ( num threads , new thread factory builder ( ) set daemon ( true ) set name format ( thread prefix + context get job i d ( ) + " - % d " ) build ( ) ) ; } return thread pool ; }


in order to be able to draw over other apps , the permission android permission system alert window have to be granted on < api 23 ( marsh mallow ) the permission was granted when the user installed the application ( via android manifest ) , on > 23 , however , it have to start a activity asking the user if he agrees this method just return if the app has permission to draw over other apps , and if it doesn ' t , it will try to get the permission

public static boolean check system alert window permission ( final context context ) { if ( ! settings can draw overlays ( context ) ) { final intent i = new intent ( settings action manage overlay permission , uri parse ( " package : " + context get package name ( ) ) ) ; i add flags ( intent flag activity new task ) ; try { context start activity ( i ) ; } catch ( final activity not found exception ignored ) { } return false ; } else { return true ; } }


abstract factory pattern for wrapping an { @ link s s l engine } object this is useful for npnapln support

s s l engine wrap ssl engine ( s s l engine engine , jdk application protocol negotiator application negotiator , boolean is server ) ;


given an argv array such as might be passed to execve ( 2 ) , returns a string that can be copied and pasted into a bourne shell for a similar effect

public static string pretty print argv ( list < string > argv ) { string builder buf = new string builder ( ) ; for ( string arg : argv ) { if ( buf length ( ) > 0 ) { buf append ( ' ' ) ; } buf append ( shell escape ( arg ) ) ; } return buf to string ( ) ; }


removes a pending slot request identified by the given allocation id from a slot identified by the given slot id

private void remove slot request from slot ( slot i d slot id , allocation i d allocation id ) { task manager slot task manager slot = slots get ( slot id ) ; if ( null ! = task manager slot ) { if ( task manager slot get state ( ) = = slot state pending & & objects equals ( allocation id , task manager slot get assigned slot request ( ) get allocation id ( ) ) ) { task manager registration task manager registration = task manager registrations get ( task manager slot get instance id ( ) ) ; if ( task manager registration = = null ) { throw new illegal state exception ( " trying to remove slot request from slot for which there is no task manager " + task manager slot get instance id ( ) + " is registered " ) ; } / / clear the pending slot request task manager slot clear pending slot request ( ) ; update slot state ( task manager slot , task manager registration , null , null ) ; } else { log debug ( " ignore slot request removal for slot { } " , slot id ) ; } } else { log debug ( " there was no slot with { } registered probably this slot has been already freed " , slot id ) ; } }


public put index template request source ( byte [ ] source , x content type x content type ) { return source ( source , 0 , source length , x content type ) ; }


return { @ code true } if { @ code sun misc unsafe } was found on the classpath and can be used for accelerated direct memory access

public static boolean has unsafe ( ) { return unsafe unavailability cause = = null ; }


return a command line to execute the given command in the os shell

protected string [ ] get run command for other ( string command , configuration config ) { list < string > ret command = new array list < > ( ) ; boolean container sched priority is set = false ; int container sched priority adjustment = yarn configuration default nm container executor sched priority ; if ( config get ( yarn configuration nm container executor sched priority ) ! = null ) { container sched priority is set = true ; container sched priority adjustment = config get int ( yarn configuration nm container executor sched priority , yarn configuration default nm container executor sched priority ) ; } if ( container sched priority is set ) { ret command add all ( arrays as list ( " nice " , " - n " , integer to string ( container sched priority adjustment ) ) ) ; } ret command add all ( arrays as list ( " bash " , command ) ) ; return ret command to array ( new string [ ret command size ( ) ] ) ; }


set the plus - or - minus variance percentage of the network round trip delay

public void set variance percent ( int variance percent ) { check percentage validity ( variance percent , " variance percentage must be between 0 and 100 " ) ; this variance percent = variance percent ; }


test rowtime temporal join when set idle state retention

public void test row time temporal join with state retention ( ) throws exception { final int min retention time = 4 ; final int max retention time = min retention time * 3 / 2 ; temporal row time join operator join operator = new temporal row time join operator ( row type , row type , join condition , 0 , 0 , min retention time , max retention time , true ) ; keyed two input stream operator test harness < row data , row data , row data , row data > test harness = create test harness ( join operator ) ; test harness open ( ) ; test harness set processing time ( 3 ) ; test harness process element 2 ( insert record ( 3l , " k 1 " , " 0a 3 " ) ) ; test harness set processing time ( 6 ) ; test harness process element 1 ( insert record ( 6l , " k 1 " , " 0a 6 " ) ) ; test harness process watermark 1 ( new watermark ( 7 ) ) ; test harness process watermark 2 ( new watermark ( 7 ) ) ; test harness process element 2 ( update before record ( 3l , " k 1 " , " 0a 3 " ) ) ; test harness process element 2 ( update after record ( 3l , " k 1 " , " 0a 5 " ) ) ; test harness set processing time ( 9 ) ; test harness process element 1 ( insert record ( 9l , " k 1 " , " 7a 9 " ) ) ; test harness process watermark 1 ( new watermark ( 13 ) ) ; test harness process watermark 2 ( new watermark ( 13 ) ) ; test harness set processing time ( 9 + max retention time ) ; test harness process element 1 ( insert record ( 15l , " k 1 " , " 1 3a 1 5 " ) ) ; test harness process watermark 1 ( new watermark ( 15 ) ) ; test harness process watermark 2 ( new watermark ( 16 ) ) ; list < object > expected output = new array list < > ( ) ; expected output add ( insert record ( 6l , " k 1 " , " 0a 6 " , 3l , " k 1 " , " 0a 3 " ) ) ; expected output add ( new watermark ( 7 ) ) ; expected output add ( insert record ( 9l , " k 1 " , " 7a 9 " , 3l , " k 1 " , " 0a 5 " ) ) ; expected output add ( new watermark ( 13 ) ) ; expected output add ( insert record ( 15l , " k 1 " , " 1 3a 1 5 " , null , null , null ) ) ; expected output add ( new watermark ( 15 ) ) ; assertor assert output equals ( " output wrong " , expected output , test harness get output ( ) ) ; test harness close ( ) ; }


secnn - 7 secondary node copies fsimage and edits into correct separate directories

public void test s n n startup ( ) throws i o exception { / / set up config ( ) ; log info ( " - - starting second n n startup test " ) ; / / different name dirs config set ( d f s config keys dfs namenode name dir key , file as u r i ( new file ( hdfs dir , " name " ) ) to string ( ) ) ; config set ( d f s config keys dfs namenode edits dir key , file as u r i ( new file ( hdfs dir , " name " ) ) to string ( ) ) ; / / same checkpoint dirs config set ( d f s config keys dfs namenode checkpoint edits dir key , file as u r i ( new file ( hdfs dir , " chkpt edits " ) ) to string ( ) ) ; config set ( d f s config keys dfs namenode checkpoint dir key , file as u r i ( new file ( hdfs dir , " chkpt " ) ) to string ( ) ) ; log info ( " - - starting nn " ) ; mini d f s cluster cluster = null ; secondary name node sn = null ; name node nn = null ; try { cluster = new mini d f s cluster builder ( config ) manage data dfs dirs ( false ) manage name dfs dirs ( false ) build ( ) ; cluster wait active ( ) ; nn = cluster get name node ( ) ; assert not null ( nn ) ; / / start secondary node log info ( " - - starting second n n " ) ; sn = new secondary name node ( config ) ; assert not null ( sn ) ; log info ( " - - doing checkpoint " ) ; sn do checkpoint ( ) ; / / this shouldn ' t fail log info ( " - - done checkpoint " ) ; / / now verify that image and edits are created in the different directories f s image image = nn get f s image ( ) ; storage directory sd = image get storage ( ) get storage dir ( 0 ) ; / / only one assert equals ( sd get storage dir type ( ) , name node dir type image and edits ) ; image get storage ( ) ; file imf = n n storage get storage file ( sd , name node file image , 0 ) ; image get storage ( ) ; file edf = n n storage get storage file ( sd , name node file edits , 0 ) ; log info ( " - - image file " + imf get absolute path ( ) + " ; len = " + imf length ( ) ) ; log info ( " - - edits file " + edf get absolute path ( ) + " ; len = " + edf length ( ) ) ; f s image chkp image = sn get f s image ( ) ; verify different dirs ( chkp image , imf length ( ) , edf length ( ) ) ; } catch ( i o exception e ) { fail ( string utils stringify exception ( e ) ) ; system err println ( " checkpoint failed " ) ; throw e ; } finally { if ( sn ! = null ) sn shutdown ( ) ; if ( cluster ! = null ) cluster shutdown ( ) ; } }


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

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


called when the value returned from { @ link # get play when ready ( ) } changes

default void on play when ready changed ( boolean play when ready , @ play when ready change reason int reason ) { }


protected void write suffix ( json generator generator , object object ) throws i o exception { }


sets the settings to be used on the target index

public resize request set settings ( settings settings ) { this settings = settings ; return this ; }


should generate sector bases for a planet

public void generate sector ( sector sector ) { ptile tile = sector tile ; boolean any = false ; float noise = noise snoise 3 ( tile v x , tile v y , tile v z , 0 0 0 1f , 0 5f ) ; if ( noise > 0 027 ) { any = true ; } if ( noise < 0 15 ) { for ( ptile other : tile tiles ) { / / no sectors near start sector ! if ( sector planet get sector ( other ) id = = sector planet start sector ) { return ; } if ( sector planet get sector ( other ) generate enemy base ) { any = false ; break ; } } } if ( any ) { sector generate enemy base = true ; } }


returns a new instance that writes utf - 8 encoded json to { @ code sink }

public static json writer of ( buffered sink sink ) { return new json utf 8 writer ( sink ) ; }


returns true if the tree should not show pointers

public boolean filter pointers ( ) { return filter pointers ; }


filling in the maps as indicated by their descriptions

private void map pre existing symbols ( ) throws pdb exception { / / cannot do this commented - out code here as we are relying on the primary symbol / / map , regardless of the remap so might need to separate the two todo : later thoughts / / if ( ! applicator get pdb applicator options ( ) remap address using existing public symbols ( ) ) { / / return ; / / } program program = applicator get program ( ) ; if ( program = = null ) { throw new pdb exception ( " program may not be null " ) ; } symbol iterator iter = program get symbol table ( ) get all symbols ( false ) ; while ( iter has next ( ) ) { symbol symbol = iter next ( ) ; string name = symbol get path ( ) to string ( ) ; address address = symbol get address ( ) ; address existing address = address by pre existing symbol name get ( name ) ; if ( existing address = = null ) { address by pre existing symbol name put ( name , address ) ; } else if ( ! existing address equals ( address ) ) { address by pre existing symbol name put ( name , address no address ) ; } if ( primary symbol by address get ( address ) = = null & & symbol is primary ( ) ) { primary symbol by address put ( address , symbol ) ; } } }


public test field prop text prop view model value quantity res ( @ plurals res int plural res , int quantity , object format args ) { on mutation ( ) ; assigned attributes epoxy generated model set ( 0 ) ; value string attribute data set value ( plural res , quantity , format args ) ; return this ; }


replaces all placeholders of format { @ code $ { name } } with the corresponding property from the supplied { @ link properties }

public string replace placeholders ( string value , final properties properties ) { assert not null ( properties , " ' properties ' must not be null " ) ; return replace placeholders ( value , properties : : get property ) ; }


assigns the root directory for a prospective item

protected abstract file get root dir for ( string name ) ; / * * the rest is the methods that provide meat * /


tests the proper consumption when having more flink sources than kafka partitions , which means that some flink sources will read no partitions

public void run multiple sources one partition exactly once test ( ) throws exception { final string topic = " many to one topic " ; final int num partitions = 5 ; final int num elements per partition = 1000 ; final int total elements = num partitions * num elements per partition ; final int fail after elements = num elements per partition / 3 ; final int parallelism = 8 ; create test topic ( topic , num partitions , 1 ) ; data generators generate randomized integer sequence ( stream execution environment get execution environment ( ) , kafka server , topic , num partitions , num elements per partition , true ) ; / / run the topology that fails and recovers deserialization schema < integer > schema = new type information serialization schema < > ( basic type info int type info , new execution config ( ) ) ; stream execution environment env = stream execution environment get execution environment ( ) ; env enable checkpointing ( 500 ) ; env set parallelism ( parallelism ) ; / / set the number of restarts to one the failing mapper will fail once , then it ' s only / / success exceptions env set restart strategy ( restart strategies fixed delay restart ( 1 , 0 ) ) ; env set buffer timeout ( 0 ) ; properties props = new properties ( ) ; props put all ( standard props ) ; props put all ( secure props ) ; flink kafka consumer base < integer > kafka source = kafka server get consumer ( topic , schema , props ) ; env add source ( kafka source ) map ( new partition validating mapper ( num partitions , 1 ) ) map ( new failing identity mapper < integer > ( fail after elements ) ) add sink ( new validating exactly once sink ( total elements ) ) set parallelism ( 1 ) ; failing identity mapper failed before = false ; try execute ( env , " multi - source - one - partitions exactly once test " ) ; delete test topic ( topic ) ; }


merges two adjacent runs in place , in a stable fashion the first element of the first run must be greater than the first element of the second run ( a [ base 1 ] > a [ base 2 ] ) , and the last element of the first run ( a [ base 1 + len 1 - 1 ] ) must be greater than all elements of the second run for performance , this method should be called only when len 1 < = len 2 ; its twin , merge hi should be called if len 1 > = len 2 ( either method may be called if len 1 = = len 2 )

private void merge lo ( int base 1 , int len 1 , int base 2 , int len 2 ) { if ( debug ) assert len 1 > 0 & & len 2 > 0 & & base 1 + len 1 = = base 2 ; / / copy first run into temp array object [ ] a = this a ; / / for performance object [ ] tmp = ensure capacity ( len 1 ) ; system arraycopy ( a , base 1 , tmp , 0 , len 1 ) ; int cursor 1 = 0 ; / / indexes into tmp array int cursor 2 = base 2 ; / / indexes int a int dest = base 1 ; / / indexes int a / / move first element of second run and deal with degenerate cases a [ dest + + ] = a [ cursor 2 + + ] ; if ( - - len 2 = = 0 ) { system arraycopy ( tmp , cursor 1 , a , dest , len 1 ) ; return ; } if ( len 1 = = 1 ) { system arraycopy ( a , cursor 2 , a , dest , len 2 ) ; a [ dest + len 2 ] = tmp [ cursor 1 ] ; / / last elt of run 1 to end of merge return ; } int min gallop = this min gallop ; / / use local variable for performance outer : while ( true ) { int count 1 = 0 ; / / number of times in a row that first run won int count 2 = 0 ; / / number of times in a row that second run won / * * do the straightforward thing until ( if ever ) one run starts winning consistently * / do { if ( debug ) assert len 1 > 1 & & len 2 > 0 ; if ( ( ( comparable ) a [ cursor 2 ] ) compare to ( tmp [ cursor 1 ] ) < 0 ) { a [ dest + + ] = a [ cursor 2 + + ] ; count 2 + + ; count 1 = 0 ; if ( - - len 2 = = 0 ) break outer ; } else { a [ dest + + ] = tmp [ cursor 1 + + ] ; count 1 + + ; count 2 = 0 ; if ( - - len 1 = = 1 ) break outer ; } } while ( ( count 1 | count 2 ) < min gallop ) ; / * * one run is winning so consistently that galloping may be a huge win so try that , and continue galloping until ( if * ever ) neither run appears to be winning consistently anymore * / do { if ( debug ) assert len 1 > 1 & & len 2 > 0 ; count 1 = gallop right ( ( comparable ) a [ cursor 2 ] , tmp , cursor 1 , len 1 , 0 ) ; if ( count 1 ! = 0 ) { system arraycopy ( tmp , cursor 1 , a , dest , count 1 ) ; dest + = count 1 ; cursor 1 + = count 1 ; len 1 - = count 1 ; if ( len 1 < = 1 ) / / len 1 = = 1 | | len 1 = = 0 break outer ; } a [ dest + + ] = a [ cursor 2 + + ] ; if ( - - len 2 = = 0 ) break outer ; count 2 = gallop left ( ( comparable ) tmp [ cursor 1 ] , a , cursor 2 , len 2 , 0 ) ; if ( count 2 ! = 0 ) { system arraycopy ( a , cursor 2 , a , dest , count 2 ) ; dest + = count 2 ; cursor 2 + = count 2 ; len 2 - = count 2 ; if ( len 2 = = 0 ) break outer ; } a [ dest + + ] = tmp [ cursor 1 + + ] ; if ( - - len 1 = = 1 ) break outer ; min gallop - - ; } while ( count 1 > = min gallop | count 2 > = min gallop ) ; if ( min gallop < 0 ) min gallop = 0 ; min gallop + = 2 ; / / penalize for leaving gallop mode } / / end of " outer " loop this min gallop = min gallop < 1 ? 1 : min gallop ; / / write back to field if ( len 1 = = 1 ) { if ( debug ) assert len 2 > 0 ; system arraycopy ( a , cursor 2 , a , dest , len 2 ) ; a [ dest + len 2 ] = tmp [ cursor 1 ] ; / / last elt of run 1 to end of merge } else if ( len 1 = = 0 ) { throw new illegal argument exception ( " comparison method violates its general contract ! " ) ; } else { if ( debug ) assert len 2 = = 0 ; if ( debug ) assert len 1 > 1 ; system arraycopy ( tmp , cursor 1 , a , dest , len 1 ) ; } }


returns type information for a table api integer or sql intinteger type

public static type information < integer > int ( ) { return org apache flink api common typeinfo types int ; }


this simlulates a short server operation multiple threads start an operation that takes short time and finally fails the retries in this case do not wait for the current operation to complete all the retries end up performing the operation again

public void test short operations failure ( ) throws exception { / / test long failed operations / / there is no entry in cache expected when the first operation starts test operations ( r next int ( ) , 25 , 0 , false , false , new call ( ) ) ; }


determine if this schema can use fixed key node ' s within a table

boolean use fixed key nodes ( ) { return ! use variable key nodes ( ) & & ! use long key nodes ( ) ; }


returns the minor version number of the http protocol

public final int get minor ( ) { return minor ; }


return whether the two maps have the same keys and values

public static < k , v > boolean are maps equal ( @ nullable map < k , v > prev , @ nullable map < k , v > next ) { if ( prev = = next ) { return true ; } if ( prev = = null | | next = = null ) { return false ; } if ( prev size ( ) ! = next size ( ) ) { return false ; } for ( map entry < k , v > entry : prev entry set ( ) ) { if ( ! common utils equals ( entry get value ( ) , next get ( entry get key ( ) ) ) ) { return false ; } } return true ; }


fill credential parameters in the specified container and configuration returns false on auth cancel true otherwise

boolean provide auth parameters ( d b p data source container data source container , d b p connection configuration configuration ) throws d b exception ;


determines whether the framework should retry a method for the given exception , and the number of retries that have been made for that operation so far

public retry action should retry ( exception e , int retries , int failovers , boolean is idempotent or at most once ) throws exception ;


normalize the geo { @ code point } for the given coordinates to lie within their respective normalized ranges you can control which coordinate gets normalized with the two flags note : a shift of 180 & deg ; is applied in the longitude if necessary , in order to normalize properly the latitude if normalizing latitude but not longitude , it is assumed that the longitude is in the form x + k 3 6 0 , with x in ] - 180 ; 180 ] , and k is meaningful to the application therefore x will be adjusted while keeping k preserved

public static void normalize point ( geo point point , boolean norm lat , boolean norm lon ) { double [ ] pt = { point lon ( ) , point lat ( ) } ; normalize point ( pt , norm lon , norm lat ) ; point reset ( pt [ 1 ] , pt [ 0 ] ) ; }


public map < string , list < string > > metadata ( ) { return metadata ; }


public offset date time get ship date ( ) { return ship date ; }


check if this registry contains a singleton instance with the given name only checks already instantiated singletons ; does not return { @ code true } for singleton bean definitions which have not been instantiated yet the main purpose of this method is to check manually registered singletons ( see { @ link # register singleton } ) can also be used to check whether a singleton defined by a bean definition has already been created to check whether a bean factory contains a bean definition with a given name , use listable bean factory ' s { @ code contains bean definition } calling both { @ code contains bean definition } and { @ code contains singleton } answers whether a specific bean factory contains a local bean instance with the given name use bean factory ' s { @ code contains bean } for general checks whether the factory knows about a bean with a given name ( whether manually registered singleton instance or created by bean definition ) , also checking ancestor factories < b > note : < b > this lookup method is not aware of factory bean prefixes or aliases you need to resolve the canonical bean name first before checking the singleton status

boolean contains singleton ( string bean name ) ;


public int list get cases ( ) { return cases ; }


return a new routing function with the given attribute

default router function < t > with attribute ( string name , object value ) { assert has length ( name , " name must not be empty " ) ; assert not null ( value , " value must not be null " ) ; map < string , object > attributes = new linked hash map < > ( ) ; attributes put ( name , value ) ; return new router functions attributes router function < > ( this , attributes ) ; }


list of mime types for file upload ( csv )

input $ accept ( string content types ) ;


the list of array elements < code > repeated aapt pb array element element = 1 ; < code >

private void add element ( int index , com android aapt resources array element builder builder for value ) { ensure element is mutable ( ) ; element add ( index , builder for value build ( ) ) ; }


return { @ code true } if this bounds is assignable to all the specified types

public boolean is assignable from ( resolvable type types ) { for ( resolvable type bound : this bounds ) { for ( resolvable type type : types ) { if ( ! is assignable ( bound , type ) ) { return false ; } } } return true ; }


gets an " inline " string portion for to human ( ) , if available this is the portion that appears after the rop opcode

public string get inline string ( ) { return null ; }


returns ' k ' of the least loaded node ids as ordered list

public list < node id > select least loaded nodes ( int k ) { reentrant read write lock read lock read lock = sorted nodes lock read lock ( ) ; read lock lock ( ) ; try { list < node id > ret val = ( ( k < this sorted nodes size ( ) ) & & ( k > = 0 ) ) ? new array list < > ( this sorted nodes ) sub list ( 0 , k ) : new array list < > ( this sorted nodes ) ; return ret val ; } finally { read lock unlock ( ) ; } }


set whether the configured { @ link # set encoding encoding } of this filter is supposed to override existing request and response encodings default is " false " , i e do not modify the encoding if { @ link javax servlet http http servlet request # get character encoding ( ) } returns a non - null value switch this to " true " to enforce the specified encoding in any case , applying it as default response encoding as well this is the equivalent to setting both { @ link # set force request encoding ( boolean ) } and { @ link # set force response encoding ( boolean ) }

public void set force encoding ( boolean force encoding ) { this force request encoding = force encoding ; this force response encoding = force encoding ; }


returns the address for the symbol name if the symbol name did not exist within the program when the list was being populated or if the name was seen at more than one address , then null is returned

private address get address by pre existing symbol name ( string name ) { address address = address by pre existing symbol name get ( name ) ; / / thin the list of map values we no longer need this method should only be / / used after the list has been completely populated , and the no address marker / / was only being used during the method that populated the list to indicate that a / / name was not unique for our needs if ( address ! = null & & address equals ( address no address ) ) { address by pre existing symbol name remove ( name ) ; return null ; } return address ; }


returns additional context about an authorization failure , if { @ link # is granted ( ) } is false

public string get failure context ( ) { return null ; }


private void write user list ( string current user , linked hash map < string , user > new user map , boolean allow anonymous ) throws user access exception , i o exception { user user = new user map get ( current user ) ; if ( user = = null | | ! user is admin ( ) ) { throw new user access exception ( current user + " must have admin privilege ! " ) ; } write user list ( new user map , allow anonymous ) ; }


returns the value for an entry in the copy listing sequence file

protected copy listing file status get file listing value ( copy listing file status file status ) { return file status ; }


creates an empty file , along with all its parent directories

public static void make empty file ( path path ) throws i o exception { file system utils create directory and parents ( path get parent directory ( ) ) ; file system utils create empty file ( path ) ; }


adds this columns filter configuration to the table column filter under construction

void add to table filter ( column based table filter < ? > table column filter ) { column condition set add to table filter ( table column filter , logic operation ) ; }


configure options related to the processing of messages received from and sent to web socket clients

default void configure web socket transport ( web socket transport registration registry ) { }


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 on view recycled view model on visibility state changed ( on model visibility state changed listener < on view recycled view model , on view recycled view > listener ) { on mutation ( ) ; this on model visibility state changed listener epoxy generated model = listener ; return this ; }


derives options to use in incremental dexing actions from the given context and dx flags , where the latter typically come from a { @ code dexopts } attribute on a top - level target this method only works reliably if the given dexopts were tokenized , e g , using { @ link rule context # get tokenized string list attr }

static immutable set < string > incremental dexopts ( rule context rule context , iterable < string > tokenized dexopts ) { return normalize dexopts ( iterables filter ( tokenized dexopts , / / dexopts have to match exactly since aspect only creates archives for listed ones predicates in ( get android config ( rule context ) get dexopts supported in incremental dexing ( ) ) ) ) ; }


public void pop operand ( ) { point = point get parent ( ) ; depth - = 1 ; }


sorts x , y pairs of values by the x value

private void sort ( float [ ] values , int count ) { int point count = count / 2 ; original indices clear ( ) ; original indices ensure capacity ( point count ) ; short [ ] original indices array = original indices items ; for ( short i = 0 ; i < point count ; i + + ) original indices array [ i ] = i ; int lower = 0 ; int upper = count - 1 ; int array stack = quicksort stack ; stack add ( lower ) ; stack add ( upper - 1 ) ; while ( stack size > 0 ) { upper = stack pop ( ) ; lower = stack pop ( ) ; if ( upper < = lower ) continue ; int i = quicksort partition ( values , lower , upper , original indices array ) ; if ( i - lower > upper - i ) { stack add ( lower ) ; stack add ( i - 2 ) ; } stack add ( i + 2 ) ; stack add ( upper ) ; if ( upper - i > = i - lower ) { stack add ( lower ) ; stack add ( i - 2 ) ; } } }


determines whether the given method takes a time and unit as its last two parameters

private static boolean is timed ( method method ) { class < ? > [ ] parameter types = method get parameter types ( ) ; return parameter types length > = 2 & & parameter types [ parameter types length - 2 ] = = long class & & parameter types [ parameter types length - 1 ] = = time unit class ; }


the actual storage format is the real storage format that gets used later in the pipeline it could be either representing table storage format , or partition storage format

public hive storage format get actual storage format ( ) { return actual storage format ; }


creates a { @ link x 5 0 9 extended key manager } based on the key material in the provided { @ link key store }

static x 5 0 9 extended key manager create key manager ( key store key store , char [ ] password , string algorithm ) throws general security exception { key manager factory kmf = key manager factory get instance ( algorithm ) ; kmf init ( key store , password ) ; key manager [ ] key managers = kmf get key managers ( ) ; for ( key manager key manager : key managers ) { if ( key manager instanceof x 5 0 9 extended key manager ) { return ( x 5 0 9 extended key manager ) key manager ; } } throw new ssl config exception ( " failed to find a x 5 0 9 extended key manager in the key manager factory for [ " + algorithm + " ] and keystore [ " + key store + " ] " ) ; }


see original { @ link stubber # do throw ( throwable ) }

b d d stubber will throw ( throwable to be thrown ) ;


creates traversal request parameters for a fileset entry wrapping another fileset

public static fileset traversal params nested traversal ( label owner label , artifact artifact , path fragment dest path , @ nullable set < string > excludes ) { return nested traversal params get nested traversal ( owner label , artifact , dest path , excludes ) ; }


returns the number of times a version was looked up either from memory or from the index note this is only available if assertions are enabled

long get num version lookups ( ) { / / for testing return num version lookups count ( ) ; }


static quota usage to quota usage ( final map < ? , ? > json ) { if ( json = = null ) { return null ; } final map < ? , ? > m = ( map < ? , ? > ) json get ( quota usage class get simple name ( ) ) ; quota usage builder builder = new quota usage builder ( ) ; builder = build quota usage ( builder , m , quota usage builder class ) ; return builder build ( ) ; }


returns an enumeration of the entries the entries are listed in the order in which they appear in the zip file if you only need to iterate over the entries in a zip file , and don ' t need random - access entry lookup by name , you should probably use { @ link zip input stream } instead , to avoid paying to construct the in - memory index

public enumeration < ? extends tinker zip entry > entries ( ) { check not closed ( ) ; final iterator < tinker zip entry > iterator = entries values ( ) iterator ( ) ; return new enumeration < tinker zip entry > ( ) { public boolean has more elements ( ) { check not closed ( ) ; return iterator has next ( ) ; } public tinker zip entry next element ( ) { check not closed ( ) ; return iterator next ( ) ; } } ; }


returns the id that blaze uses to identify everything logged from the current build request todo ( olaola ) : this should be a prefixed uuid , but some existing clients still use arbitrary strings , so we accept these when passed by environment variable for compatibility

public string get build request id ( ) { return build request id ; }


check that this entry point leads to valid code : may have multiple entries into the body of the code the intent is that it be valid code , not nice code hit no bad instructions it should return

public boolean is valid code ( address entry point ) { boolean valid = check valid subroutine ( entry point , true , false ) ; return valid ; }


reduce ( ) does not support rich reduce function , since the reduce function is used internally in a { @ code reducing state }

public void test reduce with rich reducer fails ( ) throws exception { stream execution environment env = stream execution environment get execution environment ( ) ; data stream < tuple 2 < string , integer > > source = env from elements ( tuple 2 of ( " hello " , 1 ) , tuple 2 of ( " hello " , 2 ) ) ; source window all ( sliding event time windows of ( time of ( 1 , time unit seconds ) , time of ( 100 , time unit milliseconds ) ) ) reduce ( new rich reduce function < tuple 2 < string , integer > > ( ) { private static final long serial version u i d = - 6448847205314995812l ; @ override public tuple 2 < string , integer > reduce ( tuple 2 < string , integer > value 1 , tuple 2 < string , integer > value 2 ) throws exception { return null ; } } ) ; fail ( " exception was not thrown " ) ; }


opens an f s data input stream at the indicated path using default buffersize

public f s data input stream open ( final path f ) throws access control exception , file not found exception , unsupported file system exception , i o exception { final path abs f = fix relative part ( f ) ; return new f s link resolver < f s data input stream > ( ) { @ override public f s data input stream next ( final abstract file system fs , final path p ) throws i o exception , unresolved link exception { return fs open ( p ) ; } } resolve ( this , abs f ) ; }


method that is called when the priority of the request changes


drops existing columns the field expressions should be field reference expressions example : { @ code tab drop columns ( " a , b " ) }


public void send oneway ( message msg , message queue mq ) throws m q client exception , remoting exception , interrupted exception { this make sure state o k ( ) ; validators check message ( msg , this default m q producer ) ; try { this send kernel impl ( msg , mq , communication mode oneway , null , null , this default m q producer get send msg timeout ( ) ) ; } catch ( m q broker exception e ) { throw new m q client exception ( " unknown exception " , e ) ; } }


public void start ( ) { view set presenter ( this ) ; view open ( ) ; }


given a function , get the corresponding function from the specified other program function matchup is done based upon function entry point only the function bodies may be different

public static function get function ( function function , program other program ) { return ( function ) get namespace ( function , other program ) ; }


check if the given array contains the given value ( with case - insensitive comparison )

public static boolean contains ignore case ( string [ ] array , string value ) { for ( string str : array ) { if ( value = = null & & str = = null ) return true ; if ( value ! = null & & value equals ignore case ( str ) ) return true ; } return false ; }


enable the actions according to what is selected if a " root " - type node is selected , then either all of its children must be selected , or none of its children can be selected if the " root " - type node is not selected , then any of its children may be selected called by the program tree when the selection changes

void adjust multi actions ( ) { cut action set enabled ( false ) ; copy action set enabled ( false ) ; delete action set enabled ( false ) ; replace view action set enabled ( false ) ; try { if ( valid multi selection ( ) ) { copy action set enabled ( true ) ; cut action set enabled ( true ) ; set delete action enabled ( ) ; replace view action set enabled ( true ) ; enable view actions ( ) ; } enable merge action ( ) ; } catch ( concurrent modification exception e ) { } }


rudimentary parser for class signatures as specified by < a href = " https : docs oracle comjavasespecsjvmsse 1 2htmljvms - 4 html # jvms - class signature " > $ 4 7 9 1 it returns an object containing the generic parameters , super class and any other generic interface parameters the number of generic interface parameters is equal to the { @ code expected num interfaces } for example , the signature { @ code < k : ljavalang object ; v : ljavalang object ; > ljavalang object ; ljavautil map < tk ; tv ; > ; } will result in : { @ code { type parameters : " < k : ljavalang object ; v : ljavalang object ; > " , super class signature : { identifier : " ljavalang object ; " , type parameters : " " } , interface type parameters : [ " tk ; tv ; " ] } }

static class signature read type parameters for interfaces ( string name , string signature , string super name , string [ ] interfaces ) { int expected num interfaces = interfaces length ; try { class signature parser class signature parser = new class signature parser ( signature , expected num interfaces ) ; class signature parser read from signature ( ) ; verify ( class signature parser num interfaces = = expected num interfaces , " incorrect number of generic parameters parsed got % s interfaces , but expected % s " , class signature parser num interfaces , expected num interfaces ) ; return class signature create ( class signature parser ) ; } catch ( runtime exception e ) { throw new illegal argument exception ( string format ( " failed to parse signature % s of class % s with superclass % s and interfaces % s " , signature , name , super name , arrays to string ( interfaces ) ) , e ) ; } }


examine delay - slotted instruction to determine if it has a fall - through

private boolean delay slotted instruction has fallthrough ( instruction ds instr , instruction block existing block ) { while ( ds instr ! = null & & ds instr is in delay slot ( ) ) { ds instr = existing block get instruction at ( ds instr get max address ( ) next ( ) ) ; } return ds instr ! = null ; / / instruction exists after delay slots }


fraction of managed memory reserved for the given use case that this operator should use

public void set managed memory fraction operator of use case ( managed memory use case managed memory use case , double fraction ) { final config option < double > config option = get managed memory fraction config option ( managed memory use case ) ; check argument ( fraction > = 0 0 & & fraction < = 1 0 , string format ( " % s should be in range [ 0 0 , 1 0 ] , but was : % s " , config option key ( ) , fraction ) ) ; config set double ( config option , fraction ) ; }


write a companion class for { @ code type } that extends { @ link static injection }

private void generate static injection ( type element type , list < element > fields ) throws i o exception { class name type name = class name get ( type ) ; class name adapter class name = adapter name ( class name get ( type ) , static injection suffix ) ; type spec builder result = type spec class builder ( adapter class name simple name ( ) ) add originating element ( type ) add javadoc ( adapter javadocs static injection type , type ) add modifiers ( public , final ) superclass ( static injection class ) ; for ( element field : fields ) { result add field ( member binding field ( false , field ) ) ; } result add method ( attach method ( null , fields , false , type name , null , true ) ) ; result add method ( static inject method ( fields , type name ) ) ; string package name = get package ( type ) get qualified name ( ) to string ( ) ; java file java file = java file builder ( package name , result build ( ) ) add file comment ( adapter javadocs generated by dagger ) build ( ) ; java file write to ( processing env get filer ( ) ) ; }


{ @ inherit doc } the default implementation does nothing

@ override public void exit identifier ( sql base parser identifier context ctx ) { }


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


public void update ascii stream ( string column label , input stream x , long length ) throws s q l exception { }


reads the unicode string at the current index and then increments the current index by the length of the unicode string that was found this method expects the string to be double null - terminated ( ' \ 0 \ 0 ' )

public string read next unicode string ( ) throws i o exception { string s = read unicode string ( current index ) ; current index + = ( ( s length ( ) + 1 ) * 2 ) ; return s ; }


example of reading request by chunk and getting values from chunk to chunk

private void read http data chunk by chunk ( ) { try { while ( decoder has next ( ) ) { interface http data data = decoder next ( ) ; if ( data ! = null ) { / / check if current http data is a file upload and previously set as partial if ( partial content = = data ) { logger info ( " 100 % ( final size : " + partial content length ( ) + " ) " ) ; partial content = null ; } / / new value write http data ( data ) ; } } / / check partial decoding for a file upload interface http data data = decoder current partial http data ( ) ; if ( data ! = null ) { string builder builder = new string builder ( ) ; if ( partial content = = null ) { partial content = ( http data ) data ; if ( partial content instanceof file upload ) { builder append ( " start file upload : " ) append ( ( ( file upload ) partial content ) get filename ( ) ) append ( " " ) ; } else { builder append ( " start attribute : " ) append ( partial content get name ( ) ) append ( " " ) ; } builder append ( " ( defined size : " ) append ( partial content defined length ( ) ) append ( " ) " ) ; } if ( partial content defined length ( ) > 0 ) { builder append ( " " ) append ( partial content length ( ) * 100 / partial content defined length ( ) ) append ( " % " ) ; logger info ( builder to string ( ) ) ; } else { builder append ( " " ) append ( partial content length ( ) ) append ( " " ) ; logger info ( builder to string ( ) ) ; } } } catch ( end of data decoder exception e 1 ) { / / end response content append ( " \ r \ n \ r \ n e n d of content chunk by chunk \ r \ n \ r \ n " ) ; } }


converts an integer in the range of an unsigned 16 - bit integer to a big - endian byte pair

static byte [ ] to uint 1 6 ( int num ) { if ( num < 0 | | num > 65535 ) { throw new illegal state exception ( " number [ " + num + " ] must be a value between 0 and 65535 " ) ; } return new byte [ ] { ( byte ) ( num > > 8 ) , ( byte ) num } ; }


returns an iterator for the lines in a < code > file < code > using the default encoding for the vm

public static line iterator line iterator ( file file ) throws i o exception { return new line iterator ( file utils line iterator ( file , null ) ) ; }


registers stream consumers for the given streams if efo is enabled with eager registration strategy

public static void eagerly register stream consumers ( final properties config props , final list < string > streams ) { if ( ! is using efo record publisher ( config props ) | | ! is eager efo registration type ( config props ) ) { return ; } register stream consumers ( config props , streams ) ; }


enables or disables the use of local thumbnails as previews

public image request builder set local thumbnail previews enabled ( boolean enabled ) { m local thumbnail previews enabled = enabled ; return this ; }


private void remove values for key ( object key ) { collection < v > collection = maps safe remove ( map , key ) ; if ( collection ! = null ) { int count = collection size ( ) ; collection clear ( ) ; total size - = count ; } }


private synchronized void evict oldest ( ) { / / we can get the oldest element immediately , because of an interesting / / property of linked list multimap : its iterator traverses entries in the / / order that they were added iterator < entry < key , value > > iter = multimap entries ( ) iterator ( ) ; if ( ! iter has next ( ) ) { throw new illegal state exception ( " cannot evict from empty cache ! " + " capacity : " + capacity ) ; } entry < key , value > entry = iter next ( ) ; i o utils client cleanup with logger ( log , entry get value ( ) get peer ( ) ) ; iter remove ( ) ; }


return a new factory which includes null values into the serialized json

public moshi converter factory with null serialization ( ) { return new moshi converter factory ( moshi , lenient , fail on unknown , true ) ; }


public long get long ( int select 1 , int select 2 ) { switch ( select 1 ) { case space : return space i d ; case offset : try { switch ( select 2 ) { case space : return ptr get space ( ) ; case offset : return ptr get offset ( ) ; case size : return ptr get size ( ) ; } return 0 ; / / should never occur } catch ( exception e ) { return 0 ; / / should never occur } case size : return size ; default : / / should never occur return 0 ; } }


get userlogout : logs out current logged in user session

default mono < response entity < void > > logout user ( server web exchange exchange ) { mono < void > result = mono empty ( ) ; exchange get response ( ) set status code ( http status not implemented ) ; return result then ( mono empty ( ) ) ; }


< code > merge equates < code > merges the equate differences in the specified address set

public void merge equates ( address set view origin address set , task monitor monitor ) throws cancelled exception , unsupported operation exception { if ( ! origin to result translator is one for one translator ( ) ) { string message = origin to result translator get class ( ) get name ( ) + " is not a one for one translator and can ' t merge equates " ; throw new unsupported operation exception ( message ) ; } monitor set message ( " applying equates " ) ; if ( origin address set is empty ( ) ) { return ; } address iterator addresses = origin address set get addresses ( true ) ; / / get each equate out of the equate address iterator and set it in the merged program for ( long count = 0 ; addresses has next ( ) & & ! monitor is cancelled ( ) ; count + + ) { monitor check canceled ( ) ; address address = addresses next ( ) ; if ( count = = progress counter granularity ) { monitor set message ( " applying equates " + address to string ( true , false ) ) ; count = 0 ; } merge equates ( address ) ; } }


a specialized simplified mapping source method , takes the form of simple properties definition : ( " field 1 " , " type = string , store = true " )

public put index template request mapping ( string source ) { mapping ( put mapping request simple mapping ( source ) ) ; return this ; }


set the prefix that an expression string starts with the default is " # { "

public void set expression prefix ( string expression prefix ) { assert has text ( expression prefix , " expression prefix must not be empty " ) ; this expression prefix = expression prefix ; }


public static resource list union ( resource list lists ) { return union ( arrays as list ( lists ) ) ; }


create call semantic is handled differently in case of adl create semantics is translated to create append semantics 1 no dedicated connection to server 2 buffering is locally done , once buffer is full or flush is invoked on the by the caller all the pending data is pushed to adl as append operation code 3 on close - additional call is send to server to close the stream , and release lock from the stream necessity of create append semantics is 1 adl backend server does not allow idle connection for longer duration in case of slow writer scenario , observed connection timeout connection reset causing occasional job failures 2 performance boost to jobs which are slow writer , avoided network latency 3 adl equally better performing with multiple of 4mb chunk as append calls

public f s data output stream create ( path f , fs permission permission , boolean overwrite , int buffer size , short replication , long block size , progressable progress ) throws i o exception { statistics increment write ops ( 1 ) ; if exists overwrite rule = overwrite ? if exists overwrite : if exists fail ; return new f s data output stream ( new adl fs output stream ( adl client create file ( to relative file path ( f ) , overwrite rule , integer to octal string ( apply u mask ( permission ) to short ( ) ) , true ) , get conf ( ) ) , this statistics ) ; }


returns the target of the current path , which must be a symbolic link the link contents are returned exactly , and may contain an absolute or relative path analogous to readlink ( 2 ) note : for { @ link file system } s where { @ link file system # supports symbolic links natively ( path ) } returns false , this method will throw an { @ link unsupported operation exception } if the link points to a non - existent file

public path fragment read symbolic link ( ) throws i o exception { return file system read symbolic link ( this ) ; }


this method will be removed in a certain version after april 5 , 2020 , so please do not use this method

public long max offset ( message queue mq ) throws m q client exception { return this default m q push consumer impl max offset ( queue with namespace ( mq ) ) ; }


creates a new path fragment , where the caller promises that the path is normalized warning ! make sure the path fragment is in fact already normalized the rest of the code assumes this is the case

public static path fragment create already normalized ( string normalized path ) { int drive str length = os get drive str length ( normalized path ) ; return create already normalized ( normalized path , drive str length ) ; }


returns a { @ code file } object for the given path parts

private static file file ( file first , string more ) { / / not very efficient , but should definitely be correct file file = first ; for ( string name : more ) { file = new file ( file , name ) ; } return file ; }


validate if exists ( ) returns < code > true < code > for correctly formed file paths on pseudo local fs and returns < code > false < code > for improperly formed file paths

private void validate exists ( file system pfs , path path , boolean should succeed ) throws i o exception { boolean ret = pfs exists ( path ) ; if ( should succeed ) { assert true ( " exists ( ) returned false for valid file name " + path , ret ) ; } else { assert false ( " exists ( ) returned true for invalid file name " + path , ret ) ; } }


check if the routing table has changed and local shards are affected

private boolean has shard allocation id changed ( string watch index , cluster state state ) { list < shard routing > all started relocated shards = state get routing table ( ) index ( watch index ) shards with state ( started ) ; all started relocated shards add all ( state get routing table ( ) index ( watch index ) shards with state ( relocating ) ) ; / / exit early , when there are shards , but the current configuration is inactive if ( all started relocated shards is empty ( ) = = false & & configuration = = inactive ) { return true ; } / / check for different shard ids string local node id = state nodes ( ) get local node id ( ) ; set < shard id > cluster state local shard ids = state get routing nodes ( ) node ( local node id ) shards with state ( watch index , started , relocating ) stream ( ) map ( shard routing : : shard id ) collect ( collectors to set ( ) ) ; set < shard id > configured local shard ids = new hash set < > ( configuration local shards key set ( ) ) ; set < shard id > difference set = sets difference ( cluster state local shard ids , configured local shard ids ) ; if ( difference set is empty ( ) = = false ) { return true ; } map < shard id , list < string > > shards = all started relocated shards stream ( ) collect ( collectors grouping by ( shard routing : : shard id , collectors mapping ( sr - > sr allocation id ( ) get id ( ) , collectors to collection ( array list : : new ) ) ) ) ; / / sort the collection , so we have a stable order shards values ( ) for each ( collections : : sort ) ; / / check for different allocation ids for ( map entry < shard id , shard allocation configuration > entry : configuration local shards entry set ( ) ) { if ( shards contains key ( entry get key ( ) ) = = false ) { return true ; } collection < string > allocation ids = shards get ( entry get key ( ) ) ; if ( allocation ids equals ( entry get value ( ) allocation ids ) = = false ) { return true ; } } return false ; }


tests verifies the jmx attributes of local and remote peer bean - change participant to observer role

public void test j m x bean after role change ( ) throws exception { qu = new quorum util ( 1 ) ; / / create 3 servers qu disable j m x test = true ; qu start all ( ) ; zk arr = create handles ( qu ) ; zk admin arr = create admin handles ( qu ) ; / / changing a server ' s role / port is done by " adding " it with the same / / id but different role / port list < string > joining servers = new array list < string > ( ) ; / / assert remote peer bean 1 of replicated server 2 int changing index = 1 ; int replica 2 = 2 ; quorum peer peer 2 = qu get peer ( replica 2 ) peer ; quorum server changing q s 2 = peer 2 get view ( ) get ( long value of ( changing index ) ) ; string remote peer bean 2 = m bean registry domain + " : name 0 = replicated server id " + replica 2 + " , name 1 = replica " + changing index ; assert remote peer m x bean attributes ( changing q s 2 , remote peer bean 2 ) ; / / assert remote peer bean 1 of replicated server 3 int replica 3 = 3 ; quorum peer peer 3 = qu get peer ( replica 3 ) peer ; quorum server changing q s 3 = peer 3 get view ( ) get ( long value of ( changing index ) ) ; string remote peer bean 3 = m bean registry domain + " : name 0 = replicated server id " + replica 3 + " , name 1 = replica " + changing index ; assert remote peer m x bean attributes ( changing q s 3 , remote peer bean 3 ) ; string new role = " observer " ; zoo keeper zk = zk arr [ changing index ] ; zoo keeper admin zk admin = zk admin arr [ changing index ] ; / / exactly as it is now , except for role change joining servers add ( " server " + changing index + " = 127 0 0 1 : " + qu get peer ( changing index ) peer get quorum address ( ) get all ports ( ) get ( 0 ) + " : " + qu get peer ( changing index ) peer get election address ( ) get all ports ( ) get ( 0 ) + " : " + new role + " ; 127 0 0 1 : " + qu get peer ( changing index ) peer get client port ( ) ) ; reconfig ( zk admin , joining servers , null , null , - 1 ) ; test normal operation ( zk arr [ changing index ] , zk ) ; assert true ( qu get peer ( changing index ) peer observer ! = null & & qu get peer ( changing index ) peer follower = = null & & qu get peer ( changing index ) peer leader = = null ) ; assert true ( qu get peer ( changing index ) peer get peer state ( ) = = server state observing ) ; quorum peer qp = qu get peer ( changing index ) peer ; string local peer bean name = m bean registry domain + " : name 0 = replicated server id " + changing index + " , name 1 = replica " + changing index ; / / local peer bean 1 of replicated server 1 assert local peer m x bean attributes ( qp , local peer bean name , true ) ; / / assert remote peer bean 1 of replicated server 2 changing q s 2 = peer 2 get view ( ) get ( long value of ( changing index ) ) ; assert remote peer m x bean attributes ( changing q s 2 , remote peer bean 2 ) ; / / assert remote peer bean 1 of replicated server 3 changing q s 3 = peer 3 get view ( ) get ( long value of ( changing index ) ) ; assert remote peer m x bean attributes ( changing q s 3 , remote peer bean 3 ) ; }


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


set the values of this object to that object

public final void set ( final enum doubles < e > that ) { for ( int i = 0 ; i < doubles length ; i + + ) { this doubles [ i ] = that doubles [ i ] ; } }


marks the { @ link state } as ready to receive transitions returns true if no transitions have been observed yet

void mark ready ( ) { monitor enter ( ) ; try { if ( ! transitioned ) { / / nothing has transitioned since construction , good ready = true ; } else { / / this should be an extremely rare race condition list < service > services in bad states = lists new array list ( ) ; for ( service service : services by state ( ) values ( ) ) { if ( service state ( ) ! = new ) { services in bad states add ( service ) ; } } throw new illegal argument exception ( " services started transitioning asynchronously before " + " the service manager was constructed : " + services in bad states ) ; } } finally { monitor leave ( ) ; } }


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


test the basic lock and unlock operation

public void test lock acquire release ( ) { auto closeable lock lock = new auto closeable lock ( ) ; auto closeable lock newlock = lock acquire ( ) ; / / ensure acquire the same lock object assert equals ( newlock , lock ) ; / / ensure it locked now assert true ( lock is locked ( ) ) ; lock release ( ) ; / / ensure it is unlocked now assert false ( lock is locked ( ) ) ; }


all the messages will be retrieved by the service executor by calling this method and process them retrieves and removes the head of this queue , or returns null if this queue is empty

public message retrieve msg ( ) { try { return blk queue poll ( ) ; } catch ( exception e ) { logger error ( e get message ( ) ) ; } return null ; }


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

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


determines whether a get or head operation is configured to expect a body rfc7231 describes this behavior as : a payload within a get request message has no defined semantics ; sending a payload body on a get request might cause some existing implementations to reject the request see https : tools ietf orghtmlrfc 7 2 3 1 # section - 4 3 1 because there are no defined semantics , and because some client and server implementations may silently ignore the entire body ( see https : xhr spec whatwg org # the - send ( ) - method ) or throw an error ( see https : fetch spec whatwg org # ref - for - dfn - throw % e2 % 91 % a1 % e2 % 91 % a1 ) , we maintain that the existence of a body for this operation is most likely programmer error and raise awareness

private static validation rule result check antipattern get or head with body ( operation wrapper wrapper ) { if ( wrapper = = null ) { return validation rule pass empty ( ) ; } validation rule result result = validation rule pass empty ( ) ; if ( wrapper get http method ( ) = = path item http method get | | wrapper get http method ( ) = = path item http method head ) { request body body = wrapper get operation ( ) get request body ( ) ; if ( body ! = null ) { if ( string utils is not empty ( body get $ ref ( ) ) | | ( body get content ( ) ! = null & & body get content ( ) size ( ) > 0 ) ) { result = new validation rule fail ( ) ; result set details ( string format ( locale root , " % s % s contains a request body and is considered an anti - pattern " , wrapper get http method ( ) name ( ) , wrapper get operation ( ) get operation id ( ) ) ) ; } } } return result ; }


creates a { @ link mesos worker store } which is used to persist mesos worker in high availability mode

mesos worker store create mesos worker store ( configuration configuration ) throws exception ;


return an iterator over the set of blocks for which there are no replicas

public iterator < block info > get corrupt replica block iterator ( ) { return needed reconstruction iterator ( low redundancy blocks queue with corrupt blocks ) ; }