define the package information when the class comes from a jar with a manifest

protected void define package ( file container , string package name , manifest manifest ) { string section name = package name replace ( ' ' , ' / ' ) + " / " ; string specification title = null ; string specification vendor = null ; string specification version = null ; string implementation title = null ; string implementation vendor = null ; string implementation version = null ; string sealed string = null ; url seal base = null ; attributes section attributes = manifest get attributes ( section name ) ; if ( section attributes ! = null ) { specification title = section attributes get value ( name specification title ) ; specification vendor = section attributes get value ( name specification vendor ) ; specification version = section attributes get value ( name specification version ) ; implementation title = section attributes get value ( name implementation title ) ; implementation vendor = section attributes get value ( name implementation vendor ) ; implementation version = section attributes get value ( name implementation version ) ; sealed string = section attributes get value ( name sealed ) ; } attributes main attributes = manifest get main attributes ( ) ; if ( main attributes ! = null ) { if ( specification title = = null ) { specification title = main attributes get value ( name specification title ) ; } if ( specification vendor = = null ) { specification vendor = main attributes get value ( name specification vendor ) ; } if ( specification version = = null ) { specification version = main attributes get value ( name specification version ) ; } if ( implementation title = = null ) { implementation title = main attributes get value ( name implementation title ) ; } if ( implementation vendor = = null ) { implementation vendor = main attributes get value ( name implementation vendor ) ; } if ( implementation version = = null ) { implementation version = main attributes get value ( name implementation version ) ; } if ( sealed string = = null ) { sealed string = main attributes get value ( name sealed ) ; } } if ( sealed string ! = null & & sealed string equals ignore case ( " true " ) ) { try { seal base = new url ( file utils get file utils ( ) to u r i ( container get absolute path ( ) ) ) ; } catch ( malformed u r l exception e ) { / / ignore } } define package ( package name , specification title , specification version , specification vendor , implementation title , implementation version , implementation vendor , seal base ) ; }


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


public int compare ( bookmark type bt 1 , bookmark type bt 2 ) { return bt 1 get type string ( ) compare to ( bt 2 get type string ( ) ) ; }


public void add contents ( dex file file ) { value encoder add contents ( file , array ) ; }


clears the stack ( that is , this method pops everything off )

public void clear ( ) { throw if immutable ( ) ; for ( int i = 0 ; i < stack ptr ; i + + ) { stack [ i ] = null ; local [ i ] = false ; } stack ptr = 0 ; }


deserializes the pub sub record can output multiple records through the { @ link collector } note that number and size of the produced records should be relatively small depending on the source implementation records can be buffered in memory or collecting records might delay emitting checkpoint barrier

default void deserialize ( pubsub message message , collector < t > out ) throws exception { t deserialized = deserialize ( message ) ; if ( deserialized ! = null ) { out collect ( deserialized ) ; } }


receive notification of a parameter predicate

void param ( string name , string value ) ;


only perform this indexing request if the document was last modification was assigned the given primary term must be used in combination with { @ link # set if seq no ( long ) } if the document last modification was assigned a different term a { @ link org elasticsearch index engine version conflict engine exception } will be thrown

public index request builder set if primary term ( long term ) { request set if primary term ( term ) ; return this ; }


sets the min width , pref width , and max width to the specified value

public container < t > width ( value width ) { if ( width = = null ) throw new illegal argument exception ( " width cannot be null " ) ; min width = width ; pref width = width ; max width = width ; return this ; }


public int hash code ( ) { int h = ( opcode * 31 ) + branchingness ; h = ( h * 31 ) + result hash code ( ) ; h = ( h * 31 ) + sources hash code ( ) ; h = ( h * 31 ) + exceptions hash code ( ) ; return h ; }


allows access to the prerequisites of a configured target this is currently used in some tests to reach into the internals of rule c t for white box testing in principle , this should not be used ; instead tests should only assert on properties of the exposed provider instances and or the action graph

protected immutable list < artifact > get prerequisite artifacts ( configured target target , string attribute name ) throws exception { set < artifact > result = new linked hash set < > ( ) ; for ( file provider provider : get prerequisites ( target , attribute name , file provider class ) ) { result add all ( provider get files to build ( ) to list ( ) ) ; } return immutable list copy of ( result ) ; }


fallback if none of the other { @ code decorrelate rel } methods match

public frame decorrelate rel ( rel node rel ) { rel node new rel = rel copy ( rel get trait set ( ) , rel get inputs ( ) ) ; if ( rel get inputs ( ) size ( ) > 0 ) { list < rel node > old inputs = rel get inputs ( ) ; list < rel node > new inputs = new array list < > ( ) ; for ( int i = 0 ; i < old inputs size ( ) ; + + i ) { final frame frame = get invoke ( old inputs get ( i ) ) ; if ( frame = = null | | frame c ! = null ) { / / if input is not rewritten , or if it produces correlated variables , / / terminate rewrite return null ; } new inputs add ( frame r ) ; new rel replace input ( i , frame r ) ; } if ( ! util equal shallow ( old inputs , new inputs ) ) { new rel = rel copy ( rel get trait set ( ) , new inputs ) ; } } / / the output position should not change since there are no cor vars coming from below return new frame ( rel , new rel , null , identity map ( rel get row type ( ) get field count ( ) ) ) ; }


forces the renderer to give up any resources ( e g media decoders ) that it may be holding if the renderer is not holding any resources , the call is a no - op this method may be called when the renderer is in the following states : { @ link # state disabled }


returns true if this traversal refers to a whole package in that case the root ( see { @ link # get root ( ) } ) refers to the path of the package package traversals are always recursive ( see { @ link # is recursive ( ) } ) and are never generated ( see { @ link # is generated ( ) } )

public abstract boolean is package ( ) ;


the rtlltr direction of components and text determines whether { @ link yoga edge # start } and { @ link yoga edge # end } will resolve to the left or right side , among other things inherit indicates this setting will be inherited from this component ' s parent default : { @ link yoga direction # inherit }

public t layout direction ( @ nullable yoga direction layout direction ) { m component get or create common props ( ) layout direction ( layout direction ) ; return get this ( ) ; }


tests that if an idempotent operation succeeds second time after socket timeout exception , then the operation is successful

public void test client retries idempotent op with socket timeout exception succeeds ( ) throws exception { configuration conf = new configuration ( ) ; conf set int ( common configuration keys public kms client failover max retries key , 3 ) ; final list < string > keys = arrays as list ( " test key " ) ; k m s client provider p 1 = mock ( k m s client provider class ) ; when ( p 1 get keys ( ) ) then throw ( new socket timeout exception ( " p 1 " ) ) then return ( keys ) ; k m s client provider p 2 = mock ( k m s client provider class ) ; when ( p 2 get keys ( ) ) then throw ( new socket timeout exception ( " p 2 " ) ) ; when ( p 1 get k m s url ( ) ) then return ( " p 1 " ) ; when ( p 2 get k m s url ( ) ) then return ( " p 2 " ) ; load balancing k m s client provider kp = new load balancing k m s client provider ( new k m s client provider [ ] { p 1 , p 2 } , 0 , conf ) ; list < string > result = kp get keys ( ) ; assert equals ( keys , result ) ; verify ( p 1 , mockito times ( 2 ) ) get keys ( ) ; verify ( p 2 , mockito times ( 1 ) ) get keys ( ) ; }


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


if true , the children will be displayed last to first

public vertical group reverse ( boolean reverse ) { this reverse = reverse ; return this ; }


accepts submission from the configuration page subtypes should override the { @ link # submit ( stapler request ) } method

public final synchronized void do config submit ( stapler request req , stapler response rsp ) throws i o exception , servlet exception , form exception { check permission ( configure ) ; submit ( req ) ; description = util nullify ( req get parameter ( " description " ) ) ; filter executors = req get parameter ( " filter executors " ) ! = null ; filter queue = req get parameter ( " filter queue " ) ! = null ; rename ( req get parameter ( " name " ) ) ; get properties ( ) rebuild ( req , req get submitted form ( ) , get applicable property descriptors ( ) ) ; save ( ) ; form apply success ( " / " + util raw encode ( name ) ) generate response ( req , rsp , this ) ; }


checks if the specified instruction is inside a subroutine

private void check subroutine ( int offset ) { / / are we inside a previously marked subroutine ? if ( subroutine starts [ offset ] ! = unknown ) { / / start marking a subroutine current subroutine start = subroutine starts [ offset ] ; } / / are we marking a subroutine ? else if ( current subroutine start ! = unknown ) { / / mark the subroutine start subroutine starts [ offset ] = current subroutine start ; } }


update the build view : syncs the package cache ; loads and analyzes the given labels

protected analysis result update ( string labels ) throws exception { return update ( new event bus ( ) , default flags ( ) , / * aspects = * / immutable list < string > of ( ) , labels ) ; }


public void property class test ( ) { / / todo : test property class }


gets the sort order for the specified driver comparator

public boolean [ ] get sort orders ( int id ) { return driver sort orders [ id ] ; }


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


public abstract set < string > get node labels ( ) ;


public static score sort builder score sort ( ) { return new score sort builder ( ) ; }


gets the action record from the table by its index

public l s d a action record get action record ( int action index ) { action index - = 1 ; if ( action index < 0 ) { return null ; } return records get ( action index ) ; }


a comma separated list of routing values to control the shards the search will be executed on

public string routing ( ) { return this routing ; }


create an authentication from a user profile

public authentication build ( final common profile profile , final o auth registered service registered service , final j e e context context , final service service ) { val attrs = new hash map < > ( profile get attributes ( ) ) ; attrs put all ( profile get authentication attributes ( ) ) ; val profile attributes = core authentication utils convert attribute values to multi valued objects ( attrs ) ; val new principal = this principal factory create principal ( profile get id ( ) , profile attributes ) ; logger debug ( " created final principal [ { } ] after filtering attributes based on [ { } ] " , new principal , registered service ) ; val authenticator = profile get class ( ) get canonical name ( ) ; val metadata = new basic credential meta data ( new basic identifiable credential ( profile get id ( ) ) ) ; val handler result = new default authentication handler execution result ( authenticator , metadata , new principal , new array list < > ( 0 ) ) ; val scopes = collection utils to collection ( context get native request ( ) get parameter values ( o auth 2 0 constants scope ) ) ; val state = context get request parameter ( o auth 2 0 constants state ) map ( string : : value of ) or else ( string utils empty ) ; val nonce = context get request parameter ( o auth 2 0 constants nonce ) map ( string : : value of ) or else ( string utils empty ) ; logger debug ( " o auth [ { } ] is [ { } ] , and [ { } ] is [ { } ] " , o auth 2 0 constants state , state , o auth 2 0 constants nonce , nonce ) ; / * * pac 4j user profile get permissions ( ) and get roles ( ) returns unmodifiable set which jackson serializer * happily serializes to json but is unable to deserialize * we have to transform those to hash set to avoid such a problem * / return default authentication builder new instance ( ) add attribute ( " permissions " , new linked hash set < > ( profile get permissions ( ) ) ) add attribute ( " roles " , new linked hash set < > ( profile get roles ( ) ) ) add attribute ( " scopes " , scopes ) add attribute ( o auth 2 0 constants state , state ) add attribute ( o auth 2 0 constants nonce , nonce ) add attribute ( o auth 2 0 constants client id , registered service get client id ( ) ) add credential ( metadata ) set principal ( new principal ) set authentication date ( zoned date time now ( zone offset utc ) ) add success ( profile get class ( ) get canonical name ( ) , handler result ) build ( ) ; }


gets the contents of the filter ' s text field

public string get filter text ( ) { return filter field get text ( ) ; }


whether the view is a view reference specified via a name to be resolved by the dispatcher servlet via a view resolver

public boolean is view reference ( ) { return ( this view instanceof string ) ; }


return true if this complex quadrilateral 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 ; } complex quadrilateral complex quadrilateral = ( complex quadrilateral ) o ; return objects equals ( this shape type , complex quadrilateral shape type ) & & objects equals ( this quadrilateral type , complex quadrilateral quadrilateral type ) ; }


analyze storage directories recover from previous transitions if required perform fs state transition if necessary depending on the namespace info read storage info

boolean recover transition read ( startup option start opt , f s namesystem target , meta recovery context recovery ) throws i o exception { assert start opt ! = startup option format : " name node formatting should be performed before reading the image " ; collection < uri > image dirs = storage get image directories ( ) ; collection < uri > edits dirs = edit log get edit u r is ( ) ; / / none of the data dirs exist if ( ( image dirs size ( ) = = 0 | | edits dirs size ( ) = = 0 ) & & start opt ! = startup option import ) throw new i o exception ( " all specified directories are not accessible or do not exist " ) ; / / 1 for each data directory calculate its state and / / check whether all is consistent before transitioning map < storage directory , storage state > data dir states = new hash map < storage directory , storage state > ( ) ; boolean is formatted = recover storage dirs ( start opt , storage , data dir states ) ; if ( log is trace enabled ( ) ) { log trace ( " data dir states : \ n " + joiner on ( " \ n " ) with key value separator ( " : " ) join ( data dir states ) ) ; } if ( ! is formatted & & start opt ! = startup option rollback & & start opt ! = startup option import ) { throw new i o exception ( " name node is not formatted " ) ; } int layout version = storage get layout version ( ) ; if ( start opt = = startup option metadataversion ) { system out println ( " hdfs image version : " + layout version ) ; system out println ( " software format version : " + hdfs server constants namenode layout version ) ; return false ; } if ( layout version < storage last pre upgrade layout version ) { n n storage check version upgradable ( storage get layout version ( ) ) ; } if ( start opt ! = startup option upgrade & & start opt ! = startup option upgradeonly & & ! rolling upgrade startup option started matches ( start opt ) & & layout version < storage last pre upgrade layout version & & layout version ! = hdfs server constants namenode layout version ) { throw new i o exception ( " \ n file system image contains an old layout version " + storage get layout version ( ) + " \ n an upgrade to version " + hdfs server constants namenode layout version + " is required \ n " + " please restart name node with the \ " " + rolling upgrade startup option started get option string ( ) + " \ " option if a rolling upgrade is already started ; " + " or restart name node with the \ " " + startup option upgrade get name ( ) + " \ " option to start " + " a new upgrade " ) ; } storage process startup options for upgrade ( start opt , layout version ) ; / / 2 format unformatted dirs for ( iterator < storage directory > it = storage dir iterator ( ) ; it has next ( ) ; ) { storage directory sd = it next ( ) ; storage state cur state = data dir states get ( sd ) ; switch ( cur state ) { case non existent : throw new i o exception ( storage state non existent + " state cannot be here " ) ; case not formatted : / / create a dir structure , but not the version file the presence of / / version is checked in the inspector ' s need to save ( ) method and / / save namespace is triggered if it is absent this will bring / / the storage state uptodate along with a new version file / / if ha is enabled , n ns start up as standby so save namespace is not / / triggered log info ( " storage directory " + sd get root ( ) + " is not formatted " ) ; log info ( " formatting " ) ; sd clear directory ( ) ; / / create empty current dir / / for non - ha , no further action is needed here , as save namespace will / / take care of the rest if ( ! target is ha enabled ( ) ) { continue ; } / / if ha is enabled , save the dirs to create a version file later when / / a checkpoint image is saved if ( new dirs = = null ) { new dirs = new hash set < storage directory > ( ) ; } new dirs add ( sd ) ; break ; default : break ; } } / / 3 do transitions switch ( start opt ) { case upgrade : case upgradeonly : do upgrade ( target ) ; return false ; / / upgrade saved image already case import : do import checkpoint ( target ) ; return false ; / / import checkpoint saved image already case rollback : throw new assertion error ( " rollback is now a standalone command , " + " name node should not be starting with this option " ) ; case regular : default : / / just load the image } return load f s image ( target , start opt , recovery ) ; }


test client receives correct d s quota exceeded exception

public void test exceeding file space quota ( ) throws exception { final configuration conf = web hdfs test util create conf ( ) ; long space quota = 50l < < 20 ; long file length = 80l < < 20 ; cluster = new mini d f s cluster builder ( conf ) num data nodes ( 3 ) build ( ) ; cluster wait active ( ) ; final file system fs = web hdfs test util get web hdfs file system ( conf , web hdfs constants webhdfs scheme ) ; final path dir = new path ( " / test / large file " ) ; assert true ( fs mkdirs ( dir ) ) ; final byte [ ] data = new byte [ 1 < < 20 ] ; random next bytes ( data ) ; cluster get file system ( ) set quota ( dir , hdfs constants quota dont set , space quota ) ; final path p = new path ( dir , " file " ) ; f s data output stream out = fs create ( p ) ; try { for ( long remaining = file length ; remaining > 0 ; ) { final int n = ( int ) math min ( remaining , data length ) ; out write ( data , 0 , n ) ; remaining - = n ; } fail ( " should have thrown exception during the write " ) ; } catch ( d s quota exceeded exception e ) { / / expected } finally { try { out close ( ) ; } catch ( exception e ) { / / discard exception from close } } }


fail the partition consumptions as a result of state check

void fail consumption ( throwable cause ) ;


sets the parallelism for this optimizer node the parallelism denotes how many parallel instances of the operator will be spawned during the execution

public void set parallelism ( int parallelism ) { if ( parallelism < 1 & & parallelism ! = execution config parallelism default ) { throw new illegal argument exception ( " parallelism of " + parallelism + " is invalid " ) ; } this parallelism = parallelism ; }


captures the most recent commit point { @ link # last commit } or the most recent safe commit point { @ link # safe commit } index files of the capturing commit point won ' t be released until the commit reference is closed

synchronized index commit acquire index commit ( boolean acquiring safe commit ) { assert safe commit ! = null : " safe commit is not initialized yet " ; assert last commit ! = null : " last commit is not initialized yet " ; final index commit snapshotting = acquiring safe commit ? safe commit : last commit ; snapshotted commits add to ( snapshotting , 1 ) ; / / increase ref count return new snapshot index commit ( snapshotting ) ; }


accept new socket connections enforces maximum number of connections per client ip address round - robin assigns to selector thread for handling returns whether pulled a connection off the accept queue or not if encounters an error attempts to fast close the socket

private boolean do accept ( ) { boolean accepted = false ; socket channel sc = null ; try { sc = accept socket accept ( ) ; accepted = true ; if ( limit total number of cnxns ( ) ) { throw new i o exception ( " too many connections max allowed is " + max cnxns ) ; } inet address ia = sc socket ( ) get inet address ( ) ; int cnxncount = get client cnxn count ( ia ) ; if ( max client cnxns > 0 & & cnxncount > = max client cnxns ) { throw new i o exception ( " too many connections from " + ia + " - max is " + max client cnxns ) ; } log debug ( " accepted socket connection from { } " , sc socket ( ) get remote socket address ( ) ) ; sc configure blocking ( false ) ; / / round - robin assign this connection to a selector thread if ( ! selector iterator has next ( ) ) { selector iterator = selector threads iterator ( ) ; } selector thread selector thread = selector iterator next ( ) ; if ( ! selector thread add accepted connection ( sc ) ) { throw new i o exception ( " unable to add connection to selector queue " + ( stopped ? " ( shutdown in progress ) " : " " ) ) ; } accept error logger flush ( ) ; } catch ( i o exception e ) { / / accept , max client cnxns , configure blocking server metrics get metrics ( ) connection rejected add ( 1 ) ; accept error logger rate limit log ( " error accepting new connection : " + e get message ( ) ) ; fast close sock ( sc ) ; } return accepted ; }


convert from an input stream , closing the stream afterwards

public t from stream ( input stream stream ) throws i o exception { try { return ( t ) ( mapper read value ( stream , class type ) ) ; } catch ( i o exception e ) { log error ( " exception while parsing json input stream " , e ) ; throw e ; } finally { i o utils close stream ( stream ) ; } }


since snapshots need to be uniquely named , this method will resolve any date math used in the provided name , as well as appending a unique identifier so expressions that may overlap still result in unique snapshot names

public static string generate snapshot name ( string name ) { return generate snapshot name ( name , new resolver context ( ) ) ; }


add a new script to the existing stored scripts based on a user - specified id if a script with the same id already exists it will be overwritten

public builder store script ( string id , stored script source source ) { scripts put ( id , source ) ; return this ; }


{ @ inherit doc } this implementation is empty

public void add argument resolvers ( list < handler method argument resolver > argument resolvers ) { }


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

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


public cancellable delete calendar job async ( delete calendar job request request , request options options , action listener < put calendar response > listener ) { return rest high level client perform request async and parse entity ( request , m l request converters : : delete calendar job , options , put calendar response : : from x content , listener , collections empty set ( ) ) ; }


returns a mapping edges to vertices that touch them

private map < e , set < v > > get occluded edges ( collection < e > edge collection ) { layout < v , e > layout = viewer get graph layout ( ) ; graph < v , e > graph = layout get graph ( ) ; set < v > prototype = new hash set < > ( ) ; factory < set < v > > factory = factory utils prototype factory ( prototype ) ; map < e , set < v > > map = map utils lazy map ( new hash map < e , set < v > > ( ) , factory ) ; map < v , rectangle > vertex bounds map = get vertex bounds ( ) ; set < entry < v , rectangle > > entry set = vertex bounds map entry set ( ) ; for ( entry < v , rectangle > entry : entry set ) { v v = entry get key ( ) ; rectangle vertex bounds = get vertex bounds in graph space ( viewer , v ) ; for ( e edge : edge collection ) { shape edge shape = get edge shape in graph space ( viewer , edge ) ; pair < v > endpoints = graph get endpoints ( edge ) ; if ( v = = endpoints get first ( ) | | v = = endpoints get second ( ) ) { / / do we ever care if an edge is occluded by its own vertices ? continue ; } if ( edge shape intersects ( vertex bounds ) ) { set < v > set = map get ( edge ) ; set add ( v ) ; } } } return map ; }


gets an iterator of the matching addresses from the first function to the second

public iterator < entry < address , address > > get first to second iterator ( ) { return src to dest entry set ( ) iterator ( ) ; }


deep comparison of array of < code > long < code > length and all values are compared the method { @ link # append ( long , long ) } is used

public equals builder append ( long [ ] lhs , long [ ] rhs ) { if ( ! is equals ) { return this ; } if ( lhs = = rhs ) { return this ; } if ( lhs = = null | | rhs = = null ) { this set equals ( false ) ; return this ; } if ( lhs length ! = rhs length ) { this set equals ( false ) ; return this ; } for ( int i = 0 ; i < lhs length & & is equals ; + + i ) { append ( lhs [ i ] , rhs [ i ] ) ; } return this ; }


helper to create a create partitions result instance for a given throwable create partitions result ' s constructor is only accessible from within the admin package

public static create partitions result create partitions result ( string topic , throwable t ) { kafka future impl < void > future = new kafka future impl < > ( ) ; future complete exceptionally ( t ) ; return new create partitions result ( collections singleton map ( topic , future ) ) ; }


set the public id for the dtd declaration written when marshalling by default , this is { @ code null } only used when the root element also has been set set either this property or { @ code doc type system id } , not both

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


sets the coordinate vector of a multi - dimensional point

public void set coordinates ( double [ ] coordinates ) { this coordinates = coordinates ; }


public void place order test ( ) throws exception { order body = cache get object ( " / place order / body " , order class ) ; order response = api place order ( body ) ; / / todo : complete test assertions validate ( response ) ; }


measure throughput of unary calls the calls are already running , we just observe a counter of received responses

public void ping pong ( additional counters counters ) throws exception { record set ( true ) ; / / no need to do anything , just sleep here thread sleep ( 1001 ) ; record set ( false ) ; }


public int hash code ( ) { return s s l protocol socket factory class hash code ( ) ; }


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


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


tests write file and read file with view file system overload scheme

public void test local target link write simple ( ) throws i o exception , u r i syntax exception { log info ( " starting test local target link write simple " ) ; final string test string = " hello local ! " ; final path lfs root = new path ( " / lfs root " ) ; add mount links ( null , new string [ ] { lfs root to string ( ) } , new string [ ] { target test root + " / local " } , conf ) ; try ( file system l view fs = file system get ( uri create ( " file : / / / " ) , conf ) ) { final path test path = new path ( lfs root , " test txt " ) ; try ( f s data output stream fs dos = l view fs create ( test path ) ) { fs dos write u t f ( test string ) ; } try ( f s data input stream l view is = l view fs open ( test path ) ) { assert assert equals ( test string , l view is read u t f ( ) ) ; } } }


assertion - checks that the expected error was reported ,

protected void assert contains error ( string expected error ) { for ( event error : events errors ( ) ) { if ( error get message ( ) contains ( expected error ) ) { return ; } } fail ( " didn ' t find expected error : \ " " + expected error + " \ " " ) ; }


test that blocks should get replicated if we have corrupted blocks and having good replicas at least equal or greater to minreplication simulate rbw blocks by creating dummy copies , then a dn restart to detect those corrupted blocks asap

public void test replication when block corruption ( ) throws exception { mini d f s cluster cluster = null ; try { configuration conf = new hdfs configuration ( ) ; conf set long ( d f s config keys dfs namenode reconstruction pending timeout sec key , 1 ) ; cluster = new mini d f s cluster builder ( conf ) num data nodes ( 3 ) storages per datanode ( 1 ) build ( ) ; file system fs = cluster get file system ( ) ; path file path = new path ( " / test " ) ; f s data output stream create = fs create ( file path ) ; fs set replication ( file path , ( short ) 1 ) ; create write ( new byte [ 1024 ] ) ; create close ( ) ; extended block block = d f s test util get first block ( fs , file path ) ; int num replica created = 0 ; for ( final data node dn : cluster get data nodes ( ) ) { if ( ! dn get f s dataset ( ) contains ( block ) ) { cluster get fs dataset test utils ( dn ) inject corrupt replica ( block ) ; num replica created + + ; } } assert equals ( 2 , num replica created ) ; fs set replication ( file path , ( short ) 3 ) ; cluster restart data nodes ( ) ; / / lets detect all d ns about dummy copied / / blocks cluster wait active ( ) ; cluster trigger block reports ( ) ; d f s test util wait replication ( fs , file path , ( short ) 3 ) ; } finally { if ( cluster ! = null ) { cluster shutdown ( ) ; } } }


writes a cdata section such sections always appear on their own line the nature in which the cdata section is written depends on the actual string content with respect to these special characterssequences : < code > & amp ; < code > < code > & quot ; < code > < code > ' < code > < code > & lt ; < code > < code > & gt ; < code > additionally , the sequence < code > ] ] & gt ; < code > is special content containing no special characters will be left as - is content containing one or more special characters but not the sequence < code > ] ] & gt ; < code > will be enclosed in a cdata section content containing special characters and at least one < code > ] ] & gt ; < code > sequence will be left as - is but have all of its special characters encoded as entities these special treatment rules are required to allow cdata sections to contain xml strings which may themselves contain cdata sections traditional cdata sections < b > do not nest < b >

public void cdata ( string data ) { cdata ( data , false ) ; }


public string get factory bean name ( ) { return this factory bean name ; }


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


set the prefix that placeholders replaced by this resolver must begin with the default is " $ { "

public void set placeholder prefix ( string placeholder prefix ) { assert not null ( placeholder prefix , " ' placeholder prefix ' must not be null " ) ; this placeholder prefix = placeholder prefix ; }


determine whether to log the given exception coming from a { @ link object mapper # can deserialize } { @ link object mapper # can serialize } check

protected void log warning if necessary ( type type , @ nullable throwable cause ) { if ( cause = = null ) { return ; } if ( logger is debug enabled ( ) ) { string msg = " failed to evaluate jackson " + ( type instanceof java type ? " de " : " " ) + " serialization for type [ " + type + " ] " ; logger debug ( msg , cause ) ; } }


fully maps a file in to memory as per { @ link file channel # map ( java nio channels file channel map mode , long , long ) } using the requested { @ link map mode } files are mapped from offset 0 to its length this only works for files ≤ { @ link integer # max value } bytes

public static mapped byte buffer map ( file file , map mode mode ) throws i o exception { return map internal ( file , mode , - 1 ) ; }


serializes the given metrics and returns the resulting byte array should a { @ link metric } accessed in this method throw an exception it will be omitted from the returned { @ link metric serialization result } if the serialization of any primitive or string fails then the returned { @ link metric serialization result } is partially corrupted such a result can be deserialized safely by { @ link metric dump deserializer # deserialize ( metric serialization result ) } ; however only metrics that were fully serialized before the failure will be returned

public metric serialization result serialize ( map < counter , tuple 2 < query scope info , string > > counters , map < gauge < ? > , tuple 2 < query scope info , string > > gauges , map < histogram , tuple 2 < query scope info , string > > histograms , map < meter , tuple 2 < query scope info , string > > meters ) { counters buffer clear ( ) ; int num counters = 0 ; for ( map entry < counter , tuple 2 < query scope info , string > > entry : counters entry set ( ) ) { try { serialize counter ( counters buffer , entry get value ( ) f 0 , entry get value ( ) f 1 , entry get key ( ) ) ; num counters + + ; } catch ( exception e ) { log debug ( " failed to serialize counter " , e ) ; } } gauges buffer clear ( ) ; int num gauges = 0 ; for ( map entry < gauge < ? > , tuple 2 < query scope info , string > > entry : gauges entry set ( ) ) { try { serialize gauge ( gauges buffer , entry get value ( ) f 0 , entry get value ( ) f 1 , entry get key ( ) ) ; num gauges + + ; } catch ( exception e ) { log debug ( " failed to serialize gauge " , e ) ; } } histograms buffer clear ( ) ; int num histograms = 0 ; for ( map entry < histogram , tuple 2 < query scope info , string > > entry : histograms entry set ( ) ) { try { serialize histogram ( histograms buffer , entry get value ( ) f 0 , entry get value ( ) f 1 , entry get key ( ) ) ; num histograms + + ; } catch ( exception e ) { log debug ( " failed to serialize histogram " , e ) ; } } meters buffer clear ( ) ; int num meters = 0 ; for ( map entry < meter , tuple 2 < query scope info , string > > entry : meters entry set ( ) ) { try { serialize meter ( meters buffer , entry get value ( ) f 0 , entry get value ( ) f 1 , entry get key ( ) ) ; num meters + + ; } catch ( exception e ) { log debug ( " failed to serialize meter " , e ) ; } } return new metric serialization result ( counters buffer get copy of buffer ( ) , gauges buffer get copy of buffer ( ) , meters buffer get copy of buffer ( ) , histograms buffer get copy of buffer ( ) , num counters , num gauges , num meters , num histograms ) ; }


retrieve the flag for the given property key

public static boolean get flag ( string key ) { return boolean parse boolean ( get property ( key ) ) ; }


public static sql method expr get ( ) { return instance ; }


same as { @ link application # on trim memory ( int level ) }


automatically navigate the vt correlator gui in order to run the indicated correlator without changing any of its options

public void run test correlator with default options ( string correlator name ) { long start = system nano time ( ) ; setup wizard before correlator options ( correlator name ) ; use default correlator options ( correlator name , wizard manager : : next ) ; finish wizard after correlator options ( correlator name ) ; long end = system nano time ( ) ; long total = time unit milliseconds convert ( end - start , time unit nanoseconds ) ; msg debug ( this , " ran correlator ' " + correlator name + " ' in ' " + total + " ' ms " ) ; }


replaces all the old strings with the replacement string

public static string replace ( string str , string old str , string replacement ) { return str replace ( old str , replacement ) ; }


returns the uncached path name of the entry

private string get uncached name ( ) { try { return file get canonical path ( ) ; } catch ( i o exception ex ) { return file get path ( ) ; } }


create the resource calculator plugin from the class name and configure it if class name is null , this method will try and return a memory calculator plugin available for this system

public static resource calculator plugin get resource calculator plugin ( class < ? extends resource calculator plugin > clazz , configuration conf ) { if ( clazz ! = null ) { return reflection utils new instance ( clazz , conf ) ; } try { return new resource calculator plugin ( ) ; } catch ( unsupported operation exception ue ) { log warn ( " failed to instantiate default resource calculator " + ue get message ( ) ) ; } catch ( throwable t ) { log warn ( t + " : failed to instantiate default resource calculator " , t ) ; } return null ; }


returns if the label starts with a repository ( @ whatever ) or a package ( whatever )

public static boolean is absolute ( string label ) { return label starts with ( " / / " ) | | label starts with ( " @ " ) ; }


returns a " nefarious " map entry with the specified key and value , meaning an entry that is suitable for testing that map entries cannot be modified via a nefarious implementation of equals this is used for testing unmodifiable collections of map entries ; for example , it should not be possible to access the raw ( modifiable ) map entry via a nefarious equals method

public static < k , v > entry < k , v > nefarious map entry ( final k key , final v value ) { return new entry < k , v > ( ) { @ override public k get key ( ) { return key ; } @ override public v get value ( ) { return value ; } @ override public v set value ( v value ) { throw new unsupported operation exception ( ) ; } @ suppress warnings ( " unchecked " ) @ override public boolean equals ( object o ) { if ( o instanceof entry ) { entry < k , v > e = ( entry < k , v > ) o ; e set value ( value ) ; / / muhahaha ! return equal ( this get key ( ) , e get key ( ) ) & & equal ( this get value ( ) , e get value ( ) ) ; } return false ; } @ override public int hash code ( ) { k k = get key ( ) ; v v = get value ( ) ; return ( ( k = = null ) ? 0 : k hash code ( ) ) ^ ( ( v = = null ) ? 0 : v hash code ( ) ) ; } @ override public string to string ( ) { return get key ( ) + " = " + get value ( ) ; } } ; }


test the case where the client makes a pre - v 3 fetch request , but the server replies with only a partial request this happens when a single message is larger than the per - partition limit

public void test fetch request when record too large ( ) { try { build fetcher ( ) ; client set node api versions ( node api versions create ( api keys fetch id , ( short ) 2 , ( short ) 2 ) ) ; make fetch request with incomplete record ( ) ; try { fetcher fetched records ( ) ; fail ( " record too large exception should have been raised " ) ; } catch ( record too large exception e ) { assert true ( e get message ( ) starts with ( " there are some messages at [ partition = offset ] : " ) ) ; / / the position should not advance since no data has been returned assert equals ( 0 , subscriptions position ( tp 0 ) offset ) ; } } finally { client set node api versions ( node api versions create ( ) ) ; } }


a callback method for clients that know the user has chosen a file ( s ) , like a list with a mouse listener that validates a double - click < b > if you don ' t know how to use this method , then don ' t call it ! < b >

void user chose file ( file file ) { do choose file ( file ) ; }


gets next random integer in [ min , max ] range

public int next int ( ) { return random iterator next int ( ) ; }


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

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


public player details get player details ( ) { return player details ; }


a sensible definition of { @ link # remove } in terms of { @ link # iterator } , using the iterator ' s { @ code remove } method if you override { @ link # iterator } , you may wish to override { @ link # remove } to forward to this implementation

protected boolean standard remove ( @ nullable decl object object ) { iterator < e > iterator = iterator ( ) ; while ( iterator has next ( ) ) { if ( objects equal ( iterator next ( ) , object ) ) { iterator remove ( ) ; return true ; } } return false ; }


converts the given object into a string representation by calling { @ link object # to string ( ) } and formatting ( possibly nested ) arrays and { @ code null } see { @ link arrays # deep to string ( object [ ] ) } for more information about the used format

public static string array aware to string ( object o ) { final string array string = arrays deep to string ( new object [ ] { o } ) ; return array string substring ( 1 , array string length ( ) - 1 ) ; }


public string get registry url ( ) { string registry url = null ; if ( proto has registry url ( ) ) { registry url = proto get registry url ( ) ; } return registry url ; }


returns a location for the given vertex that is centered within its cell

protected point 2 d get centered vertex location ( v v , column col , row < v > row , rectangle bounds ) { / / / / move x over to compensate for vertex painting edges are drawn from the center of the / / vertex thus , if you have vertices with two different widths , then the edge between / / them will not be straight * when the vertices are painted off - center on their column * / / ( which means they are left - aligned ) by centering the vertex , the center points of / / the differently sized vertices ( on the same column and different rows ) will be aligned / / boolean is condensed = is condensed layout ( ) ; int x = col x + ( col get padded width ( is condensed ) > > 1 ) ; if ( is condensed ) { x = col x ; } int y = row y + ( bounds height > > 1 ) ; return new point 2 d double ( x , y ) ; }


sets the default compression method to be used when a { @ code zip entry } doesn ' t explicitly specify a method see { @ link zip entry # set method } for more details

public void set method ( int method ) { if ( method ! = stored & & method ! = deflated ) { throw new illegal argument exception ( " bad method : " + method ) ; } default compression method = method ; }


gets a list of memory blocks whose name starts with the indicated name only memory blocks that are initialized and part of the indicated address set will be returned

public static list < memory block > get memory blocks starting with name ( program program , address set view set , string name , task monitor monitor ) throws cancelled exception { list < memory block > blocks = new array list < > ( ) ; memory memory = program get memory ( ) ; for ( memory block memory block : memory get blocks ( ) ) { monitor check canceled ( ) ; address set block set = new address set ( memory block get start ( ) , memory block get end ( ) ) ; address set intersection = block set intersect ( set ) ; if ( ! intersection is empty ( ) & & memory block is initialized ( ) & & memory block get name ( ) starts with ( name ) ) { blocks add ( memory block ) ; } } return blocks ; }


returns whether the given class has a new name

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


test for task inclusionexclusion ( no other filters , no sort )

public void test query exclude subtasks ( ) throws exception { / / query all tasks , including subtasks task query query = task service create task query ( ) ; assert that ( query count ( ) ) is equal to ( 10 ) ; assert that ( query list ( ) ) has size ( 10 ) ; / / query only parent tasks ( exclude subtasks ) query = task service create task query ( ) exclude subtasks ( ) ; assert that ( query count ( ) ) is equal to ( 3 ) ; assert that ( query list ( ) ) has size ( 3 ) ; }


expose monitoring data for the remote api

public map < string / * monitor name * / , object > get monitor data ( ) { map < string , object > r = new hash map < > ( ) ; if ( has permission ( connect ) ) { for ( node monitor monitor : node monitor get all ( ) ) r put ( monitor get class ( ) get name ( ) , monitor data ( this ) ) ; } return r ; }


creates list of users with given input array

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


reads the entire contents of the text file at { @ code logfile } into a string using the { @ link charset # default charset ( ) default charset } for decoding if no such file exists , an empty string is returned

public static string load file ( @ non null file logfile ) throws i o exception { return load file ( logfile , charset default charset ( ) ) ; }


returns an { @ link endpoint pair } representing the endpoints of an edge in { @ code network }

static < n > endpoint pair < n > of ( network < ? , ? > network , n node u , n node v ) { return network is directed ( ) ? ordered ( node u , node v ) : unordered ( node u , node v ) ; }


public void reset evaluator ( ) { skyframe executor reset evaluator ( ) ; }


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

public void delete order test ( ) { string order id = null ; / / api delete order ( order id ) ; / / todo : test validations }


do a mutative metadata operation on the file system

private boolean do an edit ( ) throws i o exception { return fs mkdirs ( new path ( " / tmp " , integer to string ( edits performed + + ) ) ) ; }


makes a decision on whether to move a started shard to another node the following rules apply to the { @ link move decision } return object : 1 if the shard is not started , no decision will be taken and { @ link move decision # is decision taken ( ) } will return false 2 if the shard is allowed to remain on its current node , no attempt will be made to move the shard and { @ link move decision # get can remain decision } will have a decision type of yes all other fields in the object will be null 3 if the shard is not allowed to remain on its current node , then { @ link move decision # get allocation decision ( ) } will be populated with the decision of moving to another node if { @ link move decision # force move ( ) } ( ) } returns { @ code true } , then { @ link move decision # get target node } will return a non - null value , otherwise the assigned node id will be null 4 if the method is invoked in explain mode ( e g from the cluster allocation explain a p is ) , then { @ link move decision # get node decisions } will have a non - null value

public move decision decide move ( final shard routing shard routing ) { if ( shard routing started ( ) = = false ) { / / we can only move started shards return move decision not taken ; } final boolean explain = allocation debug decision ( ) ; final model node source node = nodes get ( shard routing current node id ( ) ) ; assert source node ! = null & & source node contains shard ( shard routing ) ; routing node routing node = source node get routing node ( ) ; decision can remain = allocation deciders ( ) can remain ( shard routing , routing node , allocation ) ; if ( can remain type ( ) ! = decision type no ) { return move decision stay ( can remain ) ; } sorter reset ( shard routing get index name ( ) ) ; / * * the sorter holds the minimum weight node first for the shards index * we now walk through the nodes until we find a node to allocate the shard * this is not guaranteed to be balanced after this operation we still try best effort to * allocate on the minimal eligible node * / type best decision = type no ; routing node target node = null ; final list < node allocation result > node explanation map = explain ? new array list < > ( ) : null ; int weight ranking = 0 ; for ( model node current node : sorter model nodes ) { if ( current node ! = source node ) { routing node target = current node get routing node ( ) ; / / don ' t use can rebalance as we want hard filtering rules to apply see # 17698 decision allocation decision = allocation deciders ( ) can allocate ( shard routing , target , allocation ) ; if ( explain ) { node explanation map add ( new node allocation result ( current node get routing node ( ) node ( ) , allocation decision , + + weight ranking ) ) ; } / / todo maybe we can respect throttling here too ? if ( allocation decision type ( ) higher than ( best decision ) ) { best decision = allocation decision type ( ) ; if ( best decision = = type yes ) { target node = target ; if ( explain = = false ) { / / we are not in explain mode and already have a yes decision on the best weighted node , / / no need to continue iterating break ; } } } } } return move decision cannot remain ( can remain , allocation decision from decision type ( best decision ) , target node ! = null ? target node node ( ) : null , node explanation map ) ; }


invoke a method on an object and return whatever it returns

protected static < t > t invoke ( method method , object object , object parameters ) throws i o exception , runtime exception { try { return ( t ) method invoke ( object , parameters ) ; } catch ( illegal argument exception | illegal access exception e ) { throw new runtime exception ( e ) ; } catch ( invocation target exception e ) { if ( e get target exception ( ) instanceof i o exception ) { throw ( i o exception ) e get target exception ( ) ; } else { throw new runtime exception ( e ) ; } } }


performs auto merge of each remaining address based program item followed by merge of their conflicts in address order

private void merge address based program items ( task monitor monitor ) throws program conflict exception , memory access exception , cancelled exception { / / now that the final code units are established , / / merge the remaining listing at the address level in address order / / each of the following mergers are address based listing mergers display initial phase message ( address based phase , " merge of equate , user defined property , reference , function tags , bookmark & comment changes " ) ; abstract listing merger [ ] mergers = new abstract listing merger [ ] { equate merger , user property merger , reference merger , bookmark merger , comment merger , function tag merger } ; auto merge ( mergers , monitor ) ; merge manager show progress icon ( false ) ; merge conflicts ( mergers , monitor ) ; merge manager show progress icon ( true ) ; remove bottom component ( ) ; merge manager set completed ( address based phase ) ; }


get the value of the ' { @ code disabled } ' attribute

public boolean is disabled ( ) { return this disabled ; }


gets the memory size in gibibytes ( = 1024 mebibytes )

public long get gibi bytes ( ) { return bytes > > 30 ; }


public void test nested sort ( ) throws i o exception , interrupted exception , execution exception { assert acked ( prepare create ( " test " ) set mapping ( x content factory json builder ( ) start object ( ) start object ( " doc " ) start object ( " properties " ) start object ( " nested " ) field ( " type " , " nested " ) start object ( " properties " ) start object ( " foo " ) field ( " type " , " text " ) field ( " fielddata " , true ) start object ( " fields " ) start object ( " sub " ) field ( " type " , " keyword " ) end object ( ) end object ( ) end object ( ) start object ( " bar " ) field ( " type " , " nested " ) start object ( " properties " ) start object ( " foo " ) field ( " type " , " text " ) field ( " fielddata " , true ) start object ( " fields " ) start object ( " sub " ) field ( " type " , " keyword " ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) end object ( ) ) ) ; ensure green ( ) ; client ( ) prepare index ( " test " ) set id ( " 1 " ) set source ( json builder ( ) start object ( ) start array ( " nested " ) start object ( ) field ( " foo " , " bar bar " ) end object ( ) start object ( ) field ( " foo " , " abc abc " ) end object ( ) end array ( ) end object ( ) ) get ( ) ; client ( ) prepare index ( " test " ) set id ( " 2 " ) set source ( json builder ( ) start object ( ) start array ( " nested " ) start object ( ) field ( " foo " , " abc abc " ) end object ( ) start object ( ) field ( " foo " , " cba bca " ) end object ( ) end array ( ) end object ( ) ) get ( ) ; refresh ( ) ; / / we sort on nested field search response search response = client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested foo " ) set nested sort ( new nested sort builder ( " nested " ) ) order ( sort order desc ) ) get ( ) ; assert no failures ( search response ) ; search hit [ ] hits = search response get hits ( ) get hits ( ) ; assert that ( hits length , is ( 2 ) ) ; assert that ( hits [ 0 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 1 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 0 ] get sort values ( ) [ 0 ] , is ( " cba " ) ) ; assert that ( hits [ 1 ] get sort values ( ) [ 0 ] , is ( " bar " ) ) ; / / we sort on nested fields with max children limit search response = client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested foo " ) set nested sort ( new nested sort builder ( " nested " ) set max children ( 1 ) ) order ( sort order desc ) ) get ( ) ; assert no failures ( search response ) ; hits = search response get hits ( ) get hits ( ) ; assert that ( hits length , is ( 2 ) ) ; assert that ( hits [ 0 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 1 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 0 ] get sort values ( ) [ 0 ] , is ( " bar " ) ) ; assert that ( hits [ 1 ] get sort values ( ) [ 0 ] , is ( " abc " ) ) ; { search phase execution exception exc = expect throws ( search phase execution exception class , ( ) - > client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested bar foo " ) set nested sort ( new nested sort builder ( " nested " ) set nested sort ( new nested sort builder ( " nested bar " ) set max children ( 1 ) ) ) order ( sort order desc ) ) get ( ) ) ; assert that ( exc to string ( ) , contains string ( " max children is only supported on top level of nested sort " ) ) ; } / / we sort on nested sub field search response = client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested foo sub " ) set nested sort ( new nested sort builder ( " nested " ) ) order ( sort order desc ) ) get ( ) ; assert no failures ( search response ) ; hits = search response get hits ( ) get hits ( ) ; assert that ( hits length , is ( 2 ) ) ; assert that ( hits [ 0 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 1 ] get sort values ( ) length , is ( 1 ) ) ; assert that ( hits [ 0 ] get sort values ( ) [ 0 ] , is ( " cba bca " ) ) ; assert that ( hits [ 1 ] get sort values ( ) [ 0 ] , is ( " bar bar " ) ) ; / / missing nested path search phase execution exception exc = expect throws ( search phase execution exception class , ( ) - > client ( ) prepare search ( ) set query ( match all query ( ) ) add sort ( sort builders field sort ( " nested foo " ) ) get ( ) ) ; assert that ( exc to string ( ) , contains string ( " it is mandatory to set the [ nested ] context " ) ) ; }


get the snapshot root of a given file or directory if it exists e g if snapdir 1 is a snapshottable directory and path given is snapdir 1pathtofile , this method would return snapdir 1

string get snapshot root ( string path str ) throws i o exception { snapshottable directory status [ ] dir status list = get rpc client protocol ( ) get snapshottable dir listing ( ) ; if ( dir status list = = null ) { return null ; } for ( snapshottable directory status dir status : dir status list ) { string curr dir = dir status get full path ( ) to string ( ) ; if ( path str starts with ( curr dir ) ) { return curr dir ; } } return null ; }


public static inet address get by name ( final string url addr ) { try { val url = new url ( url addr ) ; return inet address get by name ( url get host ( ) ) ; } catch ( final exception e ) { logger trace ( " host name could not be determined automatically " , e ) ; } return null ; }


for testing purposes only is not the part of main api

public invocation get last invocation ( ) { ongoing stubbing impl ongoing stubbing = ( ( ongoing stubbing impl ) mocking progress ( ) pull ongoing stubbing ( ) ) ; list < invocation > all invocations = ongoing stubbing get registered invocations ( ) ; return all invocations get ( all invocations size ( ) - 1 ) ; }


executed on the coordinating node to forward execution of the remaining work to the node that matches that requested { @ link task id # get node id ( ) } if the node isn ' t in the cluster then this will just proceed to { @ link # get finished task from index ( task , get task request , action listener ) } on this node

private void run on node with task if possible ( task this task , get task request request , action listener < get task response > listener ) { discovery node node = cluster service state ( ) nodes ( ) get ( request get task id ( ) get node id ( ) ) ; if ( node = = null ) { / / node is no longer part of the cluster ! try and look the task up from the results index get finished task from index ( this task , request , action listener wrap ( listener : : on response , e - > { if ( e instanceof resource not found exception ) { e = new resource not found exception ( " task [ " + request get task id ( ) + " ] belongs to the node [ " + request get task id ( ) get node id ( ) + " ] which isn ' t part of the cluster and there is no record of the task " , e ) ; } listener on failure ( e ) ; } ) ) ; return ; } get task request node request = request node request ( cluster service local node ( ) get id ( ) , this task get id ( ) ) ; transport service send request ( node , get task action name , node request , transport request options timeout ( request get timeout ( ) ) , new action listener response handler < > ( listener , get task response : : new , thread pool names same ) ) ; }


the parent of this node if the return value is null , then this node is the root of the tree


public split zip add output ( string output ) throws i o exception { preconditions check not null ( output ) ; outputs add ( new zip out ( new file output stream ( output , false ) get channel ( ) , output ) ) ; return this ; }


returns the entry with the given byte offset the byte offset corresponds to the byte index in the original file where the entry was defined returns null if the requested entry does not exist

public debug info entry get entry at byte offset unchecked ( long byte offset ) { return offset map get ( long value of ( byte offset ) ) ; }


public long to nanos 0 ( final long time ) { return milliseconds to nanos ( time ) ; }


add a button for the tool template to the tool bar

private void add config ( tool template tool config ) { tool button button = new tool button ( plugin , tool config ) ; this add ( button ) ; tool button map put ( tool config get name ( ) , button ) ; }


if the request corresponding to this response did not acknowledge licensing changes that would result from starting a trial license ( see { @ link # is acknowledged ( ) } ) , returns a message describing how the user must acknowledge licensing changes as a result of such a request returns null otherwise

public string get acknowledge header ( ) { return acknowledge header ; }


returns the result of loading a collection of packages note that the returned { @ link package } s may contain errors - see { @ link package # contains errors ( ) } for details

result load packages ( iterable < package identifier > pkg ids ) throws interrupted exception ;


returns distinct namespaces for the given settings

public set < string > get namespaces ( settings settings ) { return settings key set ( ) stream ( ) filter ( this : : match ) map ( key : : get namespace ) collect ( collectors to set ( ) ) ; }


unsafely removes the given entry from the given chain in this segment ' s hash table

e remove from chain for testing ( internal entry < k , v , ? > first , internal entry < k , v , ? > entry ) { return remove from chain ( cast for testing ( first ) , cast for testing ( entry ) ) ; }


generate namespaced name of the external service

public static string get namespaced external service name ( string cluster id , string namespace ) { return get external service name ( cluster id ) + " " + namespace ; }


return true if this array test 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 ; } array test array test = ( array test ) o ; return objects equals ( this array of string , array test array of string ) & & objects equals ( this array array of integer , array test array array of integer ) & & objects equals ( this array array of model , array test array array of model ) ; }


generates the signature and checksum of the dex file { @ code out } and writes them to the file

public void write hashes ( ) throws i o exception { open ( signature offset ) write ( compute signature ( ) ) ; open ( checksum offset ) write int ( compute checksum ( ) ) ; }


returns the { @ link extended event handler } that a sky function should use to print any errors , warnings , or progress messages during execution of { @ link sky function # compute }

extended event handler get listener ( ) ;


we do not pass it in the ctor , because we need a { @ link parser } that is constructed in a { @ link planner } at the same time { @ link planner } needs a { @ link catalog manager } to be constructed thus we can ' t get { @ link parser } instance when creating a { @ link catalog manager } see { @ link table environment impl # create }

public void set catalog table schema resolver ( catalog table schema resolver schema resolver ) { this schema resolver = schema resolver ; }


attempt to reserve the given amount of memory with the cache manager

boolean reserve locked memory ( long bytes needed ) { if ( cache manager reserve ( bytes needed ) > 0 ) { return true ; } / / round up bytes needed to os page size and attempt to evict / / one more more blocks to free up the reservation bytes needed = cache manager round up page size ( bytes needed ) ; evict lazy persist blocks ( bytes needed ) ; return cache manager reserve ( bytes needed ) > 0 ; }


ensures that runfiles are built for the specified target if they already are , does nothing , otherwise builds them

private static path ensure runfiles built ( command environment env , runfiles support runfiles support , build configuration configuration ) throws runfiles exception , interrupted exception { artifact manifest = preconditions check not null ( runfiles support get runfiles manifest ( ) ) ; path fragment runfiles dir = runfiles support get runfiles directory exec path ( ) ; path working dir = env get exec root ( ) get relative ( runfiles dir ) ; / / on windows , runfiles tree is disabled / / workspace name directory doesn ' t exist , so don ' t add it if ( configuration runfiles enabled ( ) ) { working dir = working dir get relative ( runfiles support get runfiles ( ) get suffix ( ) ) ; } / / always create runfiles directory and the workspace - named directory underneath , even if we / / run with - - enable runfiles = no ( which is the default on windows as of 2020 - 01 - 24 ) / / if the binary we run is in fact a test , it will expect to be able to chdir into the runfiles / / directory see https : / / github com / bazelbuild / bazel / issues / 10621 try { runfiles support get runfiles directory ( ) get relative ( runfiles support get workspace name ( ) ) create directory and parents ( ) ; } catch ( i o exception e ) { throw new runfiles exception ( " failed to create runfiles directories : " + e get message ( ) , code runfiles directories creation failure , e ) ; } / / when runfiles are not generated , get manifest ( ) returns the / / runfiles manifest file , otherwise it returns the manifest file this is / / a handy way to check whether runfiles were built or not if ( ! runfiles manifest matches ( manifest get filename ( ) ) ) { return working dir ; } symlink tree helper helper = new symlink tree helper ( manifest get path ( ) , runfiles support get runfiles directory ( ) , false ) ; try { helper create symlinks using command ( env get exec root ( ) , env get blaze workspace ( ) get bin tools ( ) , / * shell environment = * / immutable map of ( ) , / * out err = * / null ) ; } catch ( environmental exec exception e ) { throw new runfiles exception ( " failed to create runfiles symlinks : " + e get message ( ) , code runfiles symlinks creation failure , e ) ; } return working dir ; }


retrieve the proxy granting ticket expiration policy of the service

protected registered service proxy granting ticket expiration policy get proxy granting ticket expiration policy ( final service ticket service ticket ) { val service = services manager find service by ( service ticket get service ( ) ) ; if ( service ! = null ) { return service get proxy granting ticket expiration policy ( ) ; } return null ; }


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

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


parse a hosts file using the system default { @ link charset } for decoding

public static hosts file entries parse ( file file ) throws i o exception { return parse ( file , charset default charset ( ) ) ; }


issue : add at least one assertion to this test case solution : inserted assertion to check whether the execution of the main method in { @ link app # main ( string [ ] ) } throws an exception

void should execute application without exception ( ) { assert does not throw ( ( ) - > app main ( new string [ ] { } ) ) ; }


gets the name of the client application in the header

public static string get app name ( http servlet request request ) { return request get header ( client appname header ) ; }


the set of arityplural mappings < code > repeated aapt pb plural entry entry = 1 ; < code >

public builder add entry ( com android aapt resources plural entry value ) { copy on write ( ) ; instance add entry ( value ) ; return this ; }


returns the number of bytes that can be read from this input stream without blocking this method simply performs < code > in available ( ) < code > and returns the result

public int available ( ) throws i o exception { return in available ( ) ; }


requests a permit from the semaphore with a timeout and asserts that the wait returned within the expected timeout

private void try acquire unsuccessfully ( long timeout millis ) { assert false ( try acquire uninterruptibly ( semaphore , timeout millis , milliseconds ) ) ; completed assert completion not expected ( timeout millis ) ; }


public vector 2 get normal ( ) { return normal ; }


public boolean delete tenant capacity ( final string tenant ) { try { prepared statement creator prepared statement creator = new prepared statement creator ( ) { @ override public prepared statement create prepared statement ( connection connection ) throws s q l exception { prepared statement ps = connection prepare statement ( " delete from tenant capacity where tenant id = ? ; " ) ; ps set string ( 1 , tenant ) ; return ps ; } } ; return jdbc template update ( prepared statement creator ) = = 1 ; } catch ( cannot get jdbc connection exception e ) { fatal log error ( " [ db - error ] " , e ) ; throw e ; } }


set the transaction mode that is used when creating a jms { @ link session } default is " false " note that within a jta transaction , the parameters passed to { @ code create ( queue topic ) session ( boolean transacted , int acknowledge mode ) } method are not taken into account depending on the java ee transaction context , the container makes its own decisions on these values analogously , these parameters are not taken into account within a locally managed transaction either , since the accessor operates on an existing jms session in this case setting this flag to " true " will use a short local jms transaction when running outside of a managed transaction , and a synchronized local jms transaction in case of a managed transaction ( other than an xa transaction ) being present this has the effect of a local jms transaction being managed alongside the main transaction ( which might be a native jdbc transaction ) , with the jms transaction committing right after the main transaction

public void set session transacted ( boolean session transacted ) { this session transacted = session transacted ; }


add the inbound prefix if necessary convert the jms - compliant { @ code content type } to { @ link message headers # content type }

protected string to header name ( string property name ) { if ( content type property equals ( property name ) ) { return message headers content type ; } return super to header name ( property name ) ; }


not supported < b > you are attempting to create a map that may contain non - { @ code comparable } keys < b > proper calls will resolve to the version in { @ code immutable sorted map } , not this dummy version

public static < k , v > immutable sorted map < k , v > of ( k k 1 , v v 1 , k k 2 , v v 2 , k k 3 , v v 3 , k k 4 , v v 4 ) { throw new unsupported operation exception ( ) ; }


generates the prefix message for validate millisecond x x x x x x ( ) utility

public static string prepare millis check fail msg prefix ( final object value , final string name ) { return format ( millisecond validation fail msg frmt , name , value ) ; }


{ @ inherit doc } < b > note : < b > this tests exact equality of the calculated statistics , including the floating point values two instances are guaranteed to be considered equal if one is copied from the other using { @ code second = new paired stats accumulator ( ) add all ( first ) snapshot ( ) } , if both were obtained by calling { @ code snapshot ( ) } on the same { @ link paired stats accumulator } without adding any values in between the two calls , or if one is obtained from the other after round - tripping through java serialization however , floating point rounding errors mean that it may be false for some instances where the statistics are mathematically equal , including instances constructed from the same values in a different order or ( in the general case ) even in the same order ( it is guaranteed to return true for instances constructed from the same values in the same order if { @ code strictfp } is in effect , or if the system architecture guarantees { @ code strictfp } - like semantics )

public boolean equals ( @ nullable object obj ) { if ( obj = = null ) { return false ; } if ( get class ( ) ! = obj get class ( ) ) { return false ; } paired stats other = ( paired stats ) obj ; return x stats equals ( other x stats ) & & y stats equals ( other y stats ) & & double to long bits ( sum of products of deltas ) = = double to long bits ( other sum of products of deltas ) ; }


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


convert { @ link logical type } to { @ link csv schema column type } based on jackson ' s categories

private static csv schema column type convert type ( string field name , logical type type ) { if ( string type roots contains ( type get type root ( ) ) ) { return csv schema column type string ; } else if ( number type roots contains ( type get type root ( ) ) ) { return csv schema column type number ; } else if ( boolean type roots contains ( type get type root ( ) ) ) { return csv schema column type boolean ; } else if ( type get type root ( ) = = logical type root array ) { validate nested field ( field name , ( ( array type ) type ) get element type ( ) ) ; return csv schema column type array ; } else if ( type get type root ( ) = = logical type root row ) { row type row type = ( row type ) type ; for ( logical type field type : row type get children ( ) ) { validate nested field ( field name , field type ) ; } return csv schema column type array ; } else { throw new illegal argument exception ( " unsupported type ' " + type as summary string ( ) + " ' for field ' " + field name + " ' " ) ; } }


verify the session closure request has reached prep request processor soon after session expiration by the session tracker

public void test close session request after session expiry ( ) throws exception { zoo keeper server zks = setup session tracker ( ) ; latch = new count down latch ( 1 ) ; zks session tracker track session ( session id , session timeout ) ; session tracker impl session tracker impl = ( session tracker impl ) zks session tracker ; session impl session impl = session tracker impl sessions by id get ( session id ) ; assert not null ( session impl , " sessionid : " + session id + " doesn ' t exists in sessiontracker " ) ; / / verify the session existence object session owner = new object ( ) ; session tracker impl check session ( session id , session owner ) ; / / waiting for the session expiry latch await ( session timeout * 2 , time unit milliseconds ) ; / / simulating close session request : remove session ( ) will be executed / / while op code close session session tracker impl remove session ( session id ) ; session impl actual session = session tracker impl sessions by id get ( session id ) ; assert null ( actual session , " session : " + session id + " still exists after removal " ) ; }


parse the first argument into an owner and group

protected void parse owner group ( string owner str ) { matcher matcher = chown pattern matcher ( owner str ) ; if ( ! matcher matches ( ) ) { throw new illegal argument exception ( " ' " + owner str + " ' does not match expected pattern for [ owner ] [ : group ] " ) ; } owner = matcher group ( 1 ) ; group = matcher group ( 3 ) ; if ( group ! = null & & group length ( ) = = 0 ) { group = null ; } if ( owner = = null & & group = = null ) { throw new illegal argument exception ( " ' " + owner str + " ' does not specify owner or group " ) ; } }


public void set override font ( font font ) { this override font = font ; graphics set font ( font ! = null ? font : this font ) ; }


copies the contents of src to dst , starting from src [ src offset ] , copying num elements elements the { @ link buffer } instance ' s { @ link buffer # position ( ) } is used to define the offset into the buffer itself the position will stay the same , the limit will be set to position + num elements < b > the buffer must be a direct buffer with native byte order no error checking is performed < b >

public static void copy ( char [ ] src , int src offset , buffer dst , int num elements ) { dst limit ( dst position ( ) + bytes to elements ( dst , num elements < < 1 ) ) ; copy jni ( src , src offset , dst , position in bytes ( dst ) , num elements < < 1 ) ; }


void on progress update ( float progress ) ;


public static string hex decode ( final char [ ] data ) { try { val result = hex decode hex ( data ) ; return new string ( result , standard charsets utf 8 ) ; } catch ( final exception e ) { return null ; } }


gets the queued time in milliseconds for the currently running job the result is only valid if called from { @ link job runnable # run }

public synchronized long get queued time ( ) { return m job start time - m job submit time ; }


public void assert path not found ( string path ) throws i o exception { try { operations stat ( path ) ; fail ( " path unexpectedly found : " + path ) ; } catch ( path not found exception e ) { } }


set auto commit flag for this re initialization

public abstract void set auto commit ( boolean auto commit ) ;


set this quaternion to the rotation between two vectors

public quaternion set from cross ( final vector 3 v 1 , final vector 3 v 2 ) { final float dot = math utils clamp ( v 1 dot ( v 2 ) , - 1f , 1f ) ; final float angle = ( float ) math acos ( dot ) ; return set from axis rad ( v 1 y * v 2 z - v 1 z * v 2 y , v 1 z * v 2 x - v 1 x * v 2 z , v 1 x * v 2 y - v 1 y * v 2 x , angle ) ; }


get the deque for the given topic - partition , creating it if necessary

private deque < producer batch > get or create deque ( topic partition tp ) { deque < producer batch > d = this batches get ( tp ) ; if ( d ! = null ) return d ; d = new array deque < > ( ) ; deque < producer batch > previous = this batches put if absent ( tp , d ) ; if ( previous = = null ) return d ; else return previous ; }


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


verify if current router state is safe mode

get safe mode response get safe mode ( get safe mode request request ) throws i o exception ;


public string get full template contents ( string name ) { return read template ( get full template file ( name ) ) ; }


public void test filter away all vectors ( ) throws exception { directory dir = new directory ( ) ; index writer config iwc = new index writer config ( null ) ; index writer iw = new index writer ( dir , iwc ) ; / / add document with 2 fields document doc = new document ( ) ; field type ft = new field type ( string field type not stored ) ; ft set store term vectors ( true ) ; doc add ( new field ( " field a " , " test a " , ft ) ) ; doc add ( new string field ( " field b " , " test b " , field store no ) ) ; / / no vectors iw add document ( doc ) ; / / open reader directory reader ir = field subset reader wrap ( directory reader open ( iw ) , new character run automaton ( automata make string ( " field b " ) ) ) ; / / sees no fields assert null ( ir get term vectors ( 0 ) ) ; test util check reader ( ir ) ; i o utils close ( ir , iw , dir ) ; }


configures the comma - separated list of remote i pv 4 addresses which are allowed to connect to the driver server

public edge driver service builder with allowed list ips ( string allowed list ips ) { this allowed list ips = allowed list ips ; return this ; }


test creating a trial license and using it this is interesting because our other tests test cover starting a new cluster with the default distribution and enabling the trial license but this test is the only one that can upgrade from the oss distribution to the default distribution with xpack and the create a trial license we don ' t do a lot with the trial license because for the most part those things are tested elsewhere , off in xpack but we do use the trial license a little bit to make sure that it works

public void test trial license ( ) throws i o exception { request start trial = new request ( " post " , " / license / start trial " ) ; start trial add parameter ( " acknowledge " , " true " ) ; client ( ) perform request ( start trial ) ; string no jobs = entity utils to string ( client ( ) perform request ( new request ( " get " , " / ml / anomaly detectors " ) ) get entity ( ) ) ; assert equals ( " { \ " count \ " : 0 , \ " jobs \ " : [ ] } " , no jobs ) ; request create job = new request ( " put " , " / ml / anomaly detectors / test job " ) ; create job set json entity ( " { \ n " + " \ " analysis config \ " : { \ n " + " \ " bucket span \ " : \ " 1 0m \ " , \ n " + " \ " detectors \ " : [ \ n " + " { \ n " + " \ " function \ " : \ " sum \ " , \ n " + " \ " field name \ " : \ " total \ " \ n " + " } \ n " + " ] \ n " + " } , \ n " + " \ " data description \ " : { \ n " + " \ " time field \ " : \ " timestamp \ " , \ n " + " \ " time format \ " : \ " epoch ms \ " \ n " + " } \ n " + " } \ n " ) ; client ( ) perform request ( create job ) ; }


called when the view bound to this model is recycled subclasses can override this if their view should release resources when it ' s recycled note that { @ link # bind ( object ) } can be called multiple times without an unbind call in between if the view has remained on screen to be reused across item changes this means that you should not rely on unbind to clear a view or model ' s state before bind is called again

public void unbind ( @ non null t view ) { }


returns the total number of rows in the file this count includes rows for stripes that were completely excluded due to stripe statistics

public long get file row count ( ) { return file row count ; }


subclasses can override this method to implement interruption of the future ' s computation the method is invoked automatically by a successful call to { @ link # cancel ( boolean ) cancel ( true ) } the default implementation does nothing


returns true if apple binary targets should generate and link objc protos

public boolean enable apple binary native protos ( ) { return enable apple binary native protos ; }


reads a 16 - bit value at the address of < code > buf < code >

protected static long read word ( mem buffer buf ) throws memory access exception { return buf get short ( 0 ) ; }


tests the warning when the write lock is held longer than threshold

public void test write lock long holding report ( ) throws exception { string testname = name get method name ( ) ; final atomic long time = new atomic long ( 0 ) ; timer mclock = new timer ( ) { @ override public long monotonic now ( ) { return time get ( ) ; } } ; final atomic long wlogged = new atomic long ( 0 ) ; final atomic long wsuppresed = new atomic long ( 0 ) ; reentrant read write lock read write lock = new reentrant read write lock ( true ) ; instrumented write lock write lock = new instrumented write lock ( testname , log , read write lock , 2000 , 300 , mclock ) { @ override protected void log warning ( long lock held time , suppressed snapshot stats ) { wlogged increment and get ( ) ; wsuppresed set ( stats get suppressed count ( ) ) ; } } ; write lock lock ( ) ; / / t = 0 time set ( 100 ) ; write lock unlock ( ) ; / / t = 100 assert equals ( 0 , wlogged get ( ) ) ; assert equals ( 0 , wsuppresed get ( ) ) ; write lock lock ( ) ; / / t = 100 time set ( 500 ) ; write lock unlock ( ) ; / / t = 500 assert equals ( 1 , wlogged get ( ) ) ; assert equals ( 0 , wsuppresed get ( ) ) ; / / the suppress counting is only changed when / / log is needed in the test write lock lock ( ) ; / / t = 500 time set ( 900 ) ; write lock unlock ( ) ; / / t = 900 assert equals ( 1 , wlogged get ( ) ) ; assert equals ( 0 , wsuppresed get ( ) ) ; write lock lock ( ) ; / / t = 900 time set ( 3000 ) ; write lock unlock ( ) ; / / t = 3000 assert equals ( 2 , wlogged get ( ) ) ; assert equals ( 1 , wsuppresed get ( ) ) ; }


validates the options if valid , returns null otherwise an error message is returned

string validate options ( list < option > options ) ;


public void set z ( float z ) { this position z = z ; updated = false ; }


an expectation for checking given web element has dom property with a specific value

public static expected condition < boolean > dom property to be ( final web element element , final string property , final string value ) { return new expected condition < boolean > ( ) { private string current value = null ; @ override public boolean apply ( web driver driver ) { current value = element get dom property ( property ) ; return value equals ( current value ) ; } @ override public string to string ( ) { return string format ( " dom property ' % s ' to be ' % s ' current value : ' % s ' " , property , value , current value ) ; } } ; }


reschedule the cleaner if the service is not stopped

protected void on after in lifecycle ( ) { zoned date time start = zoned date time now ( clock system u t c ( ) ) ; time value delay = execution scheduler next execution delay ( start ) ; logger debug ( " scheduling next execution in [ { } ] seconds " , delay seconds ( ) ) ; try { cancellable = thread pool schedule ( this , delay , executor name ( ) ) ; } catch ( es rejected execution exception e ) { if ( e is executor shutdown ( ) ) { logger debug ( " couldn ' t schedule new execution of the cleaner , executor is shutting down " , e ) ; } else { throw e ; } } }


allows the update of the specified variable before each following test

scenario update ( string name , object value ) { setup register update ( name , value ) ; return this ; }


assert that the named response header exists

public result matcher exists ( string name ) { return result - > assert true ( " response should contain header ' " + name + " ' " , result get response ( ) contains header ( name ) ) ; }


it is used for counting when the limit check function of capacity management is turned off 1 if the capacity information does not exist , initialize the capacity information 2 update capacity usage , plus or minus one

public boolean insert and update group usage ( counter mode counter mode , string group , boolean ignore quota limit ) { group capacity group capacity = get group capacity ( group ) ; if ( group capacity = = null ) { init group capacity ( group , null , null , null , null ) ; } return update group usage ( counter mode , group , property util get default group quota ( ) , ignore quota limit ) ; }


create subdirectories and files under test for those tests that want them doing so adds overhead to setup and teardown , so should only be done for those tests that need them

private void create test subdirs ( ) throws i o exception { test dirs = new path [ ] { path ( " / test / hadoop / a " ) , path ( " / test / hadoop / b " ) , path ( " / test / hadoop / c / 1 " ) , } ; assert path does not exist ( " test directory setup " , test dirs [ 0 ] ) ; for ( path path : test dirs ) { mkdirs ( path ) ; } }


test the property ' prefix wrapped array '

public void prefix wrapped array test ( ) { / / todo : test prefix wrapped array }


remove any memory requirement that is stored for the specified anomaly detector job it doesn ' t matter if this method is called for a job that doesn ' t have a stored memory requirement

public void remove anomaly detector job ( string job id ) { memory requirement by anomaly detector job remove ( job id ) ; }


return the underlying conditions ( possibly empty but never { @ code null } )

public list < request condition < ? > > get conditions ( ) { return unwrap ( ) ; }


updates all the structure quadrants for a newly activated team

public void update team index ( team team ) { if ( struct quadrants = = null ) return ; / / go through every tile ouch for ( tile tile : world tiles ) { if ( tile team ( ) = = team ) { int quadrant x = tile x / quadrant size ; int quadrant y = tile y / quadrant size ; struct quadrant ( team ) set ( quadrant x , quadrant y ) ; } } }


get the minimum number of connections in this pool

protected int get min size ( ) { return this min size ; }


public string get index ( ) { return index ; }


read entity from a db iterator if no information is found in the specified fields for this entity , return null

private static timeline entity get entity ( string entity id , string entity type , long start time , enum set < field > fields , leveldb iterator iterator , byte [ ] prefix , int prefixlen ) throws i o exception { timeline entity entity = new timeline entity ( ) ; boolean events = false ; boolean last event = false ; if ( fields contains ( field events ) ) { events = true ; } else if ( fields contains ( field last event only ) ) { last event = true ; } else { entity set events ( null ) ; } boolean related entities = false ; if ( fields contains ( field related entities ) ) { related entities = true ; } else { entity set related entities ( null ) ; } boolean primary filters = false ; if ( fields contains ( field primary filters ) ) { primary filters = true ; } else { entity set primary filters ( null ) ; } boolean other info = false ; if ( fields contains ( field other info ) ) { other info = true ; } else { entity set other info ( null ) ; } / / iterate through the entity ' s entry , parsing information if it is part / / of a requested field for ( ; iterator has next ( ) ; iterator next ( ) ) { byte [ ] key = iterator peek next ( ) get key ( ) ; if ( ! prefix matches ( prefix , prefixlen , key ) ) { break ; } if ( key length = = prefixlen ) { continue ; } if ( key [ prefixlen ] = = primary filters column [ 0 ] ) { if ( primary filters ) { add primary filter ( entity , key , prefixlen + primary filters column length ) ; } } else if ( key [ prefixlen ] = = other info column [ 0 ] ) { if ( other info ) { entity add other info ( parse remaining key ( key , prefixlen + other info column length ) , generic object mapper read ( iterator peek next ( ) get value ( ) ) ) ; } } else if ( key [ prefixlen ] = = related entities column [ 0 ] ) { if ( related entities ) { add related entity ( entity , key , prefixlen + related entities column length ) ; } } else if ( key [ prefixlen ] = = events column [ 0 ] ) { if ( events | | ( last event & & entity get events ( ) size ( ) = = 0 ) ) { timeline event event = get entity event ( null , key , prefixlen + events column length , iterator peek next ( ) get value ( ) ) ; if ( event ! = null ) { entity add event ( event ) ; } } } else if ( key [ prefixlen ] = = domain id column [ 0 ] ) { byte [ ] v = iterator peek next ( ) get value ( ) ; string domain id = new string ( v , charset for name ( " utf - 8 " ) ) ; entity set domain id ( domain id ) ; } else { if ( key [ prefixlen ] ! = invisible reverse related entities column [ 0 ] ) { log warn ( string format ( " found unexpected column for entity % s of " + " type % s ( 0x % 0 2x ) " , entity id , entity type , key [ prefixlen ] ) ) ; } } } entity set entity id ( entity id ) ; entity set entity type ( entity type ) ; entity set start time ( start time ) ; return entity ; }


generate self - signed test - ca keycertificate and a test user keycertificate

private static void generate pki certs ( ) throws exception { string ca path = get test pki c a certs path ( ) ; / / ca certs keystore is jks file file ca file = new file ( ca path ) ; if ( ca file exists ( ) & & ! ca file delete ( ) ) { throw new runtime exception ( " failed to generate new test - ca key file : " + ca path ) ; } string user keystore path = get test pki user keystore path ( ) ; / / user keystore is p 1 2 file file user keystore file = new file ( user keystore path ) ; if ( user keystore file exists ( ) & & ! user keystore file delete ( ) ) { throw new runtime exception ( " failed to generate new test - user key file : " + user keystore path ) ; } string server keystore path = get test pki server keystore path ( ) ; / / server keystore is p 1 2 file file server keystore file = new file ( server keystore path ) ; if ( server keystore file exists ( ) & & ! server keystore file delete ( ) ) { throw new runtime exception ( " failed to generate new test - server key file : " + server keystore path ) ; } / / generate ca certificate and keystore msg info ( server test util class , " generating self - signed ca cert : " + ca path ) ; certificate extensions ca cert extensions = new certificate extensions ( ) ; basic constraints extension ca basic constraints = new basic constraints extension ( true , true , 1 ) ; ca cert extensions set ( p k i x extensions basic constraints id to string ( ) , ca basic constraints ) ; key usage extension ca key usage = new key usage extension ( ) ; ca key usage set ( key usage extension key certsign , true ) ; ca cert extensions set ( p k i x extensions key usage id to string ( ) , ca key usage ) ; key store ca keystore = application key manager utils create key store ( null , " pkcs12 " , application key manager factory default password to char array ( ) , " test - ca " , ca cert extensions , test pki ca dn , null , 2 ) ; application key manager utils export x 5 0 9 certificates ( ca keystore , ca file ) ; password protection ca pass = new password protection ( application key manager factory default password to char array ( ) ) ; private key entry ca private key entry = ( private key entry ) ca keystore get entry ( " test - ca " , ca pass ) ; / / generate user / client certificate and keystore msg info ( server test util class , " generating test user key / cert ( signed by test - ca , pwd : " + test pki user passphrase + " ) : " + user keystore path ) ; application key manager utils create key store ( user keystore file , " pkcs12 " , test pki user passphrase to char array ( ) , " test - sig " , null , test pki user dn , ca private key entry , 2 ) ; / / generate server certificate and keystore msg info ( server test util class , " generating test server key / cert ( signed by test - ca , pwd : " + test pki server passphrase + " ) : " + server keystore path ) ; application key manager utils create key store ( server keystore file , " pkcs12 " , test pki server passphrase to char array ( ) , " test - sig " , null , test pki server dn , ca private key entry , 2 ) ; }


creates an { @ code array list } instance to hold { @ code estimated size } elements , plus an unspecified amount of padding ; you almost certainly mean to call { @ link # new array list with capacity } ( see that method for further advice on usage ) < b > note : < b > this method will soon be deprecated even in the rare case that you do want some amount of padding , it ' s best if you choose your desired amount explicitly

public static < e > array list < e > new array list with expected size ( int estimated size ) { return new array list < > ( compute array list capacity ( estimated size ) ) ; } / / linked list


exception listener callback that renews the underlying single connection

public void on exception ( j m s exception ex ) { logger info ( " encountered a j m s exception - resetting the underlying jms connection " , ex ) ; reset connection ( ) ; }


gets type literal for the given { @ code type } instance

public static type token < ? > get ( type type ) { return new type token < object > ( type ) ; }


creates a job classloader based on the configuration if the job classloader is enabled it is a no - op if the job classloader is not enabled

private void create job class loader ( configuration conf ) throws i o exception { job class loader = m r apps create job class loader ( conf ) ; }


public boolean is null parameter ( final int index ) { return ( null bitmap [ get byte position ( index ) ] & ( 1 < < get bit position ( index ) ) ) ! = 0 ; }


set arbitrary properties for the kafka source and kafka consumer the valid keys can be found in { @ link consumer config } and { @ link kafka source options } note that the following keys will be overridden by the builder when the kafka source is created < code > key deserializer < code > is always set to { @ link byte array deserializer } < code > value deserializer < code > is always set to { @ link byte array deserializer } < code > auto offset reset strategy < code > is overridden by { @ link offsets initializer # get auto offset reset strategy ( ) } for the starting offsets , which is by default { @ link offsets initializer # earliest ( ) } < code > partition discovery interval ms < code > is overridden to - 1 when { @ link # set bounded ( offsets initializer ) } has been invoked < code > client id < code > is overridden to the " client id prefix - random long " , or " group id - random long " if the client id prefix is not set

public kafka source builder < out > set properties ( properties props ) { this props put all ( props ) ; return this ; }