returns true if the socket mode is not yet known

public boolean is mode known ( ) { return mode ! = mode unknown ; }


parses a json string as a starlark value

public object decode ( string x , starlark thread thread ) throws eval exception { return new decoder ( thread mutability ( ) , x ) decode ( ) ; }


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


to test \ & quot ; client \ & quot ; model to test \ & quot ; client \ & quot ; model

public void test client model test ( ) { client client = null ; / / client response = api test client model ( client ) ; / / todo : test validations }


alternative to { @ link # expect body list ( class ) } that accepts information about a target type with generics

< e > list body spec < e > expect body list ( parameterized type reference < e > element type ) ;


number of total { @ link executor } s that belong to this label that are functioning this excludes executors that belong to offline nodes

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


return the last { @ link header } with the specified key


this method retrieve all the activities in a specific node , and it is reachable by using { @ link r m w s consts # scheduler activities }

activities info get activities ( http servlet request hsr , string node id , string group by ) ;


finds all history directories with a timestamp component by scanning the filesystem used when the job history server is started

protected list < file status > find timestamped directories ( ) throws i o exception { list < file status > fs list = job history utils local globber ( done dir fc , done dir prefix path , done before serial tail ) ; return fs list ; }


returns a string representation of x , where x is treated as unsigned

public static string to string ( int x ) { return to string ( x , 10 ) ; }


returns a new retained slice of this buffer ' s sub - region starting at the current { @ code reader index } and increases the { @ code reader index } by the size of the new slice ( = { @ code length } ) note that this method returns a { @ linkplain # retain ( ) retained } buffer unlike { @ link # read slice ( int ) } this method behaves similarly to { @ code read slice ( ) retain ( ) } except that this method may return a buffer implementation that produces less garbage

public abstract byte buf read retained slice ( int length ) ;


returns true if this node is allowed to have children

public boolean get allows children ( ) { if ( module ! = null ) { return true ; } return false ; }


returns the cardinality of the given field or { @ code null } if there is no cardinality for that field


caller should check before calling that guard is not satisfied

private boolean await nanos ( guard guard , long nanos , boolean signal before waiting ) throws interrupted exception { boolean first time = true ; try { do { if ( nanos < = 0l ) { return false ; } if ( first time ) { if ( signal before waiting ) { signal next waiter ( ) ; } begin waiting for ( guard ) ; first time = false ; } nanos = guard condition await nanos ( nanos ) ; } while ( ! guard is satisfied ( ) ) ; return true ; } finally { if ( ! first time ) { end waiting for ( guard ) ; } } }


convert the request into a multipart request , and make multipart resolver available if no multipart resolver is set , simply use the existing request

protected http servlet request check multipart ( http servlet request request ) throws multipart exception { if ( this multipart resolver ! = null & & this multipart resolver is multipart ( request ) ) { if ( web utils get native request ( request , multipart http servlet request class ) ! = null ) { if ( request get dispatcher type ( ) equals ( dispatcher type request ) ) { logger trace ( " request already resolved to multipart http servlet request , e g by multipart filter " ) ; } } else if ( has multipart exception ( request ) ) { logger debug ( " multipart resolution previously failed for current request - " + " skipping re - resolution for undisturbed error rendering " ) ; } else { try { return this multipart resolver resolve multipart ( request ) ; } catch ( multipart exception ex ) { if ( request get attribute ( web utils error exception attribute ) ! = null ) { logger debug ( " multipart resolution failed for error dispatch " , ex ) ; / / keep processing error dispatch with regular request handle below } else { throw ex ; } } } } / / if not returned before : return original request return request ; }


replace the existing view with the given paths

void set view paths ( tree path [ ] paths ) { int size = view list size ( ) ; for ( int i = 0 ; i < size ; i + + ) { remove from view ( view list get ( 0 ) ) ; } arrays sort ( paths , node comparator ) ; for ( tree path path : paths ) { if ( path ! = null ) { add to view ( path ) ; } } fire tree view changed ( ) ; }


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


returns a { @ code call } object to fetch the coordinator for a consumer group id takes another call parameter to schedule action that need to be taken using the coordinator the param is a supplier so that it can be lazily created , so that it can use the results of find coordinator call in its construction

private < t , o extends abstract options < o > > call get find coordinator call ( consumer group operation context < t , o > context , supplier < call > next call ) { return new call ( " find coordinator " , context deadline ( ) , new least loaded node provider ( ) ) { @ override find coordinator request builder create request ( int timeout ms ) { return new find coordinator request builder ( new find coordinator request data ( ) set key type ( coordinator type group id ( ) ) set key ( context group id ( ) ) ) ; } @ override void handle response ( abstract response abstract response ) { final find coordinator response response = ( find coordinator response ) abstract response ; if ( handle group request error ( response error ( ) , context future ( ) ) ) return ; context set node ( response node ( ) ) ; runnable call ( next call get ( ) , time milliseconds ( ) ) ; } @ override void handle failure ( throwable throwable ) { context future ( ) complete exceptionally ( throwable ) ; } } ; }


determine the status of a given ticket id , whether it ' s valid , exists , expired , etc

public response entity < string > get ticket status ( @ path variable ( " id " ) final string id ) { try { val ticket = this central authentication service get ticket ( id ) ; return new response entity < > ( ticket get id ( ) , http status ok ) ; } catch ( final invalid ticket exception e ) { return new response entity < > ( " ticket could not be found " , http status not found ) ; } catch ( final exception e ) { logging utils error ( logger , e ) ; return new response entity < > ( e get message ( ) , http status internal server error ) ; } }


increments the kahan sum by adding two sums , and updating the correction term for reducing numeric errors

public compensated sum add ( double value , double delta ) { / / if the value is inf or na n , just add it to the running tally to " convert " to / / inf / na n this keeps the behavior bwc from before kahan summing if ( double is finite ( value ) = = false ) { this value = value + this value ; } if ( double is finite ( this value ) ) { double corrected sum = value + ( this delta + delta ) ; double updated value = this value + corrected sum ; this delta = corrected sum - ( updated value - this value ) ; this value = updated value ; } return this ; }


protected boolean select vertex ( v vertex , visualization viewer < v , e > viewer ) { mutable selected state < v > selected vertex state = viewer get selected vertex state ( ) ; if ( selected vertex state = = null ) { return false ; } selected vertex state is selected ( vertex ) ; if ( selected vertex state is selected ( vertex ) = = false ) { selected vertex state clear ( ) ; selected vertex state select ( vertex , true ) ; } return true ; }


sets the number of directories to eagerly traverse on the first glob for a given package , in order to warm the filesystem - 1 means do no eager traversal see { @ link com google devtools build lib pkgcache package options # max directories to eagerly visit in globbing } - 2 means do the eager traversal using the regular globbing infrastructure , i e sharing the globbing threads and caching the actual glob results

public void set max directories to eagerly visit in globbing ( int max directories to eagerly visit in globbing ) { this max directories to eagerly visit in globbing = max directories to eagerly visit in globbing ; }


public string get commit method name ( ) { return commit method name ; }


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


public static long divide ( long p , long q , rounding mode mode ) { return long math divide ( p , q , mode ) ; }


public optional < duration > get system execution time ( ) { return system execution time ; }


call this method to let the chart data know that the underlying data has changed calling this performs all necessary recalculations needed when the contained data has changed

public void notify data changed ( ) { calc min max ( ) ; }


handle dedicated volume buttons as virtual keys if applicable

private boolean handle virtual keys ( int key code , key event event , boolean down ) { input device input device = event get device ( ) ; if ( m activity m settings m disable volume virtual keys ) { return false ; } else if ( input device ! = null & & input device get keyboard type ( ) = = input device keyboard type alphabetic ) { / / do not steal dedicated buttons from a full external keyboard return false ; } else if ( key code = = key event keycode volume down ) { m virtual control key down = down ; return true ; } else if ( key code = = key event keycode volume up ) { m virtual fn key down = down ; return true ; } return false ; }


calculates the distance on the y - axis between two pointers ( fingers on the display )

private static float get y dist ( motion event e ) { float y = math abs ( e get y ( 0 ) - e get y ( 1 ) ) ; return y ; }


private static boolean delete dir ( final file dir ) { if ( dir = = null ) return false ; / / dir doesn ' t exist then return true if ( ! dir exists ( ) ) return true ; / / dir isn ' t a directory then return false if ( ! dir is directory ( ) ) return false ; file [ ] files = dir list files ( ) ; if ( files ! = null & & files length > 0 ) { for ( file file : files ) { if ( file is file ( ) ) { if ( ! file delete ( ) ) return false ; } else if ( file is directory ( ) ) { if ( ! delete dir ( file ) ) return false ; } } } return dir delete ( ) ; }


checks that expected is equals to out , and further , if in is equals to expected , then out is successfully optimized to be identical to in , i e that " in " is simply returned

private void assert equals same ( string expected , string in , string out ) { if ( expected equals ( in ) ) { assert same ( in , out ) ; } else { assert equals ( expected , out ) ; } }


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

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


return list of { @ link abstract method record ms }

public list < abstract method record ms > get list ( ) { return method records ; }


sets the validator to validate the parameter value set by users

public param info builder < v > set validator ( param validator < v > validator ) { this validator = validator ; return this ; }


make sure that an ha nn will start if a previous upgrade was in progress

public void test starting with upgrade in progress succeeds ( ) throws exception { mini d f s cluster cluster = null ; try { cluster = new mini d f s cluster builder ( conf ) nn topology ( mini d f s n n topology simple h a topology ( ) ) num data nodes ( 0 ) build ( ) ; / / simulate an upgrade having started for ( int i = 0 ; i < 2 ; i + + ) { for ( uri uri : cluster get name dirs ( i ) ) { file prev tmp = new file ( new file ( uri ) , storage storage tmp previous ) ; log info ( " creating previous tmp dir : " + prev tmp ) ; assert true ( prev tmp mkdirs ( ) ) ; } } cluster restart name nodes ( ) ; } finally { if ( cluster ! = null ) { cluster shutdown ( ) ; } } }


fires the event for the provided { @ link transaction state }

protected void fire transaction event ( transaction state transaction state , boolean execute in new context ) { if ( state transaction listeners = = null ) { return ; } final list < transaction listener > transaction listeners = state transaction listeners get ( transaction state ) ; if ( transaction listeners = = null ) { return ; } if ( execute in new context ) { command executor command executor = command context get process engine configuration ( ) get command executor ( ) ; command config command config = new command config ( false , transaction propagation requires new ) ; command executor execute ( command config , new command < void > ( ) { public void execute ( command context command context ) { execute transaction listeners ( transaction listeners , command context ) ; return null ; } } ) ; } else { execute transaction listeners ( transaction listeners , command context ) ; } }


public node heartbeat response node heartbeat ( map < application id , list < container status > > conts , boolean is healthy , int res id ) throws exception { array list < container status > updated stats = new array list < container status > ( ) ; for ( list < container status > stats : conts values ( ) ) { updated stats add all ( stats ) ; } return node heartbeat ( updated stats , collections < container > empty list ( ) , is healthy , res id ) ; }


returns whether the last < code > get differences < code > call was cancelled if a task monitor displays a progress dialog to the user , then the cancel button could have been pressed

synchronized public boolean is cancelled ( ) { return cancelled ; }


this won ' t compile if superextends isn ' t done correctly on generics

public void covariance of merge ( ) { observable < horror movie > horrors = observable just ( new horror movie ( ) ) ; observable < observable < horror movie > > meta horrors = observable just ( horrors ) ; observable < media > merge ( meta horrors ) ; }


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


perform a upgrade using the test image corresponding to test case name

private static void run layout upgrade test ( final string test case name , final string expected storage id ) throws i o exception { test d f s upgrade from image upgrade = new test d f s upgrade from image ( ) ; upgrade unpack storage ( test case name + " tgz " , test case name + " txt " ) ; configuration conf = new configuration ( test d f s upgrade from image upgrade conf ) ; init storage dirs ( conf , test case name ) ; upgrade and verify ( upgrade , conf , new cluster verifier ( ) { @ override public void verify cluster post upgrade ( mini d f s cluster cluster ) throws i o exception { / / verify that a guid - based storage id was generated final string bpid = cluster get namesystem ( ) get block pool id ( ) ; storage report [ ] reports = cluster get data nodes ( ) get ( 0 ) get f s dataset ( ) get storage reports ( bpid ) ; assert that ( reports length , is ( 1 ) ) ; final string storage i d = reports [ 0 ] get storage ( ) get storage i d ( ) ; assert true ( datanode storage is valid storage id ( storage i d ) ) ; if ( expected storage id ! = null ) { assert that ( storage i d , is ( expected storage id ) ) ; } } } ) ; }


static version conditional for versions ( versions containing versions , versions possible versions ) { return new version conditional ( containing versions , possible versions ) ; }


this test makes sure that , if a file is under construction , blocks in the middle of that file are properly re - replicated if they become corrupt

public void test replication while under construction ( ) throws exception { log info ( " test block replication in under construction " ) ; mini d f s cluster cluster = null ; final short num data nodes = 6 ; final short replication = 3 ; string test file = " / replication - test - file " ; path test path = new path ( test file ) ; f s data output stream stm = null ; try { configuration conf = new configuration ( ) ; cluster = new mini d f s cluster builder ( conf ) num data nodes ( num data nodes ) build ( ) ; cluster wait active ( ) ; file system fs = cluster get file system ( ) ; stm = append test util create file ( fs , test path , replication ) ; / / write a full block byte [ ] buffer = append test util init buffer ( append test util block size ) ; stm write ( buffer ) ; / / block 1 stm write ( buffer ) ; / / block 2 stm write ( buffer , 0 , 1 ) ; / / start block 3 stm hflush ( ) ; / / make sure blocks are persisted , etc / / everything should be fully replicated wait for block replication ( test file , cluster get name node rpc ( ) , replication , 30000 , true , true ) ; / / check that none of the datanodes have serviced a replication request / / i e that the name node didn ' t schedule any spurious replication assert no replication was performed ( cluster ) ; / / mark one the blocks corrupt list < located block > blocks ; f s data input stream in = fs open ( test path ) ; try { blocks = d f s test util get all blocks ( in ) ; } finally { in close ( ) ; } located block lb = blocks get ( 0 ) ; located block lb one replica = new located block ( lb get block ( ) , new datanode info [ ] { lb get locations ( ) [ 0 ] } ) ; cluster get name node rpc ( ) report bad blocks ( new located block [ ] { lb one replica } ) ; / / everything should be fully replicated wait for block replication ( test file , cluster get name node rpc ( ) , replication , 30000 , true , true ) ; } finally { if ( stm ! = null ) { i o utils close stream ( stm ) ; } if ( cluster ! = null ) { cluster shutdown ( ) ; } } }


provide an { @ link exchange function } pre - configured with { @ link client http connector } and { @ link exchange strategies } this is an alternative to , and effectively overrides { @ link # client connector } , and { @ link # exchange strategies ( exchange strategies ) }

builder exchange function ( exchange function exchange function ) ;


move the src file to the target using { @ link storage # rename ( file , file ) }

public void rename ( @ nullable fs volume spi volume , file src , file target ) throws i o exception { final long begin = profiling event hook before metadata op ( volume , move ) ; try { fault injector event hook before metadata op ( volume , move ) ; storage rename ( src , target ) ; profiling event hook after metadata op ( volume , move , begin ) ; } catch ( exception e ) { on failure ( volume , begin ) ; throw e ; } }


locates a given field anywhere in the class inheritance hierarchy

private static field find field ( object instance , string name ) throws no such field exception { for ( class < ? > clazz = instance get class ( ) ; clazz ! = null ; clazz = clazz get superclass ( ) ) { try { field field = clazz get declared field ( name ) ; if ( ! field is accessible ( ) ) { field set accessible ( true ) ; } return field ; } catch ( no such field exception e ) { / / ignore and search next } } throw new no such field exception ( " field " + name + " not found in " + instance get class ( ) ) ; }


set this matrix to the specified translation and rotation

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


returns a map joiner with the same behavior as this one , except automatically substituting { @ code null text } for any provided null keys or values

public map joiner use for null ( string null text ) { return new map joiner ( joiner use for null ( null text ) , key value separator ) ; }


public void upload file test ( ) throws api exception { long pet id = null ; string additional metadata = null ; file file = null ; model api response response = api upload file ( pet id , additional metadata , file ) ; / / todo : test validations }


public map < string , big decimal > get map number ( ) { return map number ; }


returns the minimum value indexed in the < code > field name < code > field or < code > null < code > if the value cannot be inferred from the indexed { @ link point values }

static number find leaf min value ( leaf reader reader , string field name , function < byte [ ] , number > converter ) throws i o exception { final point values point values = reader get point values ( field name ) ; if ( point values = = null ) { return null ; } final bits live docs = reader get live docs ( ) ; if ( live docs = = null ) { return converter apply ( point values get min packed value ( ) ) ; } final number [ ] result = new number [ 1 ] ; try { point values intersect ( new point values intersect visitor ( ) { private short lookup counter = 0 ; @ override public void visit ( int doc i d ) { throw new unsupported operation exception ( ) ; } @ override public void visit ( int doc i d , byte [ ] packed value ) { if ( live docs get ( doc i d ) ) { result [ 0 ] = converter apply ( packed value ) ; / / this is the first leaf with a live doc so the value is the minimum for this segment throw new collection terminated exception ( ) ; } if ( + + lookup counter > max bkd lookups ) { throw new collection terminated exception ( ) ; } } @ override public point values relation compare ( byte [ ] min packed value , byte [ ] max packed value ) { return point values relation cell crosses query ; } } ) ; } catch ( collection terminated exception e ) { } return result [ 0 ] ; }


waits for any action to complete , or the timeout to elapse the thread must wait at least for the specified timeout , unless some action completes in the meantime it ' s not allowed to return 0 too early note that it ' s acceptable to return ( any value ) later than specified by the timeout

int wait for next completion ( int timeout seconds ) throws interrupted exception ;


disables registration lock the user keeps their pin

void disable registration lock ( ) throws i o exception ;


assigns the tag value using the given class key and value

public final < t > void set tag ( class < t > clazz , t value ) { if ( ! clazz is assignable from ( value get class ( ) ) ) { throw new illegal argument exception ( " tag value must be of type " + clazz get name ( ) ) ; } if ( tags = = null ) { tags = new linked hash map < > ( ) ; } tags put ( clazz , value ) ; }


creates a new builder with the given server address see { @ link netty channel builder # for address ( socket address ) } for more info

public static xds channel builder for address ( socket address server address ) { return new xds channel builder ( netty channel builder for address ( server address ) ) ; }


protected object prim transform ( object an object ) throws exception { return ( ( integer ) an object ) to string ( ) ; }


source line and column info < code > optional aapt pb source position source = 3 ; < code >

public com android aapt resources source position get source ( ) { return instance get source ( ) ; }


return field error arguments for a binding error on the given field invoked for each missing required field and each type mismatch the default implementation returns a single argument indicating the field name ( of type default message source resolvable , with " object name field " and " field " as codes )

protected object [ ] get arguments for bind error ( string object name , string field ) { string [ ] codes = new string [ ] { object name + errors nested path separator + field , field } ; return new object [ ] { new default message source resolvable ( codes , field ) } ; }


linear with duplicates r 2 1 depends on r 0 with aspect a 2 r 1 depends on r 2 1 with aspect a 1 r 2 depends on r 1 with aspect a 2 a 2 is not interested in a 1 there should be just one instance of aspect a 2 on r 0 , and is should not see a 1

public void aspect on aspect linear duplicates ( ) throws exception { scratch file ( " test / aspect bzl " , " a 1p = provider ( ) " , " def a 1 impl ( target , ctx ) : " , " return struct ( a 1p = ' a 1p ' ) " , " a 1 = aspect ( a 1 impl , attr aspects = [ ' dep ' ] , provides = [ ' a 1p ' ] ) " , " a 2p = provider ( ) " , " def a 2 impl ( target , ctx ) : " , " value = [ ] " , " if hasattr ( ctx rule attr dep , ' a 2p ' ) : " , " value + = ctx rule attr dep a 2p value " , " if hasattr ( target , ' a 1p ' ) : " , " value append ( str ( target label ) + str ( ctx aspect ids ) + ' = yes ' ) " , " else : " , " value append ( str ( target label ) + str ( ctx aspect ids ) + ' = no ' ) " , " return struct ( a 2p = a 2p ( value = value ) ) " , " a 2 = aspect ( a 2 impl , attr aspects = [ ' dep ' ] , required aspect providers = [ ] ) " , " def r 1 impl ( ctx ) : " , " pass " , " def r 2 impl ( ctx ) : " , " return struct ( result = ctx attr dep a 2p value ) " , " r 1 = rule ( r 1 impl , attrs = { ' dep ' : attr label ( aspects = [ a 1 ] ) } ) " , " r 2 = rule ( r 2 impl , attrs = { ' dep ' : attr label ( aspects = [ a 2 ] ) } ) " ) ; scratch file ( " test / build " , " load ( ' : aspect bzl ' , ' r 1 ' , ' r 2 ' ) " , " r 1 ( name = ' r 0 ' ) " , " r 2 ( name = ' r 2 1 ' , dep = ' : r 0 ' ) " , " r 1 ( name = ' r 1 ' , dep = ' : r 2 1 ' ) " , " r 2 ( name = ' r 2 ' , dep = ' : r 1 ' ) " ) ; analysis result analysis result = update ( " / / test : r 2 " ) ; configured target target = iterables get only element ( analysis result get targets to build ( ) ) ; sequence < ? > result = ( sequence ) target get ( " result " ) ; / / " yes " means that aspect a 2 sees a 1 ' s providers assert that ( result ) contains exactly ( " / / test : r 0 [ \ " / / test : aspect bzl % a 2 \ " ] = no " , " / / test : r 1 [ \ " / / test : aspect bzl % a 2 \ " ] = no " , " / / test : r 2 1 [ \ " / / test : aspect bzl % a 2 \ " ] = no " ) ; }


make sure the property names are canonical ( not camel case ) otherwise app won ' t start spring boot { @ link org springframework boot context properties migrator properties migration listener } will prevent startup if property names aren ' t valid it may be that some replacement properties need array syntax but none should contain [ 0 ]

public void verify meta data ( ) throws i o exception { val resource = cas configuration properties class get class loader ( ) get resource ( " meta - inf / additional - spring - configuration - metadata json " ) ; assert not null ( resource ) ; val additional metadata json file = resource loader get resource ( resource to string ( ) ) ; val additional props = get properties ( additional metadata json file ) ; for ( val prop : additional props ) { try { configuration property name of ( prop get name ( ) ) ; } catch ( final invalid configuration property name exception e ) { fail ( e : : get message ) ; } val deprecation = prop get deprecation ( ) ; if ( deprecation ! = null & & string utils is not blank ( deprecation get replacement ( ) ) ) { configuration property name of ( deprecation get replacement ( ) ) ; if ( deprecation get replacement ( ) ends with ( " [ 0 ] " ) ) { / * array references may work , but not at the end * / fail ( " deprecation replacement should not end in [ 0 ] " ) ; } } } }


returns a list of classes to keep this can be passed to dx as a file with - - main - dex - list

public set < string > get main dex list ( ) { return files to keep ; }


write the subscriptions items list as json to the output

public static void write to ( final list < subscription item > items , final output stream out , @ nullable final import export event listener event listener ) { final json appendable writer writer = json writer on ( out ) ; write to ( items , writer , event listener ) ; writer done ( ) ; }


public code block get source block ( ) ;


creates a new server - side { @ link ssl context }

public static ssl context new server context ( file cert chain file , file key file ) throws s s l exception { return new server context ( cert chain file , key file , null ) ; }


processes invoke this message to queue a message to send currently , only leader election uses it

public void to send ( long sid , byte buffer b ) { / * * if sending message to myself , then simply enqueue it ( loopback ) * / if ( this my sid = = sid ) { b position ( 0 ) ; add to recv queue ( new message ( b duplicate ( ) , sid ) ) ; / * * otherwise send to the corresponding thread to send * / } else { / * * start a new connection if doesn ' t have one already * / blocking queue < byte buffer > bq = queue send map compute if absent ( sid , server id - > new circular blocking queue < > ( send capacity ) ) ; add to send queue ( bq , b ) ; connect one ( sid ) ; } }


public postcard build ( string path ) { return a router get instance ( ) build ( path ) ; }


return true if this animal 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 ; } animal animal = ( animal ) o ; return objects equals ( this class name , animal class name ) & & objects equals ( this color , animal color ) ; }


a convenience method to print a formatted string using java ' s < code > printf < code > feature , which is similar to that of the c programming language for a full description on java ' s < code > printf < code > usage , see { @ link java util formatter } for examples , see the included < code > format example script < code > < b > < u > note : < u > this method will not : < b > < b > print out the name of the script , as does { @ link # println ( string ) } < b > < b > print a newline < b > if you would like the name of the script to precede you message , then you must add that yourself the { @ link # println ( string ) } does this via the following code : string message with source = get script name ( ) + " & gt ; " + message ;

public void printf ( string message , object args ) { string formatted string = string format ( message , args ) ; print ( formatted string ) ; }


public mqtt client config get client config ( ) { return client config ; }


returns the value to which the specified key is mapped in this identity hash map , or < tt > null < tt > if the map contains no mapping for this key a return value of < tt > null < tt > does not necessarily indicate that the map contains no mapping for the key ; it is also possible that the map explicitly maps the key to < tt > null < tt > the < tt > contains key < tt > method may be used to distinguish these two cases

public value get ( long key ) { int hash = hash ( key ) ; int i = index for ( hash , table length ) ; long entry < value > e = table [ i ] ; while ( true ) { if ( e = = null ) return null ; if ( e hash = = hash & & key = = e key ) return e value ; e = e next ; } }


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


tests the failure response with { @ link unknown key or namespace exception } as cause on queries for non - existing keys

public void test query unknown key ( ) throws exception { kv state registry registry = new kv state registry ( ) ; atomic kv state request stats stats = new atomic kv state request stats ( ) ; message serializer < kv state internal request , kv state response > serializer = new message serializer < > ( new kv state internal request kv state internal request deserializer ( ) , new kv state response kv state response deserializer ( ) ) ; kv state server handler handler = new kv state server handler ( test server , registry , serializer , stats ) ; embedded channel channel = new embedded channel ( get frame decoder ( ) , handler ) ; int num key groups = 1 ; abstract state backend abstract backend = new memory state backend ( ) ; dummy environment dummy env = new dummy environment ( " test " , 1 , 0 ) ; dummy env set kv state registry ( registry ) ; keyed state backend < integer > backend = create keyed state backend ( registry , num key groups , abstract backend , dummy env ) ; final test registry listener registry listener = new test registry listener ( ) ; registry register listener ( dummy env get job i d ( ) , registry listener ) ; / / register state value state descriptor < integer > desc = new value state descriptor < > ( " any " , int serializer instance ) ; desc set queryable ( " vanilla " ) ; backend get partitioned state ( void namespace instance , void namespace serializer instance , desc ) ; byte [ ] serialized key and namespace = kv state serializer serialize key and namespace ( 1238283 , int serializer instance , void namespace instance , void namespace serializer instance ) ; long request id = integer max value + 22982l ; assert true ( registry listener registration name equals ( " vanilla " ) ) ; kv state internal request request = new kv state internal request ( registry listener kv state id , serialized key and namespace ) ; byte buf ser request = message serializer serialize request ( channel alloc ( ) , request id , request ) ; / / write the request and wait for the response channel write inbound ( ser request ) ; byte buf buf = ( byte buf ) read inbound blocking ( channel ) ; buf skip bytes ( 4 ) ; / / skip frame length / / verify the response assert equals ( message type request failure , message serializer deserialize header ( buf ) ) ; request failure response = message serializer deserialize request failure ( buf ) ; buf release ( ) ; assert equals ( request id , response get request id ( ) ) ; assert true ( " did not respond with expected failure cause " , response get cause ( ) instanceof unknown key or namespace exception ) ; assert equals ( 1l , stats get num requests ( ) ) ; assert equals ( 1l , stats get num failed ( ) ) ; }


creates a { @ link remote stream environment } the remote environment sends ( parts of ) the program to a cluster for execution note that all file paths used in the program must be accessible from the cluster the execution will use the specified parallelism

public static stream execution environment create remote environment ( string host , int port , configuration client config , string jar files ) { return new remote stream environment ( host , port , client config , jar files ) ; }


this implementation delegates to the { @ code create topic connection ( username , password ) } method of the target topic connection factory , passing in the specified user credentials if the specified username is empty , it will simply delegate to the standard { @ code create topic connection ( ) } method of the target connection factory

protected topic connection do create topic connection ( @ nullable string username , @ nullable string password ) throws j m s exception { connection factory target = obtain target connection factory ( ) ; if ( ! ( target instanceof topic connection factory ) ) { throw new javax jms illegal state exception ( " ' target connection factory ' is not a topic connection factory " ) ; } topic connection factory queue factory = ( topic connection factory ) target ; if ( string utils has length ( username ) ) { return queue factory create topic connection ( username , password ) ; } else { return queue factory create topic connection ( ) ; } }


reads bytes from the current position into the specified byte array and increases the position by the number of bytes read calling this method has the same effect as { @ code get ( dest , 0 , dest length ) }

public byte buffer get ( byte [ ] dest ) { return get ( dest , 0 , dest length ) ; }


cleanup the paused container by issuing a kill on it

public integer call ( ) { int ret code = container executor exit code lost get exit code ( ) ; container id container id = container get container id ( ) ; string app id str = container id get application attempt id ( ) get application id ( ) to string ( ) ; string container id str = container id to string ( ) ; dispatcher get event handler ( ) handle ( new container event ( container id , container event type recover paused container ) ) ; boolean not interrupted = true ; try { file pid file = locate pid file ( app id str , container id str ) ; if ( pid file ! = null ) { string pid path str = pid file get path ( ) ; pid file path = new path ( pid path str ) ; exec activate container ( container id , pid file path ) ; ret code = exec reacquire container ( new container reacquisition context builder ( ) set container ( container ) set user ( container get user ( ) ) set container id ( container id ) build ( ) ) ; } else { log warn ( " unable to locate pid file for container " + container id str ) ; } } catch ( interrupted exception | interrupted i o exception e ) { log warn ( " interrupted while waiting for exit code from " + container id ) ; not interrupted = false ; } catch ( i o exception e ) { log error ( " unable to kill the paused container " + container id str , e ) ; } finally { if ( not interrupted ) { this completed set ( true ) ; exec deactivate container ( container id ) ; try { get context ( ) get n m state store ( ) store container completed ( container id , ret code ) ; } catch ( i o exception e ) { log error ( " unable to set exit code for container " + container id ) ; } } } if ( ret code ! = 0 ) { log warn ( " recovered container exited with a non - zero exit code " + ret code ) ; this dispatcher get event handler ( ) handle ( new container exit event ( container id , container event type container exited with failure , ret code , " container exited with a non - zero exit code " + ret code ) ) ; return ret code ; } log info ( " recovered container " + container id + " succeeded " ) ; dispatcher get event handler ( ) handle ( new container event ( container id , container event type container exited with success ) ) ; return 0 ; }


public void att n a m e test ( ) { / / todo : test att name }


crude inspection - assumes two records will not contain the same content

private void inspect records ( shared range map d b map , index range [ ] ranges , index range [ ] map range to value ) throws i o exception { record iterator iter = map range table iterator ( ) ; int cnt = 0 ; while ( iter has next ( ) ) { + + cnt ; d b record rec = iter next ( ) ; index range range = new index range ( rec get key ( ) , rec get long value ( shared range map d b range to col ) ) ; if ( index of ( ranges , range ) < 0 ) { assert fail ( " unexpected range : " + range get start ( ) + " - " + range get end ( ) ) ; } } assert equals ( ranges length , cnt ) ; iter = map map table iterator ( ) ; cnt = 0 ; while ( iter has next ( ) ) { + + cnt ; d b record rec = iter next ( ) ; index range entry = new index range ( rec get long value ( shared range map d b map range key col ) , rec get long value ( shared range map d b map value col ) ) ; if ( index of ( map range to value , entry ) < 0 ) { assert fail ( " unexpected map entry : range key = " + entry get start ( ) + " , value = " + entry get end ( ) ) ; } } assert equals ( map range to value length , cnt ) ; }


scale view only in { @ link # on layout } to make transition for zoom mode as smooth as possible

protected void on layout ( final boolean changed , final int left , final int top , final int right , final int bottom ) { set scale x ( scale x ) ; set scale y ( scale y ) ; }


checks for an invokable constructor matching the given arguments

public static boolean has invokable constructor ( class < ? > clazz , class < ? > classes ) { for ( constructor < ? > constructor : clazz get declared constructors ( ) ) { if ( is invokable ( constructor , classes ) ) { return true ; } } return false ; }


returns a new { @ link configuration transition } , based on the given data

configuration transition create ( t data ) ; / / todo ( https : / / github com / bazelbuild / bazel / issues / 7814 ) : once everything uses transition factory , / / remove these methods


handle the end of the input by closing down the application

public void close ( ) throws i o exception { / / if we haven ' t started the application , we have nothing to do if ( is ok ) { output collector < k3 , v3 > null collector = new output collector < k3 , v3 > ( ) { public void collect ( k3 key , v3 value ) throws i o exception { / / null } } ; start application ( null collector , reporter null ) ; } try { if ( is ok ) { application get downlink ( ) end of input ( ) ; } else { / / send the abort to the application and let it clean up application get downlink ( ) abort ( ) ; } log info ( " waiting for finish " ) ; application wait for finish ( ) ; log info ( " got done " ) ; } catch ( throwable t ) { application abort ( t ) ; } finally { application cleanup ( ) ; } }


guaranteed to throw an exception and leave the { @ code range set } unmodified

public void remove all ( range set < c > other ) { throw new unsupported operation exception ( ) ; }


uploads a byte array for the given job and verifies that a delete operation ( via the { @ link blob cache service } ) does not fail even if the file is not deletable locally , e g via restricting the permissions

private void test delete transient local fails ( @ nullable final job i d job id ) throws i o exception , interrupted exception { assume true ( ! operating system is windows ( ) ) ; / / set writable doesn ' t work on windows final configuration config = new configuration ( ) ; config set string ( blob server options storage directory , temporary folder new folder ( ) get absolute path ( ) ) ; file blob file = null ; file directory = null ; try ( blob server server = new blob server ( config , new void blob store ( ) ) ; blob cache service cache = new blob cache service ( config , new void blob store ( ) , new inet socket address ( " localhost " , server get port ( ) ) ) ) { server start ( ) ; try { byte [ ] data = new byte [ 2000000 ] ; rnd next bytes ( data ) ; / / put blob transient blob key key = ( transient blob key ) put ( server , job id , data , transient blob ) ; assert not null ( key ) ; / / access from cache once to have it available there verify contents ( cache , job id , key , data ) ; blob file = cache get transient blob service ( ) get storage location ( job id , key ) ; directory = blob file get parent file ( ) ; assert true ( blob file set writable ( false , false ) ) ; assert true ( directory set writable ( false , false ) ) ; / / issue a delete request assert false ( delete ( cache , job id , key ) ) ; / / the file should still be there on the cache verify contents ( cache , job id , key , data ) ; / / the server should have started the delete call after the cache accessed the / / ( transient ! ) blob verify deleted eventually ( server , job id , key ) ; } finally { if ( blob file ! = null & & directory ! = null ) { / / noinspection result of method call ignored blob file set writable ( true , false ) ; / / noinspection result of method call ignored directory set writable ( true , false ) ; } } } }


public static string get app name ( final string package name ) { if ( utils bridge is space ( package name ) ) return " " ; try { package manager pm = utils get app ( ) get package manager ( ) ; package info pi = pm get package info ( package name , 0 ) ; return pi = = null ? null : pi application info load label ( pm ) to string ( ) ; } catch ( package manager name not found exception e ) { e print stack trace ( ) ; return " " ; } }


public void test nested exception ( ) { throwable throwable = assertions assert throws ( framework exception class , ( ) - > { message print ( ) ; } ) ; assert that ( throwable ) has message ( " " ) ; }


sets the interval of the date histogram using calendar units ( ` 1d ` , ` 1w ` , ` 1m ` , etc ) these units are calendar - aware , meaning they respect leap additions , variable days per month , etc this is mutually exclusive with { @ link date histogram values source builder # fixed interval ( date histogram interval ) }

public date histogram values source builder calendar interval ( date histogram interval interval ) { date histogram interval calendar interval ( interval ) ; return this ; }


returns the expire after write in nanoseconds

public optional long get expire after write ( ) { return ( expire after write nanos = = null ) ? optional long empty ( ) : optional long of ( expire after write nanos ) ; }


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


convert the entity from a { @ link response } into a map of maps

public static map < string , object > entity as map ( response response ) throws i o exception { x content type x content type = x content type from media type ( response get entity ( ) get content type ( ) get value ( ) ) ; / / empty and throw are fine here because ` map ` doesn ' t use named x content or deprecation try ( x content parser parser = x content type x content ( ) create parser ( named x content registry empty , deprecation handler throw unsupported operation , response get entity ( ) get content ( ) ) ) { return parser map ( ) ; } }


returns the { @ link track bundle } whose sample has the earliest file position out of those yet to be consumed , or null if all have been consumed

private static track bundle get next track bundle ( sparse array < track bundle > track bundles ) { @ nullable track bundle next track bundle = null ; long next sample offset = long max value ; int track bundles size = track bundles size ( ) ; for ( int i = 0 ; i < track bundles size ; i + + ) { track bundle track bundle = track bundles value at ( i ) ; if ( ( ! track bundle currently in fragment & & track bundle current sample index = = track bundle moov sample table sample count ) | | ( track bundle currently in fragment & & track bundle current track run index = = track bundle fragment trun count ) ) { / / this track sample table or fragment contains no more runs in the next mdat box } else { long sample offset = track bundle get current sample offset ( ) ; if ( sample offset < next sample offset ) { next track bundle = track bundle ; next sample offset = sample offset ; } } } return next track bundle ; }


you can use these api to load tinker library without tinker is installed ! same as { @ code tinker installer # load library from tinker }

public static boolean load library from tinker ( application like application like , string relative path , string libname ) throws unsatisfied link error { libname = libname starts with ( " lib " ) ? libname : " lib " + libname ; libname = libname ends with ( " so " ) ? libname : libname + " so " ; string relative lib path = relative path + " / " + libname ; / / todo we should add cpu abi , and the real path later if ( ! tinker application helper is tinker enable for native lib ( application like ) ) { return false ; } if ( ! tinker application helper is tinker enable for native lib ( application like ) ) { return false ; } final hash map < string , string > load libraries = tinker application helper get load library and md 5 ( application like ) ; if ( load libraries = = null ) { return false ; } final string current version = tinker application helper get current version ( application like ) ; if ( share tinker internals is null or nil ( current version ) ) { return false ; } final file patch directory = share patch file util get patch directory ( application like get application ( ) ) ; if ( patch directory = = null ) { return false ; } final file patch version directory = new file ( patch directory get absolute path ( ) + " / " + share patch file util get patch version directory ( current version ) ) ; final string lib pre path = patch version directory get absolute path ( ) + " / " + share constants so path ; for ( map entry < string , string > lib entry : load libraries entry set ( ) ) { final string name = lib entry get key ( ) ; if ( ! name equals ( relative lib path ) ) { continue ; } final string patch library path = lib pre path + " / " + name ; final file library = new file ( patch library path ) ; if ( ! library exists ( ) ) { continue ; } / / whether we check md 5 when load final boolean verify md 5 = application like get tinker load verify flag ( ) ; if ( verify md 5 & & ! share patch file util verify file md 5 ( library , load libraries get ( name ) ) ) { / / do not report , because tinker is not install share tinker log i ( tag , " load library from tinker md 5mismatch fail : " + patch library path ) ; } else { system load ( patch library path ) ; share tinker log i ( tag , " load library from tinker success : " + patch library path ) ; return true ; } } return false ; }


< code > optional int 3 2 age = 3 ; < code >


return the spring load time weaver to use for class instrumentation according to the jpa class transformer contract

public load time weaver get load time weaver ( ) { return this load time weaver ; }


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


it is easier to use a real cassandra connection than mock a prepared statement

@ test public void insert entry nice to string ( ) { / / this test can use fake data as it is never written to cassandra span client span = client span ; aggregate call < ? , ? > accept call = ( aggregate call < ? , ? > ) storage span consumer ( ) accept ( as list ( client span ) ) ; list < call < ? > > insert entry calls = accept call delegate ( ) stream ( ) filter ( c - > c instanceof insert entry ) collect ( collectors to list ( ) ) ; assert that ( insert entry calls get ( 0 ) ) has to string ( " insert into span by service ( service , span ) values ( frontend , get ) " ) ; assert that ( insert entry calls get ( 1 ) ) has to string ( " insert into remote service by service ( service , remote service ) values ( frontend , backend ) " ) ; }


initialize the cluster , wait for it to become active , and get file system

private static void init cluster ( boolean format , boolean acls enabled ) throws exception { conf = new configuration ( ) ; conf set boolean ( d f s config keys dfs namenode acls enabled key , acls enabled ) ; conf set ( common configuration keys fs default name key , " stubfs : / / / " ) ; conf set class ( " fs stubfs impl " , stub file system class , file system class ) ; cluster = new mini d f s cluster builder ( conf ) num data nodes ( 1 ) format ( format ) build ( ) ; cluster wait active ( ) ; fs = cluster get file system ( ) ; }


public static print writer create writer ( file dir , string prefix ) throws i o exception { check directory ( dir ) ; simple date format date format = new simple date format ( " - yyyy m mdd - h hmmss s s s " ) ; for ( ; ; ) { final file f = new file ( dir , prefix + date format format ( new date ( system current time millis ( ) ) ) + " txt " ) ; if ( ! f exists ( ) ) return new print writer ( new output stream writer ( new file output stream ( f ) , charsets utf 8 ) ) ; try { thread sleep ( 10 ) ; } catch ( interrupted exception e ) { } } }


for the job to be simulated , identify the needed distributed cache files by mapping original cluster ' s distributed cache file paths to the simulated cluster ' s paths and add these paths in the map { @ code dist cache files } < br > job story should contain distributed cache related properties like { @ link m r job config # cache files } { @ link m r job config # cache file visibilities } { @ link m r job config # cache files sizes } { @ link m r job config # cache file timestamps } { @ link m r job config # classpath files } { @ link m r job config # cache archives } { @ link m r job config # cache archives visibilities } { @ link m r job config # cache archives sizes } { @ link m r job config # cache archives timestamps } { @ link m r job config # classpath archives } { @ link m r job config # cache symlink }

void update h d f s dist cache files list ( job story jobdesc ) throws i o exception { / / map original job ' s distributed cache file paths to simulated cluster ' s / / paths , to be used by this simulated job job conf job conf = jobdesc get job conf ( ) ; string [ ] files = job conf get strings ( m r job config cache files ) ; if ( files ! = null ) { string [ ] file sizes = job conf get strings ( m r job config cache files sizes ) ; string [ ] visibilities = job conf get strings ( m r job config cache file visibilities ) ; string [ ] time stamps = job conf get strings ( m r job config cache file timestamps ) ; file system fs = file system get ( conf ) ; string user = job conf get user ( ) ; for ( int i = 0 ; i < files length ; i + + ) { / / check if visibilities are available because older hadoop versions / / didn ' t have public , private distributed caches separately boolean visibility = ( visibilities = = null ) | | boolean parse boolean ( visibilities [ i ] ) ; if ( is local dist cache file ( files [ i ] , user , visibility ) ) { / / local fs based distributed cache file / / create this file on the pseudo local fs on the fly ( i e when the / / simulated job is submitted ) continue ; } / / distributed cache file on hdfs string mapped path = map dist cache file path ( files [ i ] , time stamps [ i ] , visibility , user ) ; / / no need to add a distributed cache file path to the list if / / ( 1 ) the mapped path is already there in the list or / / ( 2 ) the file with the mapped path already exists / / in any of the above 2 cases , file paths , timestamps , file sizes and / / visibilities match file sizes should match if file paths and / / timestamps match because single file path with single timestamp / / should correspond to a single file size if ( dist cache files contains key ( mapped path ) | | fs exists ( new path ( mapped path ) ) ) { continue ; } dist cache files put ( mapped path , long value of ( file sizes [ i ] ) ) ; } } }


configure the { @ link org springframework scheduling task scheduler } to use for providing heartbeat support setting this property also sets the { @ link # set heartbeat value heartbeat value } to " 10000 , 10000 " by default this is not set

public simple broker registration set task scheduler ( task scheduler task scheduler ) { this task scheduler = task scheduler ; return this ; }


get the memory object actually used by the mem buffer return the memory used by this mem buffer

public memory get memory ( ) { if ( program = = null ) return null ; return program get memory ( ) ; }


default void create schema ( connector session session , string schema name , map < string , object > properties ) { throw new presto exception ( not supported , " this connector does not support creating schemas " ) ; }


this method tries to find the marker ( passed to it as the first parameter ) in the stream it can find bit patterns of length & lt ; = 63 bits specifically this method is used in c b zip 2 input stream to find the end of block ( eob ) delimiter in the stream , starting from the current position of the stream if marker is found , the stream position will be at the byte containing the starting bit of the marker

public boolean skip to next marker ( long marker , int marker bit length ) throws i o exception , illegal argument exception { try { if ( marker bit length > 63 ) { throw new illegal argument exception ( " skip to next marker can not find patterns greater than 63 bits " ) ; } / / pick next market bit length bits in the stream long bytes = 0 ; bytes = this bs r ( marker bit length ) ; if ( bytes = = - 1 ) { this reported bytes read from compressed stream = this bytes read from compressed stream ; return false ; } while ( true ) { if ( bytes = = marker ) { / / report the byte position where the marker starts long marker bytes read = ( marker bit length + this bs live + 7 ) / 8 ; this reported bytes read from compressed stream = this bytes read from compressed stream - marker bytes read ; return true ; } else { bytes = bytes < < 1 ; bytes = bytes & ( ( 1l < < marker bit length ) - 1 ) ; int one bit = ( int ) this bs r ( 1 ) ; if ( one bit ! = - 1 ) { bytes = bytes | one bit ; } else { this reported bytes read from compressed stream = this bytes read from compressed stream ; return false ; } } } } catch ( i o exception ex ) { this reported bytes read from compressed stream = this bytes read from compressed stream ; return false ; } }


this method is a convenience for testing code should call { @ link segment # get live value } instead

boolean is live for testing ( internal entry < k , v , ? > entry ) { return segment for ( entry get hash ( ) ) get live value for testing ( entry ) ! = null ; }


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

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


test will timeout if secure random implementation always returns a constant value

public void test random float ( ) throws exception { os secure random random = get os secure random ( ) ; float rand 1 = random next float ( ) ; float rand 2 = random next float ( ) ; while ( rand 1 = = rand 2 ) { rand 2 = random next float ( ) ; } random close ( ) ; }


increments the current index by one and returns the character at the new index if the resulting index is greater or equal to the end index , the current index is reset to the end index and a value of done is returned

public char next ( ) { try { return string char at ( + + index ) ; } catch ( index out of bounds exception e ) { index = string length ( ) ; return done ; } }


public static list < string > get files path ( final string zip file path ) throws i o exception { return get files path ( utils bridge get file by path ( zip file path ) ) ; }


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


this procedure enumerates all entries in the port mapper ' s database the procedure takes no parameters and returns a list of program , version , protocol , and port values

private xdr dump ( int xid , xdr in , xdr out ) { portmap mapping [ ] pmap list = map values ( ) to array ( new portmap mapping [ 0 ] ) ; return portmap response pmap list ( out , xid , pmap list ) ; }


allocate a new direct { @ link byte buffer } with the given initial capacity

protected byte buffer allocate direct ( int initial capacity ) { return byte buffer allocate direct ( initial capacity ) ; }


the filesystem statistics : know this is thread - local

private file system statistics get instance statistics ( ) { return statistics source get instance statistics ( ) ; }


test that access via webhdfs puts proper entry in audit log

public void test audit web hdfs ( ) throws exception { final path file = new path ( fnames [ 0 ] ) ; fs set permission ( file , new fs permission ( ( short ) 0644 ) ) ; fs set owner ( file , " root " , null ) ; setup audit logs ( ) ; web hdfs file system webfs = web hdfs test util get web hdfs file system as ( user group info , conf , web hdfs constants webhdfs scheme ) ; input stream istream = webfs open ( file ) ; int val = istream read ( ) ; istream close ( ) ; verify audit logs repeat ( true , 3 ) ; assert true ( " failed to read from file " , val > = 0 ) ; }


closes all state maintained by the mesos services implementation

void close ( boolean cleanup ) throws exception ;


given a collection of exceptions , returns a { @ link runtime exception } , with the following rules : if { @ code exceptions } has a single exception and that exception is a { @ link runtime exception } , return it if { @ code exceptions } has a single exceptions and that exceptions is not a { @ link runtime exception } , return a simple { @ code runtime exception } that wraps it otherwise , return an instance of { @ link cluster exception } that wraps the first exception in the { @ code exceptions } collection though this method takes any { @ link collection } , it often makes most sense to pass a { @ link java util list } or some other collection that preserves the order in which the exceptions got added

public static runtime exception create ( collection < ? extends throwable > exceptions ) { if ( exceptions size ( ) = = 0 ) { throw new illegal argument exception ( " can ' t create an exception collection with no exceptions " ) ; } if ( exceptions size ( ) = = 1 ) { throwable temp = exceptions iterator ( ) next ( ) ; if ( temp instanceof runtime exception ) { return ( runtime exception ) temp ; } else { return new runtime exception ( temp ) ; } } return new cluster exception ( exceptions ) ; }


returns the local state allocation base directory for given checkpoint id w r t our rotation over all available allocation base directories

file allocation base directory ( long checkpoint id ) ;


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


public void test hs tasks block ( ) { task task = get task ( 0 ) ; map < task id , task > tasks = new hash map < task id , task > ( ) ; tasks put ( task get i d ( ) , task ) ; app context ctx = mock ( app context class ) ; app for test app = new app for test ( ctx ) ; job job = mock ( job class ) ; when ( job get tasks ( ) ) then return ( tasks ) ; app set job ( job ) ; hs tasks block for test block = new hs tasks block for test ( app ) ; block add parameter ( a m params task type , " r " ) ; print writer p writer = new print writer ( data ) ; block html = new block for test ( new html block for test ( ) , p writer , 0 , false ) ; block render ( html ) ; p writer flush ( ) ; / / should be printed information about task assert true ( data to string ( ) contains ( " task 0 0001 r 000000 " ) ) ; assert true ( data to string ( ) contains ( " succeeded " ) ) ; assert true ( data to string ( ) contains ( " 100001 " ) ) ; assert true ( data to string ( ) contains ( " 100011 " ) ) ; assert true ( data to string ( ) contains ( " " ) ) ; }


determine whether or not a parse tree matches this tree pattern

public boolean matches ( parse tree tree ) { return matcher match ( tree , this ) succeeded ( ) ; }


returns true if the specified { @ link language } has dwarf register mappings

public static boolean has d w a r f register mapping ( language lang ) throws i o exception { return has d w a r f register mapping ( lang get language description ( ) ) ; }


asserts that a zero byte file has a status of file and not directory or symlink

public void test zero byte files are directories ( ) throws exception { path src = path ( " / test / test zero byte files are files " ) ; / / create a zero byte file swift test utils touch ( fs , src ) ; swift test utils assert is directory ( fs , src ) ; }


removes the allocated slot specified by the provided slot request id

allocated slot remove ( final slot request id slot request id ) { final allocated slot allocated slot = allocated slots by id remove key b ( slot request id ) ; if ( allocated slot ! = null ) { remove allocated slot ( allocated slot ) ; } return allocated slot ; }


returns size of buffers utilized within the underlying buffer file this may be larger than than the requested buffer size this value may be used to instatiate a new buffer file which is compatible with this database when using the save as method

public int get buffer size ( ) { return buffer mgr get buffer size ( ) ; }


sets a new handshaker service address for testing

public alts channel builder set handshaker address for testing ( string handshaker address ) { credentials builder set handshaker address for testing ( handshaker address ) ; return this ; }


adds the given item to the cache with the given key and returns any previous entry for the given key that may have already been in the cache if the size of the item is larger than the total cache size , the item will not be added to the cache and instead { @ link # on item evicted ( object , object ) } will be called synchronously with the given key and item the size of the item is determined by the { @ link # get size ( object ) } method to avoid errors where { @ link # get size ( object ) } returns different values for the same object when called at different times , the size value is acquired in { @ code put } and retained until the item is evicted , replaced or removed if { @ code item } is null the behavior here is a little odd for the most part it ' s similar to simply calling { @ link # remove ( object ) } with the given key the difference is that calling this method with a null { @ code item } will result in an entry remaining in the cache with a null value and 0 size the only real consequence is that at some point { @ link # on item evicted ( object , object ) } may be called with the given { @ code key } and a null value ideally we ' d make calling this method with a null { @ code item } identical to { @ link # remove ( object ) } but we ' re preserving this odd behavior to match older versions : (

public synchronized y put ( @ non null t key , @ nullable y item ) { final int item size = get size ( item ) ; if ( item size > = max size ) { on item evicted ( key , item ) ; return null ; } if ( item ! = null ) { current size + = item size ; } @ nullable entry < y > old = cache put ( key , item = = null ? null : new entry < > ( item , item size ) ) ; if ( old ! = null ) { current size - = old size ; if ( ! old value equals ( item ) ) { on item evicted ( key , old value ) ; } } evict ( ) ; return old ! = null ? old value : null ; }


unset erasure coding policy from the directory

public void unset erasure coding policy ( final path path ) throws i o exception { dfs unset erasure coding policy ( path ) ; }


completely rebuild filesystem index using item information contained within indexed property files empty folders will be lost

public static boolean rebuild ( file root dir ) throws i o exception { verify indexed file structure ( root dir ) ; indexed v 1 local file system fs = new indexed v 1 local file system ( root dir get absolute path ( ) ) ; fs rebuild index ( ) ; fs cleanup after construction ( ) ; fs dispose ( ) ; file error file = new file ( root dir , rebuild error file ) ; if ( error file exists ( ) ) { msg error ( local file system class , " indexed filesystem rebuild failed , see log for details : " + error file ) ; return false ; } msg info ( local file system class , " index rebuild completed : " + root dir ) ; return true ; }


public void set proxy ( @ check for null proxy configuration proxy ) { this proxy = proxy ; }


test a semaphore command execution that throws an hystrix exception asynchronously and didn ' t implement get fallback

public void test semaphore isolated observe known async failure with no fallback ( ) { test observe known failure with no fallback ( execution isolation strategy semaphore , true ) ; }


public offset date time get datetime prop ( ) { return datetime prop or else ( null ) ; }


returns the total amount of memory configured to be used by the jvm including all the different memory pools

public long get total process memory ( ) { return total process memory ; }


returns whether the given class member has a new name

private boolean has name ( member member ) { return member obfuscator new member name ( member ) ! = null ; }


a sensible definition of { @ link # to string } in terms of the { @ code iterator } method of { @ link # entry set } if you override { @ link # entry set } , you may wish to override { @ link # to string } to forward to this implementation

protected string standard to string ( ) { return maps to string impl ( this ) ; }


return the default encoding for { @ link mime message mime messages } , or { @ code null } if none

public string get default encoding ( ) { return this default encoding ; }


runs cleanup operations on the given repository

private void cleanup repo ( string repository name , action listener < repository cleanup result > listener ) { final repository repository = repositories service repository ( repository name ) ; if ( repository instanceof blob store repository = = false ) { listener on failure ( new illegal argument exception ( " repository [ " + repository name + " ] does not support repository cleanup " ) ) ; return ; } final blob store repository blob store repository = ( blob store repository ) repository ; final step listener < repository data > repository data listener = new step listener < > ( ) ; repository get repository data ( repository data listener ) ; repository data listener when complete ( repository data - > { final long repository state id = repository data get gen id ( ) ; logger info ( " running cleanup operations on repository [ { } ] [ { } ] " , repository name , repository state id ) ; cluster service submit state update task ( " cleanup repository [ " + repository name + " ] [ " + repository state id + ' ] ' , new cluster state update task ( ) { private boolean started cleanup = false ; @ override public cluster state execute ( cluster state current state ) { final repository cleanup in progress repository cleanup in progress = current state custom ( repository cleanup in progress type , repository cleanup in progress empty ) ; if ( repository cleanup in progress has cleanup in progress ( ) ) { throw new illegal state exception ( " cannot cleanup [ " + repository name + " ] - a repository cleanup is already in - progress in [ " + repository cleanup in progress + " ] " ) ; } final snapshot deletions in progress deletions in progress = current state custom ( snapshot deletions in progress type , snapshot deletions in progress empty ) ; if ( deletions in progress has deletions in progress ( ) ) { throw new illegal state exception ( " cannot cleanup [ " + repository name + " ] - a snapshot is currently being deleted in [ " + deletions in progress + " ] " ) ; } snapshots in progress snapshots = current state custom ( snapshots in progress type , snapshots in progress empty ) ; if ( snapshots entries ( ) is empty ( ) = = false ) { throw new illegal state exception ( " cannot cleanup [ " + repository name + " ] - a snapshot is currently running in [ " + snapshots + " ] " ) ; } return cluster state builder ( current state ) put custom ( repository cleanup in progress type , new repository cleanup in progress ( list of ( repository cleanup in progress started entry ( repository name , repository state id ) ) ) ) build ( ) ; } @ override public void on failure ( string source , exception e ) { after ( e , null ) ; } @ override public void cluster state processed ( string source , cluster state old state , cluster state new state ) { started cleanup = true ; logger debug ( " initialized repository cleanup in cluster state for [ { } ] [ { } ] " , repository name , repository state id ) ; thread pool executor ( thread pool names snapshot ) execute ( action runnable wrap ( listener , l - > blob store repository cleanup ( repository state id , snapshots service min compatible version ( new state nodes ( ) get min node version ( ) , repository data , null ) , action listener wrap ( result - > after ( null , result ) , e - > after ( e , null ) ) ) ) ) ; } private void after ( @ nullable exception failure , @ nullable repository cleanup result result ) { if ( failure = = null ) { logger debug ( " finished repository cleanup operations on [ { } ] [ { } ] " , repository name , repository state id ) ; } else { logger debug ( ( ) - > new parameterized message ( " failed to finish repository cleanup operations on [ { } ] [ { } ] " , repository name , repository state id ) , failure ) ; } assert failure ! = null | | result ! = null ; if ( started cleanup = = false ) { logger debug ( " no cleanup task to remove from cluster state because we failed to start one " , failure ) ; listener on failure ( failure ) ; return ; } cluster service submit state update task ( " remove repository cleanup task [ " + repository name + " ] [ " + repository state id + ' ] ' , new cluster state update task ( ) { @ override public cluster state execute ( cluster state current state ) { return remove in progress cleanup ( current state ) ; } @ override public void on failure ( string source , exception e ) { if ( failure ! = null ) { e add suppressed ( failure ) ; } logger warn ( ( ) - > new parameterized message ( " [ { } ] failed to remove repository cleanup task " , repository name ) , e ) ; listener on failure ( e ) ; } @ override public void cluster state processed ( string source , cluster state old state , cluster state new state ) { if ( failure = = null ) { logger info ( " done with repository cleanup on [ { } ] [ { } ] with result [ { } ] " , repository name , repository state id , result ) ; listener on response ( result ) ; } else { logger warn ( ( ) - > new parameterized message ( " failed to run repository cleanup operations on [ { } ] [ { } ] " , repository name , repository state id ) , failure ) ; listener on failure ( failure ) ; } } } ) ; } } ) ; } , listener : : on failure ) ; }


derive a temporary directory path based on the path to the output jar , to avoid breaking fragile assumptions made by the implementation of javahotswap

static path derive directory ( string label , string output jar , string suffix ) throws i o exception { check argument ( label ! = null , " - - target label is required " ) ; check argument ( output jar ! = null , " - - output is required " ) ; check argument ( label contains ( " : " ) , " - - target label must be a canonical label ( containing a ` : ` ) " ) ; path path = paths get ( output jar ) ; string name = more files get name without extension ( path ) ; string base = label substring ( label last index of ( ' : ' ) + 1 ) ; return path resolve sibling ( " javac " ) resolve ( base ) resolve ( name + suffix ) ; }


public string get small snake ( ) { return small snake ; }


return a string representation of the contents of the specified array the string representation consists of a list of the array ' s elements , enclosed in curly braces ( { @ code " { } " } ) adjacent elements are separated by the characters { @ code " , " } ( a comma followed by a space ) returns a { @ code " null " } string if { @ code array } is { @ code null }

public static string null safe to string ( @ nullable short [ ] array ) { if ( array = = null ) { return null string ; } int length = array length ; if ( length = = 0 ) { return empty array ; } string joiner string joiner = new string joiner ( array element separator , array start , array end ) ; for ( short s : array ) { string joiner add ( string value of ( s ) ) ; } return string joiner to string ( ) ; }


this test runs a job reading continuous input ( files appearing over time ) with a stream record format ( text lines )

public void test continuous text file source ( ) throws exception { test continuous text file source ( failover type none ) ; }


returns the specified restart strategy configuration

public restart strategies restart strategy configuration get restart strategy ( ) { return config get restart strategy ( ) ; }


public static void toggle status bar indicator ( ) { config set status bar theme ( ! config is status bar theme ( ) ) ; config fire changed ( ) ; }


public string to string ( ) { char [ ] [ ] tokens = new char [ depth ( ) ] [ ] ; int i = tokens length ; int sz = 0 ; for ( tree string p = this ; p ! = null ; p = p parent ) { tokens [ - - i ] = p label ; sz + = p label length ; } string builder buf = new string builder ( sz ) ; for ( char [ ] token : tokens ) { buf append ( token ) ; } return buf to string ( ) ; }


returns the resource data for this resource

public byte [ ] get data ( ) { return data ; }


public static omf file header parse ( binary reader reader , task monitor monitor ) throws i o exception , omf exception { omf record record = omf record read record ( reader ) ; if ( ( record get record type ( ) & ( byte ) 0xfc ) ! = omf record theadr ) { throw new omf exception ( " object file does not start with proper header " ) ; } omf file header header = ( omf file header ) record ; object last data block = null ; while ( ( record get record type ( ) & ( byte ) 0xfe ) ! = omf record modend ) { if ( monitor is cancelled ( ) ) { break ; / / return what we have } record = omf record read record ( reader ) ; byte type = record get record type ( ) ; type & = 0xfe ; / / mask off the least significant bit switch ( type ) { case coment : byte comment class = ( ( omf comment record ) record ) get comment class ( ) ; if ( comment class = = ( byte ) 0 ) { header translator = ( ( omf comment record ) record ) get value ( ) ; } else if ( comment class = = ( byte ) 0x a 3 ) { header lib module name = ( ( omf comment record ) record ) get value ( ) ; } break ; case modend : / / header end module = ( omf module end ) record ; / / we are not currently examining the end module record break ; case comdef : case lcomdef : header evaluate comdef ( ( omf comdef record ) record ) ; header externsymbols add ( ( omf external symbol ) record ) ; break ; case lextdef : case extdef : header externsymbols add ( ( omf external symbol ) record ) ; break ; case pubdef : header symbols add ( ( omf symbol record ) record ) ; break ; case linnum : break ; / / not saving this information currently case lnames : ( ( omf names record ) record ) append names ( header name list ) ; / / keep names , otherwise don ' t save record break ; case segdef : header segments add ( ( omf segment header ) record ) ; break ; case grpdef : header groups add ( ( omf group record ) record ) ; break ; case fixupp : omf fixup record fixuprec = ( omf fixup record ) record ; fixuprec set data block ( last data block ) ; header fixup add ( fixuprec ) ; break ; case ledata : omf enumerated data enumheader = ( omf enumerated data ) record ; header add enumerated block ( enumheader ) ; last data block = enumheader ; break ; case lidata : omf iterated data iterheader = ( omf iterated data ) record ; if ( iterheader get segment index ( ) < = 0 | | iterheader get segment index ( ) > header segments size ( ) ) { throw new omf exception ( " bad segment index on lidata " ) ; } omf segment header segheader 2 = header segments get ( iterheader get segment index ( ) - 1 ) ; segheader 2 add iterated data ( iterheader ) ; last data block = iterheader ; break ; default : / / should never reach here } } return header ; }


send the given object to the specified destination , converting the object to a jms message with a configured message converter the message post processor callback allows for modification of the message after conversion


truncate the given file to the given length

private void truncate file ( file log file , long new length ) throws i o exception { random access file raf = new random access file ( log file , " rw " ) ; raf set length ( new length ) ; raf close ( ) ; }


the manager ( merge resolver ) for a particular merge phase should call this when its phase or sub - phase completes the string array should match one that the returned by merge resolver get phases ( )

public void set completed ( string [ ] merge phase ) ;


wraps the parent ' s child with a scale type drawable

static scale type drawable wrap child with scale type ( drawable parent parent , scaling utils scale type scale type ) { drawable child = parent set drawable ( s empty drawable ) ; child = maybe wrap with scale type ( child , scale type ) ; parent set drawable ( child ) ; preconditions check not null ( child , " parent has no child drawable ! " ) ; return ( scale type drawable ) child ; }


set the date and time at which the message was created , as specified by the { @ code date } header

public void set date ( instant date ) { set instant ( date , date ) ; }


generate a delegate to the spec that defines this component

private static method spec generate delegate ( spec model spec model , delegate method description method description , spec method model < delegate method , void > delegate method , enum set < run mode > run mode ) { final method spec builder method spec = method spec method builder ( method description name ) add modifiers ( method description access type ) returns ( method description return type ) ; for ( annotation spec annotation : method description annotations ) { method spec add annotation ( annotation ) ; } string context param name = null ; for ( int i = 0 , size = method description defined parameter types size ( ) ; i < size ; i + + ) { if ( method description defined parameter types get ( i ) = = spec model get context class ( ) ) { context param name = delegate method method params get ( i ) get name ( ) ; } method spec add parameter ( method description defined parameter types get ( i ) , delegate method method params get ( i ) get name ( ) ) ; } final boolean method uses diffs = method description optional parameter types contains ( diff prop ) | | method description optional parameter types contains ( diff state ) ; final string component name = spec model get component name ( ) ; for ( type name exception : method description exceptions ) { method spec add exception ( exception ) ; } if ( method uses diffs ) { method spec add parameter ( spec model get context class ( ) , " prev scoped context " ) ; method spec add parameter ( spec model get component class ( ) , " prev abstract impl " ) ; method spec add parameter ( spec model get context class ( ) , " next scoped context " ) ; method spec add parameter ( spec model get component class ( ) , " next abstract impl " ) ; method spec add statement ( " $ l prev impl = ( $ l ) prev abstract impl " , component name , component name ) ; method spec add statement ( " $ l next impl = ( $ l ) next abstract impl " , component name , component name ) ; } if ( ! method description return type equals ( type name void ) ) { method spec add statement ( " $ t result " , method description return type ) ; } method spec add code ( get delegation code ( spec model , delegate method , method description , run mode ) ) ; if ( delegate method name to string ( ) equals ( " on create layout " ) | | delegate method name to string ( ) equals ( " on prepare " ) ) { spec method model < event method , void > register ranges model = spec model get working range register method ( ) ; if ( register ranges model ! = null ) { code block builder register delegation = code block builder ( ) add ( " $ l $ l ( \ n " , spec model utils get spec accessor ( spec model ) , register ranges model name ) ; register delegation indent ( ) ; for ( int i = 0 , size = register ranges model method params size ( ) ; i < size ; i + + ) { final method param model method param model = register ranges model method params get ( i ) ; register delegation add ( " ( $ t ) $ l " , method param model get type name ( ) , get impl accessor ( spec model , method param model , context param name ) ) ; register delegation add ( ( i < register ranges model method params size ( ) - 1 ) ? " , \ n " : " ) ; \ n " ) ; } register delegation unindent ( ) ; method spec add code ( register delegation build ( ) ) ; } } if ( ! method description return type equals ( type name void ) ) { method spec add statement ( " return result " ) ; } return method spec build ( ) ; }


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


{ @ inherit doc } creates an empty { @ code tree set } for a collection of values for one key

sorted set < v > create collection ( ) { return new tree set < v > ( value comparator ) ; }


parses a { @ code runtime invisible annotations } attribute

private attribute runtime invisible annotations ( direct class file cf , int offset , int length , parse observer observer ) { if ( length < 2 ) { throw severely truncated ( ) ; } annotation parser ap = new annotation parser ( cf , offset , length , observer ) ; annotations annotations = ap parse annotation attribute ( annotation visibility build ) ; return new att runtime invisible annotations ( annotations , length ) ; }


draws a filled linear path on the canvas

protected void draw linear fill ( canvas c , i line data set data set , transformer trans , x bounds bounds ) { final path filled = m generate filled path buffer ; final int starting index = bounds min ; final int ending index = bounds range + bounds min ; final int index interval = 128 ; int current start index = 0 ; int current end index = index interval ; int iterations = 0 ; / / doing this iteratively in order to avoid out of memory errors that can happen on large bounds sets do { current start index = starting index + ( iterations * index interval ) ; current end index = current start index + index interval ; current end index = current end index > ending index ? ending index : current end index ; if ( current start index < = current end index ) { generate filled path ( data set , current start index , current end index , filled ) ; trans path value to pixel ( filled ) ; final drawable drawable = data set get fill drawable ( ) ; if ( drawable ! = null ) { draw filled path ( c , filled , drawable ) ; } else { draw filled path ( c , filled , data set get fill color ( ) , data set get fill alpha ( ) ) ; } } iterations + + ; } while ( current start index < = current end index ) ; }


create a schema builder for the specified type usually it will be simpler to use one of the variants like { @ link # string ( ) } or { @ link # struct ( ) } , but this form can be useful when generating schemas dynamically

public static schema builder type ( type type ) { return new schema builder ( type ) ; } / / primitive types


public int get channel max read idle seconds ( ) { return max read idle seconds ; }


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


https : jira spring iobrowse s p r - 2866

public void password value is rendered if show password attribute is set to true ( ) throws exception { this get tag ( ) set path ( " name " ) ; this get password tag ( ) set show password ( true ) ; assert that ( this get tag ( ) do start tag ( ) ) is equal to ( tag skip body ) ; string output = get output ( ) ; assert tag opened ( output ) ; assert tag closed ( output ) ; assert contains attribute ( output , " type " , get type ( ) ) ; assert value attribute ( output , " rob " ) ; }


return the time - to - live of the message when sending

public long get time to live ( ) { return this time to live ; }


public void write boolean ( boolean b ) throws i o exception { write byte ( b ? one : zero ) ; }


get the { @ link sub cluster id } representing the unique identifier of the home subcluster in which the application master of the application is running

public abstract sub cluster id get home sub cluster ( ) ;


load fsimage files assuming only local names are stored used when snapshots are not supported by the layout version

private void load local name i nodes ( long num files , data input in , counter counter ) throws i o exception { assert name node layout version supports ( layout version feature fsimage name optimization , get layout version ( ) ) ; assert num files > 0 ; / / load root load root ( in , counter ) ; / / have loaded the first file ( the root ) num files - - ; / / load rest of the nodes directory by directory while ( num files > 0 ) { num files - = load directory ( in , counter ) ; } if ( num files ! = 0 ) { throw new i o exception ( " read unexpect number of files : " + - num files ) ; } }


binary operators don ' t yet adopt the return value with compound assignment

public void test binary compound assignment postfix ( ) { assert equals ( ( byte ) 5 , exec ( " def x = 5l ; return ( byte ) ( x + + ) ; " ) ) ; assert equals ( ( short ) 5 , exec ( " def x = 5l ; return ( short ) ( x + + ) ; " ) ) ; assert equals ( ( char ) 5 , exec ( " def x = 5l ; return ( char ) ( x + + ) ; " ) ) ; assert equals ( 5 , exec ( " def x = 5l ; return ( int ) ( x + + ) ; " ) ) ; assert equals ( 5f , exec ( " def x = 5l ; return ( float ) ( x + + ) ; " ) ) ; assert equals ( 5l , exec ( " def x = 5l ; return ( long ) ( x + + ) ; " ) ) ; assert equals ( 5d , exec ( " def x = 5l ; return ( double ) ( x + + ) ; " ) ) ; }


public void domain fronting ( protocol protocol , mock web server mock web server ) throws exception { set up ( protocol , mock web server ) ; client = client new builder ( ) add network interceptor ( new interceptor ( ) { @ override public response intercept ( chain chain ) throws i o exception { request request = chain request ( ) new builder ( ) header ( " host " , " privateobject com " ) build ( ) ; return chain proceed ( request ) ; } } ) build ( ) ; server enqueue ( new mock response ( ) ) ; call call = client new call ( new request builder ( ) url ( server url ( " / " ) ) build ( ) ) ; response response = call execute ( ) ; assert that ( response body ( ) string ( ) ) is equal to ( " " ) ; recorded request recorded request = server take request ( ) ; assert that ( recorded request get header ( " : authority " ) ) is equal to ( " privateobject com " ) ; }


sets the seed based on which the random number will be generated using the same seed is guaranteed to generate the same random number for a specific doc

public random score function builder seed ( int seed ) { this seed = seed ; return this ; }


public file write ( map < string , object > data , string template , file target ) throws i o exception { if ( this engine adapter handles file ( template ) ) { / / only pass files with valid endings through template engine string template content = this engine adapter compile template ( this , data , template ) ; return write to file ( target get path ( ) , template content ) ; } else { / / do a straight copy of the file if not listed as supported by the template engine input stream is ; try { / / look up the file using the same template resolution logic the adapters would use string full template path = get full template file ( template ) ; is = get input stream ( full template path ) ; } catch ( template not found exception ex ) { is = new file input stream ( paths get ( template ) to file ( ) ) ; } return write to file ( target get absolute path ( ) , i o utils to byte array ( is ) ) ; } }


returns the owner of the project that is associated with this project file manager a value of null indicates an old multiuser project

public string get owner ( ) { return owner ; }


determines if this { @ code string } contains the sequence of characters in the { @ code char sequence } passed

public boolean contains ( char sequence cs ) { return index of ( cs ) > = 0 ; }


returns the set of command - line options related to the view specified for this request

public analysis options get view options ( ) { return get options ( analysis options class ) ; }


marshal the object graph with the given root into the provided { @ link result }

void marshal ( object graph , result result ) throws i o exception , xml mapping exception ;


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


public synchronized void parse ( event reader reader , history event handler handler ) throws i o exception { int event ctr = 0 ; history event event ; try { while ( ( event = reader get next event ( ) ) ! = null ) { handler handle event ( event ) ; + + event ctr ; } } catch ( i o exception ioe ) { log info ( " caught exception parsing history file after " + event ctr + " events " , ioe ) ; parse exception = ioe ; } finally { in close ( ) ; } }


sets a custom legend ' s entries array a null label will start a group this will disable the feature that automatically calculates the legend entries from the datasets call reset custom ( ) to re - enable automatic calculation ( and then notify data set changed ( ) is needed to auto - calculate the legend again )

public void set custom ( legend entry [ ] entries ) { m entries = entries ; m is legend custom = true ; }


rotates the direction and up vector of this camera by the given rotation matrix the direction and up vector will not be orthogonalized

public void rotate ( final matrix 4 transform ) { direction rot ( transform ) ; up rot ( transform ) ; }


add simple fall - through ( consumes 2 - bytes )

public void add bytes fallthrough ( long offset ) throws memory access exception { add bytes fallthrough ( to hex ( offset ) ) ; }


public abstract void set user ( string user ) ;


create a priority queue with an entry for each bucket , ordered by the penalty score with respect to the bucket to its right the inputs must be sorted by " value " in increasing order the last bucket has a penalty of infinity entries are doubly - linked to keep track of the relative position of each bucket

private static priority queue < entry > initialize queue ( double [ ] values , double [ ] weights , int next index ) { check argument ( next index > 0 , " next index must be > 0 " ) ; priority queue < entry > queue = new priority queue < > ( next index ) ; entry right = new entry ( next index - 1 , values [ next index - 1 ] , weights [ next index - 1 ] , null ) ; queue add ( right ) ; for ( int i = next index - 2 ; i > = 0 ; i - - ) { entry current = new entry ( i , values [ i ] , weights [ i ] , right ) ; queue add ( current ) ; right = current ; } return queue ; }


find the fields constant that matches field id , throwing an exception if it is not found

public static fields find by thrift id or throw ( int field id ) { fields fields = find by thrift id ( field id ) ; if ( fields = = null ) throw new illegal argument exception ( " field " + field id + " doesn ' t exist ! " ) ; return fields ; }


returns whether this { @ link scheme data } can be used to replace { @ code other }

public boolean can replace ( scheme data other ) { return has data ( ) & & ! other has data ( ) & & matches ( other uuid ) ; }


public string get small snake ( ) { return small snake ; }


public int get string table index ( ) { return n strx ; }


return the default value of the property

public string to default value ( schema p ) { if ( model utils is boolean schema ( p ) ) { if ( p get default ( ) ! = null ) { return p get default ( ) to string ( ) ; } } else if ( model utils is date schema ( p ) ) { if ( p get default ( ) ! = null ) { return " \ " " + p get default ( ) to string ( ) + " \ " " ; } } else if ( model utils is date time schema ( p ) ) { if ( p get default ( ) ! = null ) { return " \ " " + p get default ( ) to string ( ) + " \ " " ; } } else if ( model utils is number schema ( p ) ) { if ( p get default ( ) ! = null ) { if ( model utils is float schema ( p ) ) { / / float return p get default ( ) to string ( ) + " f " ; } else if ( model utils is double schema ( p ) ) { / / double return p get default ( ) to string ( ) + " d " ; } else { / / decimal return p get default ( ) to string ( ) + " m " ; } } } else if ( model utils is integer schema ( p ) ) { if ( p get default ( ) ! = null ) { return p get default ( ) to string ( ) ; } } else if ( model utils is string schema ( p ) ) { if ( p get default ( ) ! = null ) { string default = ( string ) p get default ( ) ; if ( p get enum ( ) = = null ) { return " \ " " + default + " \ " " ; } else { / / convert to enum var name later in post process models return default ; } } } return null ; }


look up a handler for the given request , falling back to the default handler if no specific one is found

public final handler execution chain get handler ( http servlet request request ) throws exception { object handler = get handler internal ( request ) ; if ( handler = = null ) { handler = get default handler ( ) ; } if ( handler = = null ) { return null ; } / / bean name or resolved handler ? if ( handler instanceof string ) { string handler name = ( string ) handler ; handler = obtain application context ( ) get bean ( handler name ) ; } handler execution chain execution chain = get handler execution chain ( handler , request ) ; if ( logger is trace enabled ( ) ) { logger trace ( " mapped to " + handler ) ; } else if ( logger is debug enabled ( ) & & ! request get dispatcher type ( ) equals ( dispatcher type async ) ) { logger debug ( " mapped to " + execution chain get handler ( ) ) ; } if ( has cors configuration source ( handler ) | | cors utils is pre flight request ( request ) ) { cors configuration config = get cors configuration ( handler , request ) ; if ( get cors configuration source ( ) ! = null ) { cors configuration global config = get cors configuration source ( ) get cors configuration ( request ) ; config = ( global config ! = null ? global config combine ( config ) : config ) ; } if ( config ! = null ) { config validate allow credentials ( ) ; } execution chain = get cors handler execution chain ( request , execution chain , config ) ; } return execution chain ; }


public boolean is fixed rotation ( ) { return ( m flags & e fixed rotation flag ) = = e fixed rotation flag ; }


convenience method to convert a csv string list to a set note that this will suppress duplicates

public static set < string > comma delimited list to set ( string str ) { set < string > set = new tree set < > ( ) ; string [ ] tokens = comma delimited list to string array ( str ) ; set add all ( arrays as list ( tokens ) ) ; return set ; }


just update { @ link # name } without performing the rename operation , which would involve copying files and etc

protected void do set name ( string name ) { this name = name ; }


return the specified exception cache resolver to use , if any

public cache resolver get exception cache resolver ( ) { return supplier utils resolve ( this exception cache resolver ) ; }


public k get current key ( ) throws i o exception , interrupted exception { return rr get current key ( ) ; }


returns file id for original buffer file which may be produced with this version file

long get original file i d ( ) { return original file id ; }


queue a node to be removed from tracking this method must be called under the namenode write lock

public void stop tracking node ( datanode descriptor dn ) { pending nodes remove ( dn ) ; cancelled nodes add ( dn ) ; }


returns whether this { @ code hash code } and that { @ code hash code } have the same value , given that they have the same number of bits

abstract boolean equals same bits ( hash code that ) ;


retrieves a { @ link state } object that can be used to interact with fault - tolerant state that is scoped to the window and key of the current trigger invocation

< s extends state > s get partitioned state ( state descriptor < s , ? > state descriptor ) ;


creates an xml item this route creates an xml item

public void create xml item ( xml item xml item , handler < async result < void > > result handler ) { delegate create xml item ( xml item , result handler ) ; }