public void add ( string operation , duration duration , boolean success ) { duration stats duration stats ; string key = operation ; if ( ! success ) { key + = " - fail " ; } synchronized ( this ) { duration stats = stats table get ( key ) ; if ( duration stats = = null ) { duration stats = new duration stats ( key ) ; stats table put ( key , duration stats ) ; } } synchronized ( duration stats ) { duration stats add ( duration ) ; } }


return the qualified name of the given method , consisting of fully qualified interfaceclass name + " " + method name

public static string get qualified method name ( method method , @ nullable class < ? > clazz ) { assert not null ( method , " method must not be null " ) ; return ( clazz ! = null ? clazz : method get declaring class ( ) ) get name ( ) + ' ' + method get name ( ) ; }


public void test disassembler multipath instruction conflict 1 ( ) throws exception { / / instr at 24 is tail of nfctx but we need to add to program builder to register / / instruction location for verification purpose only program builder add bytes fallthrough ( 24 ) ; program builder add bytes branch conditional ( 10 , 20 ) ; program builder add bytes branch conditional ( 12 , 30 ) ; program builder add bytes return ( 14 ) ; program builder add bytes fallthrough ( 20 ) ; program builder add bytes fallthrough set no flow context ( 22 , 2 , 18 ) ; / / overwrites instr bytes at 24 program builder add bytes branch ( 26 , 40 ) ; program builder add bytes fallthrough ( 30 ) ; program builder add bytes fallthrough set no flow context ( 32 , 2 , 18 ) ; program builder add bytes branch ( 36 , 40 ) ; program builder add bytes return ( 40 ) ; address set view dis addrs = disassembler disassemble ( addr ( 24 ) , null ) ; assert equals ( addrset ( range ( 24 , 27 ) , range ( 40 , 41 ) ) , dis addrs ) ; / / clear instruction at 40 to allow flow from 36 program get listing ( ) clear code units ( addr ( 40 ) , addr ( 40 ) , true ) ; dis addrs = disassembler disassemble ( addr ( 10 ) , null ) ; assert equals ( addrset ( range ( 10 , 15 ) , range ( 20 , 21 ) , range ( 30 , 37 ) , range ( 40 , 41 ) ) , dis addrs ) ; verify instruction presence ( collection utils as set ( addr ( 22 ) ) ) ; verify error bookmark ( addr ( 22 ) , " conflicting instruction " ) ; }


returns the index of the item at the top of the screen

public final int get index as int ( ) { return index int value ( ) ; }


checks if the process definition is suspended

boolean is process definition suspended ( string process definition id ) ;


removes the local variables and creates a new { @ link historic variable update } for each of them

void remove variables local ( collection < string > variable names ) ;


ensures that an object reference passed as a parameter to the calling method is not null see { @ link # check not null ( object , string , object ) } for details

public static < t extends object > t check not null ( @ non null decl t obj , @ nullable decl string error message template , int p 1 , long p 2 ) { if ( obj = = null ) { throw new null pointer exception ( lenient format ( error message template , p 1 , p 2 ) ) ; } return obj ; }


public void write ( byte [ ] bytes ) { write ( bytes , 0 , bytes length ) ; }


adds the given button to the button table

public dialog button ( button button ) { return button ( button , null ) ; }


set bucket steps , the minimal values of every buckets besides the { @ link # min value }

public builder steps ( list < double > steps ) { this steps = new array list < > ( steps ) ; return this ; }


further reduces the memory footprint by finding the same labels across multiple { @ link tree string } s

public void dedup ( ) { root dedup ( new hash map < string , char [ ] > ( ) ) ; }


verify that , when the callback fails to enter active state , after a zk disconnect ( i e from the stat callback ) , that the elector rejoins the election after sleeping for a short period

public void test fail to become active after z k disconnect ( ) throws exception { mock no prior active ( ) ; elector join election ( data ) ; assert assert equals ( 0 , elector slept for ) ; elector process result ( code connectionloss int value ( ) , zk lock name , mock z k , zk lock name ) ; mockito verify ( mock z k , mockito times ( 2 ) ) create ( zk lock name , data , ids open acl unsafe , create mode ephemeral , elector , mock z k ) ; elector process result ( code nodeexists int value ( ) , zk lock name , mock z k , zk lock name ) ; verify exist call ( 1 ) ; stat stat = new stat ( ) ; stat set ephemeral owner ( 1l ) ; mockito when ( mock z k get session id ( ) ) then return ( 1l ) ; / / fake failure to become active from within the stat callback mockito do throw ( new service failed exception ( " fail to become active " ) ) when ( mock app ) become active ( ) ; elector process result ( code ok int value ( ) , zk lock name , mock z k , stat ) ; mockito verify ( mock app , mockito times ( 1 ) ) become active ( ) ; / / should re - join mockito verify ( mock z k , mockito times ( 3 ) ) create ( zk lock name , data , ids open acl unsafe , create mode ephemeral , elector , mock z k ) ; assert assert equals ( 2 , count ) ; assert assert true ( elector slept for > 0 ) ; }


override this method so that we can record which alternative was taken at each decision point for non - left recursive rules , it ' s simple set decision states that set outer alt num in context indicates which decision states should set the outer alternative number left recursive rules are much more complicated to deal with : there is typically a decision for the primary alternatives and a decision to choose between the recursive operator alternatives for example , the following left recursive rule has two primary and 2 recursive alternatives e : e ' ' e | ' - ' int | e ' + ' e | id ; antlr rewrites that rule to be e [ int precedence ] : ( ' - ' int | id ) ( { } ? ' ' e [ 5 ] | { } ? ' + ' e [ 3 ] ) ; so , there are two decisions associated with picking the outermost alt this complicates our tracking significantly the outermost alternative number is a function of the decision ( atn state ) within a left recursive rule and the predicted alternative coming back from adaptive predict ( ) we use state to alts map as a cache to avoid expensive calls to get recursive op alts ( )

protected int visit decision state ( decision state p ) { int predicted alt = super visit decision state ( p ) ; if ( p get number of transitions ( ) > 1 ) { / / system out println ( " decision " + p decision + " : " + predicted alt ) ; if ( p decision = = this override decision & & this input index ( ) = = this override decision input index ) { override decision root = ( grammar interpreter rule context ) get context ( ) ; } } grammar interpreter rule context ctx = ( grammar interpreter rule context ) ctx ; if ( decision states that set outer alt num in context get ( p state number ) ) { ctx outer alt num = predicted alt ; rule r = g get rule ( p rule index ) ; if ( atn rule to start state [ r index ] is left recursive rule ) { int [ ] alts = state to alts map [ p state number ] ; left recursive rule lr = ( left recursive rule ) g get rule ( p rule index ) ; if ( p get state type ( ) = = a t n state block start ) { if ( alts = = null ) { alts = lr get primary alts ( ) ; state to alts map [ p state number ] = alts ; / / cache it } } else if ( p get state type ( ) = = a t n state star block start ) { if ( alts = = null ) { alts = lr get recursive op alts ( ) ; state to alts map [ p state number ] = alts ; / / cache it } } ctx outer alt num = alts [ predicted alt ] ; } } return predicted alt ; }


public just symbol enum get just symbol ( ) { return just symbol ; }


returns the array component of { @ code type } , or null if { @ code type } is not an array

static type name array component ( type name type ) { return type instanceof array type name ? ( ( array type name ) type ) component type : null ; }


` index options ` was deprecated and is rejected as of 7 0

public void test reject index options ( ) { mapper parsing exception e = expect throws ( mapper parsing exception class , ( ) - > create mapper service ( field mapping ( b - > b field ( " type " , " scaled float " ) field ( " index options " , random index options ( ) ) ) ) ) ; assert that ( e get message ( ) , contains string ( " failed to parse mapping : unknown parameter [ index options ] on mapper [ field ] of type [ scaled float ] " ) ) ; }


remove entries for dispatchers that are no longer present in the tree

public synchronized void clear unused event handlers ( ) { final iterator iterator = m event handlers key set ( ) iterator ( ) ; while ( iterator has next ( ) ) { final event handlers wrapper event handlers wrapper = m event handlers get ( iterator next ( ) ) ; if ( event handlers wrapper = = null | | ! event handlers wrapper m used in current tree ) { iterator remove ( ) ; } else { event handlers wrapper m used in current tree = false ; } } }


returns an array of strings containing only application - specific arguments

public string [ ] get remaining args ( ) { return ( command line = = null ) ? new string [ ] { } : command line get args ( ) ; }


on version 5 4 the state doc ids had a different pattern the pattern started with the job id , followed by a hyphen , the snapshot id , and ended with hash and an integer

private static string v 5 4 extract job id ( string doc id ) { matcher matcher = v 5 4 doc id regex matcher ( doc id ) ; if ( matcher matches ( ) ) { return matcher group ( 1 ) ; } return null ; }


clone the context data , work for capture to cross - thread

public extension context clone ( ) { final extension context context = new extension context ( ) ; context skip analysis = this skip analysis ; context sending timestamp = this sending timestamp ; return context ; }


void registry by resources ( resource [ ] resources , string tenant id ) throws i o exception ;


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

public r layout in view model annotation works view model on visibility changed ( on model visibility changed listener < r layout in view model annotation works view model , r layout in view model annotation works view > listener ) { on mutation ( ) ; this on model visibility changed listener epoxy generated model = listener ; return this ; }


sorts java class names such that outer classes precede their inner classes and " package - info " precedes all other classes in its package

static int compare class names ( string a , string b ) { / / ensure inner classes sort second a = a replace ( ' $ ' , ' 0 ' ) ; b = b replace ( ' $ ' , ' 0 ' ) ; / * * assuming " package - info " only occurs at the end , ensures package - info * sorts first * / a = a replace ( " package - info " , " " ) ; b = b replace ( " package - info " , " " ) ; return a compare to ( b ) ; }


specifies the executor to use while scheduling reporting of metrics default value is null null value leads to executor will be auto created on start

public builder schedule on ( scheduled executor service executor ) { this executor = executor ; return this ; }


can be used to collect objects from the iterable is a terminating operation

public final optional < e > first ( ) { var result iterator = first ( 1 ) iterator ( ) ; return result iterator has next ( ) ? optional of ( result iterator next ( ) ) : optional empty ( ) ; }


process { @ code @ autowired } injection for the given target object , based on the current root web application context as stored in the servlet context intended for use as a delegate

public static void process injection based on servlet context ( object target , servlet context servlet context ) { assert not null ( target , " target object must not be null " ) ; web application context cc = web application context utils get required web application context ( servlet context ) ; autowired annotation bean post processor bpp = new autowired annotation bean post processor ( ) ; bpp set bean factory ( cc get autowire capable bean factory ( ) ) ; bpp process injection ( target ) ; }


retrieves the current request for this target , should not be called outside of glide


test that program diff can determine there is a function difference when the function is only in program 1

public void test function only in p 1 ( ) throws exception { / / in p 1 not in p 2 int transaction i d = p 2 start transaction ( " test transaction " ) ; p 2 get function manager ( ) remove function ( addr ( 0x 1 0 0 3 0d 2 ) ) ; p 2 end transaction ( transaction i d , true ) ; program diff = new program diff ( p 1 , p 2 ) ; program diff set filter ( new program diff filter ( program diff filter function diffs ) ) ; assert equals ( new address set ( addr ( 0x 1 0 0 3 0d 2 ) , addr ( 0x 1 0 0 3 0d 2 ) ) , program diff get differences ( program diff get filter ( ) , null ) ) ; }


compares a { @ code char sequence } to this { @ code string } to determine if their contents are equal

public boolean content equals ( char sequence a ) { if ( this = = a ) { return true ; } if ( a = = null | | a length ( ) ! = length ( ) ) { return false ; } if ( a instanceof ascii string ) { return equals ( a ) ; } for ( int i = array offset ( ) , j = 0 ; j < a length ( ) ; + + i , + + j ) { if ( b 2c ( value [ i ] ) ! = a char at ( j ) ) { return false ; } } return true ; }


this implementation returns the description of this resource

public string to string ( ) { return get description ( ) ; }


public string get task name ( ) { return task name ; }


test the property ' sc a e t h flow points '

public void sc a e t h flow points test ( ) { / / todo : test sc a e t h flow points }


get the description of the m bean resource default implementation returns a simple description for the m bean based on the class name

protected string get description ( object managed bean , string bean key ) throws j m exception { string target class name = get target class ( managed bean ) get name ( ) ; if ( aop utils is aop proxy ( managed bean ) ) { return " proxy for " + target class name ; } return target class name ; }


renames path src to path dst can take place on local fs or remote dfs adls support posix standard for rename operation

public boolean rename ( final path src , final path dst ) throws i o exception { statistics increment write ops ( 1 ) ; if ( to relative file path ( src ) equals ( " / " ) ) { return false ; } return adl client rename ( to relative file path ( src ) , to relative file path ( dst ) ) ; }


： - modify 、 ， ， ， ， ，

public void run unprivileged ( ) { / / request config rc = request config custom ( ) set connection request timeout ( 10 * 1000 ) set connect timeout ( 10 * 1000 ) set socket timeout ( 15 * 1000 ) build ( ) ; http head head = new http head ( location ) ; head set config ( rc ) ; / / if ( last modified ! = null ) { head set header ( " if - modified - since " , last modified ) ; } if ( e tags ! = null ) { head set header ( " if - none - match " , e tags ) ; } closeable http response response = null ; try { response = httpclient execute ( head ) ; / / if ( response get status line ( ) get status code ( ) = = 200 ) { if ( ( ( response get last header ( " last - modified " ) ! = null ) & & ! response get last header ( " last - modified " ) get value ( ) equals ignore case ( last modified ) ) | | ( ( response get last header ( " e tag " ) ! = null ) & & ! response get last header ( " e tag " ) get value ( ) equals ignore case ( e tags ) ) ) { / / , ， modified , e tags dictionary get singleton ( ) re load main dict ( ) ; last modified = response get last header ( " last - modified " ) = = null ? null : response get last header ( " last - modified " ) get value ( ) ; e tags = response get last header ( " e tag " ) = = null ? null : response get last header ( " e tag " ) get value ( ) ; } } else if ( response get status line ( ) get status code ( ) = = 304 ) { / / ， / / noop } else { logger info ( " remote ext dict { } return bad code { } " , location , response get status line ( ) get status code ( ) ) ; } } catch ( exception e ) { logger error ( " remote ext dict { } error ! " , e , location ) ; } finally { try { if ( response ! = null ) { response close ( ) ; } } catch ( i o exception e ) { logger error ( e get message ( ) , e ) ; } } }


create filesdirectories and set their storage policies according to the corresponding scheme

void prepare namespace ( ) throws exception { ns scheme prepare ( dfs , cluster scheme repl ) ; }


formats the given string to resemble a scope variable

public static string as variable ( string scope ) { return scope variable prefix + scope + scope variable suffix ; }


report a line to the listener about this cause

public void print ( task listener listener ) { listener get logger ( ) println ( get short description ( ) ) ; }


moves a { @ link timer job entity } to become an async { @ link job entity } this happens for example when the due date of a timer is reached , the timer entity then becomes a ' regular ' async job that can be picked up by the { @ link async executor }

job entity move timer job to executable job ( timer job entity timer job ) ;


adds the given mount links to the given hadoop compatible file system path mount link mappings are in sources , targets at their respective index locations

static void add mount links to file ( string mount table , string [ ] sources , string [ ] targets , path mount table conf path , configuration conf ) throws i o exception , u r i syntax exception { child fs getter cfs = new view file system overload scheme child fs getter ( mount table conf path to uri ( ) get scheme ( ) ) ; try ( file system fs = cfs get new instance ( mount table conf path to uri ( ) , conf ) ) { try ( f s data output stream out = fs create ( mount table conf path ) ) { string prefix = new string builder ( constants config viewfs prefix ) append ( " " ) append ( ( mount table = = null ? config util get default mount table name ( conf ) : mount table ) ) append ( " " ) to string ( ) ; out write bytes ( " < configuration > " ) ; for ( int i = 0 ; i < sources length ; i + + ) { string src = sources [ i ] ; string target = targets [ i ] ; boolean is nfly = src starts with ( constants config viewfs link nfly ) ; out write bytes ( " < property > < name > " ) ; if ( is nfly ) { string [ ] src parts = src split ( " [ ] " ) ; assert assert equals ( " invalid n fly link format " , 3 , src parts length ) ; string actual src = src parts [ src parts length - 1 ] ; string params = src parts [ src parts length - 2 ] ; out write bytes ( prefix + constants config viewfs link nfly + " " + params + " " + actual src ) ; } else if ( constants config viewfs link fallback equals ( src ) ) { out write bytes ( prefix + constants config viewfs link fallback ) ; } else if ( constants config viewfs link merge slash equals ( src ) ) { out write bytes ( prefix + constants config viewfs link merge slash ) ; } else { out write bytes ( prefix + constants config viewfs link + " " + src ) ; } out write bytes ( " < / name > " ) ; out write bytes ( " < value > " ) ; out write bytes ( target ) ; out write bytes ( " < / value > < / property > " ) ; out flush ( ) ; } out write bytes ( ( " < / configuration > " ) ) ; out flush ( ) ; } } }


create a new big - endian buffer that holds a sequence of the specified 16 - bit integers

public static byte buf copy short ( short values ) { if ( values = = null | | values length = = 0 ) { return empty buffer ; } byte buf buffer = buffer ( values length * 2 ) ; for ( int v : values ) { buffer write short ( v ) ; } return buffer ; }


return total time spent doing sync operations on f s edit log

public string get total sync times ( ) { journal set journal set = fs image edit log get journal set ( ) ; if ( journal set ! = null ) { return journal set get sync times ( ) ; } else { return " " ; } }


set the configuration source { @ code object } for this metadata element the exact type of the object will depend on the configuration mechanism used

public void set source ( @ nullable object source ) { this source = source ; }


public static integer type create integer type ( ) { return integer type ; }


this implementation supports spring ' s extended " max concurrency " and " prefetch size " settings through detecting corresponding activation spec properties : " max sessions " " max number of works " and " max messages per sessions " " max messages " , respectively ( following active m q ' s and joram ' s naming conventions )

protected void populate activation spec properties ( bean wrapper bw , jms activation spec config config ) { super populate activation spec properties ( bw , config ) ; if ( config get max concurrency ( ) > 0 ) { if ( bw is writable property ( " max sessions " ) ) { / / active m q bw set property value ( " max sessions " , integer to string ( config get max concurrency ( ) ) ) ; } else if ( bw is writable property ( " max number of works " ) ) { / / joram bw set property value ( " max number of works " , integer to string ( config get max concurrency ( ) ) ) ; } else if ( bw is writable property ( " max concurrency " ) ) { / / web sphere bw set property value ( " max concurrency " , integer to string ( config get max concurrency ( ) ) ) ; } } if ( config get prefetch size ( ) > 0 ) { if ( bw is writable property ( " max messages per sessions " ) ) { / / active m q bw set property value ( " max messages per sessions " , integer to string ( config get prefetch size ( ) ) ) ; } else if ( bw is writable property ( " max messages " ) ) { / / joram bw set property value ( " max messages " , integer to string ( config get prefetch size ( ) ) ) ; } else if ( bw is writable property ( " max batch size " ) ) { / / web sphere bw set property value ( " max batch size " , integer to string ( config get prefetch size ( ) ) ) ; } } }


protected string encrypt resolved username ( final principal principal , final service service , final registered service registered service , final string username ) { val application context = application context provider get application context ( ) ; val cipher = application context get bean ( registered service cipher executor default bean name , registered service cipher executor class ) ; return cipher encode ( username , optional of ( registered service ) ) ; }


returns the number of bytes from the original source file that are stored in the database

public long get size ( ) { return size ; }


test whether the file system supports append and return the answer

private boolean check append ( file system fs ) { boolean can append = true ; try { fs append ( base path ) ; } catch ( unsupported operation exception ex ) { can append = false ; } catch ( i o exception ex ) { / / ignore the operation is supported } return can append ; }


return the { @ link resource loader } currently being used

resource loader get resource loader ( ) ;


returns { @ code true } if the iteration has more elements otherwise , { @ code false } will be returned


sending multipartform - data without a file should result in a bad request if the handler expects a file upload

public void test multi part form data without file upload ( ) throws exception { final string boundary = generate multi part boundary ( ) ; final string crlf = " \ r \ n " ; final http u r l connection connection = open http connection for upload ( boundary ) ; try ( output stream output = connection get output stream ( ) ; print writer writer = new print writer ( new output stream writer ( output , standard charsets utf 8 ) , true ) ) { writer append ( " - - " + boundary ) append ( crlf ) ; writer append ( " content - disposition : form - data ; name = \ " foo \ " " ) append ( crlf ) ; writer append ( crlf ) flush ( ) ; output write ( " test " get bytes ( standard charsets utf 8 ) ) ; output flush ( ) ; writer append ( crlf ) flush ( ) ; writer append ( " - - " + boundary + " - - " ) append ( crlf ) flush ( ) ; } assert equals ( 400 , connection get response code ( ) ) ; }


acquires < code > go to service < code > if available

protected void init ( ) { go to service = tool get service ( go to service class ) ; provider set go to service ( go to service ) ; marker service = tool get service ( marker service class ) ; tool add popup action provider ( this ) ; nav updater = new nav updater ( ) ; repaint mgr = new swing update manager ( 500 , ( ) - > provider repaint ( ) ) ; }


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


gets the address range containing the lsda header

public address range get body ( ) { return table bounds ; }


void put data ( string table name , string row key , string column family , string column qualifier , string value ) throws i o exception ;


creates a new fastest { @ link concurrent map } implementation for the current platform

public static < k , v > concurrent map < k , v > new concurrent hash map ( int initial capacity ) { return new concurrent hash map < k , v > ( initial capacity ) ; }


positive test to verify file delete access check

public void test file delete access check positive ( ) throws throwable { path parent dir = new path ( " / " ) ; path test path = new path ( parent dir , " test dat " ) ; authorizer add auth rule for owner ( " / " , write , true ) ; fs update wasb authorizer ( authorizer ) ; try { fs create ( test path ) ; contract test utils assert path exists ( fs , " test path was not created " , test path ) ; } finally { fs delete ( test path , false ) ; contract test utils assert path does not exist ( fs , " test path exists after deletion ! " , test path ) ; } }


returns the size in bytes of the jvms exception table corresponding to the handler list that begins with the given element this includes the exception table length field

static int get exception table size ( final handler first handler ) { return 2 + 8 * get exception table length ( first handler ) ; }


return a q name for the given name , relative to the namespace uri of this factory , if given

protected q name get q name ( string name ) { return ( get namespace uri ( ) ! = null ? new q name ( get namespace uri ( ) , name ) : new q name ( name ) ) ; }


returns the data whose min address is less than or equal to the specified address and whose max address is greater than or equal to the specified address { @ literal data min address ( ) < = addr < = data max address ( ) }

public data get data containing ( address addr ) { code unit cu = get code unit containing ( addr ) ; if ( cu instanceof data ) { return ( data ) cu ; } return null ; }


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


extract a sub - path from the given offset into the elements list

default path container sub path ( int index ) { return sub path ( index , elements ( ) size ( ) ) ; }


stores a key - value pair in this multimap for each of { @ code values } , all using the same key , { @ code key } equivalent to ( but expected to be more efficient than ) : { @ code for ( v value : values ) { put ( key , value ) ; } } in particular , this is a no - op if { @ code values } is empty

boolean put all ( @ nullable k key , iterable < ? extends v > values ) ;


public code read code ( ) { ensure four bytes aligned ( table of contents codes , false ) ; return super read code ( ) ; }


this method returns the token types supported by this authentication handler

public collection < string > get token types ( ) { return types ; }


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


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


returns the directory where archived application extensions are stored

public final resource file get extension archive dir ( ) { return extension archive dir ; }


create an instance of { @ code t } ( usually a facade ) that developers can use to query the underlying { @ link state store } s

t create ( final state store provider store provider , final string store name ) ;


reads the bootstrap methods attribute to compute the offset of each bootstrap method

private int [ ] read bootstrap methods attribute ( final int max string length ) { char [ ] char buffer = new char [ max string length ] ; int current attribute offset = get first attribute offset ( ) ; int [ ] current bootstrap method offsets = null ; for ( int i = read unsigned short ( current attribute offset - 2 ) ; i > 0 ; - - i ) { / / read the attribute info ' s attribute name and attribute length fields string attribute name = read u t f 8 ( current attribute offset , char buffer ) ; int attribute length = read int ( current attribute offset + 2 ) ; current attribute offset + = 6 ; if ( constants bootstrap methods equals ( attribute name ) ) { / / read the num bootstrap methods field and create an array of this size current bootstrap method offsets = new int [ read unsigned short ( current attribute offset ) ] ; / / compute and store the offset of each ' bootstrap methods ' array field entry int current bootstrap method offset = current attribute offset + 2 ; for ( int j = 0 ; j < current bootstrap method offsets length ; + + j ) { current bootstrap method offsets [ j ] = current bootstrap method offset ; / / skip the bootstrap method ref and num bootstrap arguments fields ( 2 bytes each ) , / / as well as the bootstrap arguments array field ( of size num bootstrap arguments * 2 ) current bootstrap method offset + = 4 + read unsigned short ( current bootstrap method offset + 2 ) * 2 ; } return current bootstrap method offsets ; } current attribute offset + = attribute length ; } throw new illegal argument exception ( ) ; }


sets the < code > type < code > property

public model api response type ( string type ) { this type = type ; return this ; }


public string get a t t n a m e ( ) { return att name ; }


public mock http servlet request builder flash attrs ( map < string , object > flash attributes ) { assert not empty ( flash attributes , " ' flash attributes ' must not be empty " ) ; flash attributes for each ( this : : flash attr ) ; return this ; }


convert an array of tags to the equivalent proto - generated enum values the proto type is duplicate in order to not burden the options parser with the proto dependency a test guarantees that the two enum types are kept in sync with matching indices

static list < option filters option metadata tag > get proto metadata tags ( option metadata tag [ ] tag array ) { array list < option filters option metadata tag > metadata tags = new array list < > ( tag array length ) ; for ( option metadata tag tag : tag array ) { metadata tags add ( option filters option metadata tag for number ( tag get value ( ) ) ) ; } return metadata tags ; }


sets the < code > anytype 1 < code > property

public additional properties class anytype 1 ( object anytype 1 ) { this anytype 1 = anytype 1 ; return this ; }


returns the estimated number of occurrences of an element , up to the maximum ( 15 )

public int frequency ( @ non null e e ) { if ( is not initialized ( ) ) { return 0 ; } int hash = spread ( e hash code ( ) ) ; int start = ( hash & 3 ) < < 2 ; int frequency = integer max value ; for ( int i = 0 ; i < 4 ; i + + ) { int index = index of ( hash , i ) ; int count = ( int ) ( ( table [ index ] > > > ( ( start + i ) < < 2 ) ) & 0xf l ) ; frequency = math min ( frequency , count ) ; } return frequency ; }


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

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


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

@ override public t visit sequence params ( eql base parser sequence params context ctx ) { return visit children ( ctx ) ; }


protected void start extract ( g file system fs , g file src dir , task monitor monitor ) throws cancelled exception , i o exception { this fs = fs ; if ( src dir = = null ) { src dir = fs lookup ( null ) ; } process directory ( src dir , root output directory , monitor ) ; }


discards entities with start timestamp less than or equal to the given timestamp

void discard old entities ( long timestamp ) throws i o exception , interrupted exception { byte [ ] reverse timestamp = write reverse ordered long ( timestamp ) ; long total count = 0 ; long t 1 = system current time millis ( ) ; try { list < string > entity types = get entity types ( ) ; for ( string entity type : entity types ) { leveldb iterator iterator = null ; leveldb iterator pf iterator = null ; long type count = 0 ; delete lock write lock ( ) lock ( ) ; try { iterator = get db iterator ( false ) ; pf iterator = get db iterator ( false ) ; if ( deletion thread ! = null & & deletion thread is interrupted ( ) ) { throw new interrupted exception ( ) ; } boolean seeked = false ; while ( delete next entity ( entity type , reverse timestamp , iterator , pf iterator , seeked ) ) { type count + + ; total count + + ; seeked = true ; if ( deletion thread ! = null & & deletion thread is interrupted ( ) ) { throw new interrupted exception ( ) ; } } } catch ( i o exception e ) { log error ( " got i o exception while deleting entities for type " + entity type + " , continuing to next type " , e ) ; } finally { i o utils cleanup with logger ( log , iterator , pf iterator ) ; delete lock write lock ( ) unlock ( ) ; if ( type count > 0 ) { log info ( " deleted " + type count + " entities of type " + entity type ) ; } } } } finally { long t 2 = system current time millis ( ) ; log info ( " discarded " + total count + " entities for timestamp " + timestamp + " and earlier in " + ( t 2 - t 1 ) / 1000 0 + " seconds " ) ; } }


draws the limit lines associated with this axis to the screen

public void render limit lines ( canvas c ) { list < limit line > limit lines = m x axis get limit lines ( ) ; if ( limit lines = = null | | limit lines size ( ) < = 0 ) return ; float [ ] position = m render limit lines buffer ; position [ 0 ] = 0 ; position [ 1 ] = 0 ; for ( int i = 0 ; i < limit lines size ( ) ; i + + ) { limit line l = limit lines get ( i ) ; if ( ! l is enabled ( ) ) continue ; int clip restore count = c save ( ) ; m limit line clipping rect set ( m view port handler get content rect ( ) ) ; m limit line clipping rect inset ( - l get line width ( ) , 0 f ) ; c clip rect ( m limit line clipping rect ) ; position [ 0 ] = l get limit ( ) ; position [ 1 ] = 0 f ; m trans point values to pixel ( position ) ; render limit line line ( c , l , position ) ; render limit line label ( c , l , position , 2 f + l get y offset ( ) ) ; c restore to count ( clip restore count ) ; } }


get iterator which skips the stored ranges the iterator next ( ) call return the index starting from 0

synchronized skip range iterator skip range iterator ( ) { return new skip range iterator ( ranges iterator ( ) ) ; }


assigns an alias for this window that the following { @ code select ( ) } clause can refer to

public over window as ( string alias ) { return as ( expression parser parse expression ( alias ) ) ; }


retract the input record and emit updated records this works for outputting with row number

private boolean retract record with row number ( sorted map < row data , long > sorted map , row data sort key , row data input row , collector < row data > out ) throws exception { iterator < map entry < row data , long > > iterator = sorted map entry set ( ) iterator ( ) ; long current rank = 0l ; row data prev row = null ; boolean finds sort key = false ; while ( iterator has next ( ) & & is in rank end ( current rank ) ) { map entry < row data , long > entry = iterator next ( ) ; row data key = entry get key ( ) ; if ( ! finds sort key & & key equals ( sort key ) ) { list < row data > inputs = data state get ( key ) ; if ( inputs = = null ) { / / skip the data if it ' s state is cleared because of state ttl if ( lenient ) { log warn ( state cleared warn msg ) ; } else { throw new runtime exception ( state cleared warn msg ) ; } } else { iterator < row data > input iter = inputs iterator ( ) ; while ( input iter has next ( ) & & is in rank end ( current rank ) ) { row data current row = input iter next ( ) ; if ( ! finds sort key & & equaliser equals ( current row , input row ) ) { prev row = current row ; finds sort key = true ; input iter remove ( ) ; } else if ( finds sort key ) { collect update before ( out , prev row , current rank ) ; collect update after ( out , current row , current rank ) ; prev row = current row ; } current rank + = 1 ; } if ( inputs is empty ( ) ) { data state remove ( key ) ; } else { data state put ( key , inputs ) ; } } } else if ( finds sort key ) { list < row data > inputs = data state get ( key ) ; int i = 0 ; while ( i < inputs size ( ) & & is in rank end ( current rank ) ) { row data current row = inputs get ( i ) ; collect update before ( out , prev row , current rank ) ; collect update after ( out , current row , current rank ) ; prev row = current row ; current rank + = 1 ; i + + ; } } else { current rank + = entry get value ( ) ; } } if ( is in rank end ( current rank ) ) { / / there is no enough elements in top - n , emit delete message for the retract record collect delete ( out , prev row , current rank ) ; } return finds sort key ; }


public verify repository response verify repository ( verify repository request verify repository request , request options options ) throws i o exception { return rest high level client perform request and parse entity ( verify repository request , snapshot request converters : : verify repository , options , verify repository response : : from x content , empty set ( ) ) ; }


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 ( ) throws api exception { string order id = null ; api delete order ( order id ) ; / / todo : test validations }


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


function that verifies whether the edge to be removed is part of the sssp or not if it is , the src vertex will be invalidated

public static boolean is in s s s p ( final edge < long , double > edge to be removed , data set < edge < long , double > > edges in s s s p ) throws exception { return edges in s s s p filter ( new filter function < edge < long , double > > ( ) { @ override public boolean filter ( edge < long , double > edge ) throws exception { return edge equals ( edge to be removed ) ; } } ) count ( ) > 0 ; }


get the user supplied s q l exception override class name

public string get exception override class name ( ) { return this exception override class name ; }


visits any type of ref constant of the given class

public void visit any ref constant ( clazz clazz , ref constant ref constant ) { visit any constant ( clazz , ref constant ) ; }


patch fake : to test \ & quot ; client \ & quot ; model to test \ & quot ; client \ & quot ; model

default response entity < client > test client model ( @ api param ( value = " client model " , required = true ) @ valid @ request body client body ) { return get delegate ( ) test client model ( body ) ; }


returns path to the optional zip file of undeclared test outputs

public path fragment get undeclared outputs zip path ( ) { return undeclared outputs zip path ; }


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


from a map of workers to assignment object generate the equivalent map of workers to byte buffers of serialized assignments

protected map < string , byte buffer > serialize assignments ( map < string , extended assignment > assignments ) { return assignments entry set ( ) stream ( ) collect ( collectors to map ( map entry : : get key , e - > incremental cooperative connect protocol serialize assignment ( e get value ( ) ) ) ) ; }


get the type of { @ link decompressor } needed by this { @ link compression codec }

class < ? extends decompressor > get decompressor type ( ) ;


determine if the message { @ code start } ' s content length is known , and if it greater than { @ code max content length }

protected abstract boolean is content length invalid ( s start , int max content length ) throws exception ;


bz 2 is recognized as the default extension for compressed b zip 2 files

public string get default extension ( ) { return codec constants bzip2 codec extension ; }


adds a rule that will cause every send request to fail , and each new connect since the rule is added to fail as well

public void add fail to send no connect rule ( transport service transport service ) { for ( transport address transport address : extract transport addresses ( transport service ) ) { add fail to send no connect rule ( transport address ) ; } }


marks the given visitor accepter as being used

protected void mark as used ( visitor accepter visitor accepter ) { visitor accepter set visitor info ( used ) ; }


gets the major and minor version numbers from a version string for details about the syntax of the input { @ code version } e g , from x y z return x y

public static string get major minor version ( string version ) { int first dot = version index of ( ' ' ) ; int second dot = first dot > = 0 ? version index of ( ' ' , first dot + 1 ) : - 1 ; int first dash = version index of ( ' - ' ) ; int reference length = version length ( ) ; if ( second dot > = 0 ) { reference length = math min ( reference length , second dot ) ; } if ( first dash > = 0 ) { reference length = math min ( reference length , first dash ) ; } return version substring ( 0 , reference length ) ; }


delete user this can only be done by the logged in user

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


format url template using default server variables

public string url ( ) { return url ( null ) ; }


verify the ability to limit the number of concurrent connections

public void test max cnxns ( ) throws i o exception , interrupted exception { string [ ] split = host port split ( " : " ) ; host = split [ 0 ] ; port = integer parse int ( split [ 1 ] ) ; int num threads = num cnxns + 5 ; cnxn thread [ ] threads = new cnxn thread [ num threads ] ; for ( int i = 0 ; i < num cnxns ; + + i ) { threads [ i ] = new cnxn thread ( i ) ; } for ( int i = 0 ; i < num cnxns ; + + i ) { threads [ i ] start ( ) ; } for ( int i = 0 ; i < num cnxns ; + + i ) { threads [ i ] join ( ) ; } assert same ( num cnxns , num connected get ( ) ) ; }


this test tests slice direct selective stream reader for the case where all elements to read are empty strings the output block should be a valid variable width block with an empty slice it is to simulate a problem seen in production the state of slice direct selective stream reader to reproduce the problem is : - data stream : null - present stream : null - length stream : not null - filter : null - output required : true - offsets array : non zeros the test issues two reads , the first one reads a non - empty string and populates non - zero offsets the second one reads the empty string with the above conditions met

public void test empty strings ( ) throws exception { type type = varchar ; list < type > types = immutable list of ( type ) ; list < list < ? > > values = immutable list of ( immutable list of ( " a " , " " ) ) ; for ( orc tester format format : formats ) { if ( ! types stream ( ) all match ( read type - > format supports type ( read type ) ) ) { return ; } for ( compression kind compression : compressions ) { temp file temp file = new temp file ( ) ; write orc columns presto ( temp file get file ( ) , format , compression , optional empty ( ) , types , values , new orc writer stats ( ) ) ; orc predicate orc predicate = create orc predicate ( types , values , dwrf , false ) ; map < integer , type > included columns = int stream range ( 0 , types size ( ) ) boxed ( ) collect ( to immutable map ( function identity ( ) , types : : get ) ) ; list < integer > output columns = int stream range ( 0 , types size ( ) ) boxed ( ) collect ( to immutable list ( ) ) ; orc aggregated memory context system memory usage = new testing hive orc aggregated memory context ( ) ; try ( orc selective record reader record reader = create custom orc selective record reader ( temp file get file ( ) , format get orc encoding ( ) , orc predicate , types , 1 , immutable map of ( ) , immutable list of ( ) , immutable map of ( ) , orc tester orc reader settings builder ( ) build ( ) get required subfields ( ) , immutable map of ( ) , included columns , output columns , false , system memory usage ) ) { assert equals ( record reader get reader position ( ) , 0 ) ; assert equals ( record reader get file position ( ) , 0 ) ; selective stream reader stream reader = record reader get stream readers ( ) [ 0 ] ; / / read the first non - empty element do not call stream reader get block ( ) to preserve the offsets array in slice direct selective stream reader int batch size = min ( record reader prepare next batch ( ) , 1 ) ; int [ ] positions = int stream range ( 0 , batch size ) to array ( ) ; stream reader read ( 0 , positions , batch size ) ; record reader batch read ( batch size ) ; / / read the second element : an empty string set the data stream in slice direct selective stream reader to null to simulate the conditions causing the problem ( ( slice selective stream reader ) stream reader ) reset data stream ( ) ; batch size = min ( record reader prepare next batch ( ) , 1 ) ; positions = int stream range ( 0 , batch size ) to array ( ) ; stream reader read ( 0 , positions , batch size ) ; record reader batch read ( batch size ) ; block block = stream reader get block ( positions , batch size ) ; list < ? > expected values = immutable list of ( " " ) ; assert block equals ( type , block , expected values , 0 ) ; assert equals ( record reader get reader position ( ) , 1 ) ; assert equals ( record reader get file position ( ) , 1 ) ; } } } }


returns human - friendly help for the generator provide the consumer with help tips , parameters here

public string get help ( ) { return " generates a gatling simulation library ( beta ) " ; }


determine whether the given url points to a resource in the file system , that is , has protocol " file " or " vfs "

public static boolean is file u r l ( url url ) { string protocol = url get protocol ( ) ; return ( url protocol file equals ( protocol ) ) ; }


transforms a { @ link dead letter job entity } to a { @ link job entity } , thus making it executable again note that a ' retries ' parameter needs to be passed , as the job got into the deadletter table because of it failed and retries became 0

job entity move dead letter job to executable job ( dead letter job entity dead letter job entity , int retries ) ;


return standard deviation of the processing time

public double get processing std dev ( ) { return rpc processing time last stat ( ) stddev ( ) ; }


create a payload with data only the created payload is { @ link byte buf payload } if the input is { @ link netty data buffer } or otherwise it is { @ link default payload }

public static payload create payload ( data buffer data ) { return data instanceof netty data buffer ? byte buf payload create ( as byte buf ( data ) ) : default payload create ( as byte buffer ( data ) ) ; }


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

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


record a value at a known time this method is slightly faster than { @ link # record ( double ) } since it will reuse the time stamp

public void record ( double value , long time ms ) { if ( should record ( ) ) { record internal ( value , time ms , true ) ; } }


gets the number of the superstep , starting at < tt > 1 < tt >

public int get superstep number ( ) { return this runtime context get superstep number ( ) ; }


public integer get int 3 2 ( ) { return int 3 2 ; }


returns the number of bytes in the file to process

public long get length ( ) { return length ; }


removes decision from ldap attribute set

private static set < string > remove decision ( final ldap attribute ldap consent , final long decision id ) { if ( ldap consent size ( ) ! = 0 ) { return ldap consent get string values ( ) stream ( ) map ( ldap consent repository : : map from json ) filter ( objects : : non null ) filter ( d - > d get id ( ) ! = decision id ) map ( ldap consent repository : : map to json ) filter ( objects : : non null ) collect ( collectors to set ( ) ) ; } return new hash set < > ( 0 ) ; }


set the response as an error response plus some data

public static http response error j s o n ( @ non null string message , @ non null map < ? , ? > data ) { return new j s o n object response ( data ) error ( message ) ; }


return true if this triangle object is equal to o

public boolean equals ( object o ) { return super equals ( o ) & & objects equals ( this additional properties , ( ( triangle ) o ) additional properties ) ; }


prepare data chunks for each data unit , by generating random data

protected e c chunk [ ] prepare data chunks for encoding ( ) { if ( using fixed data ) { e c chunk [ ] chunks = new e c chunk [ num data units ] ; for ( int i = 0 ; i < chunks length ; i + + ) { chunks [ i ] = make chunk using data ( fixed data [ i ] ) ; } return chunks ; } return generate data chunks ( ) ; }


get the name of the context hierarchy level that was declared via { @ link context configuration @ context configuration }

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


returns a set of all key - value pairs changes to the returned set will update the underlying multimap , and vice versa the entries set does not support the { @ code add } or { @ code add all } operations the iterator generated by the returned set traverses the entries in the order they were added to the multimap each entry is an immutable snapshot of a key - value mapping in the multimap , taken at the time the entry is returned by a method call to the collection or its iterator

public set < entry < k , v > > entries ( ) { return super entries ( ) ; }


generates a xml response that describe the ec2 instances todo : org elasticsearch discovery ec 2 amazon e c 2 fixture uses pretty much the same code we should dry up that test fixture

static byte [ ] generate describe instances response ( list < instance > instances ) { final x m l output factory xml output factory = x m l output factory new factory ( ) ; xml output factory set property ( x m l output factory is repairing namespaces , true ) ; final string writer out = new string writer ( ) ; x m l stream writer sw ; try { sw = xml output factory create x m l stream writer ( out ) ; sw write start document ( ) ; string namespace = " http : / / ec 2 amazonaws com / doc / 2013 - 02 - 01 / " ; sw set default namespace ( namespace ) ; sw write start element ( x m l constants default ns prefix , " describe instances response " , namespace ) ; { sw write start element ( " request id " ) ; sw write characters ( uuid random u u i d ( ) to string ( ) ) ; sw write end element ( ) ; sw write start element ( " reservation set " ) ; { for ( instance instance : instances ) { sw write start element ( " item " ) ; { sw write start element ( " reservation id " ) ; sw write characters ( uuid random u u i d ( ) to string ( ) ) ; sw write end element ( ) ; sw write start element ( " instances set " ) ; { sw write start element ( " item " ) ; { sw write start element ( " instance id " ) ; sw write characters ( instance get instance id ( ) ) ; sw write end element ( ) ; sw write start element ( " image id " ) ; sw write characters ( instance get image id ( ) ) ; sw write end element ( ) ; sw write start element ( " instance state " ) ; { sw write start element ( " code " ) ; sw write characters ( " 16 " ) ; sw write end element ( ) ; sw write start element ( " name " ) ; sw write characters ( " running " ) ; sw write end element ( ) ; } sw write end element ( ) ; sw write start element ( " private dns name " ) ; sw write characters ( instance get private dns name ( ) ) ; sw write end element ( ) ; sw write start element ( " dns name " ) ; sw write characters ( instance get public dns name ( ) ) ; sw write end element ( ) ; sw write start element ( " instance type " ) ; sw write characters ( " m 1 medium " ) ; sw write end element ( ) ; sw write start element ( " placement " ) ; { sw write start element ( " availability zone " ) ; sw write characters ( " use - east - 1e " ) ; sw write end element ( ) ; sw write empty element ( " group name " ) ; sw write start element ( " tenancy " ) ; sw write characters ( " default " ) ; sw write end element ( ) ; } sw write end element ( ) ; sw write start element ( " private ip address " ) ; sw write characters ( instance get private ip address ( ) ) ; sw write end element ( ) ; sw write start element ( " ip address " ) ; sw write characters ( instance get public ip address ( ) ) ; sw write end element ( ) ; sw write start element ( " tag set " ) ; for ( tag tag : instance get tags ( ) ) { sw write start element ( " item " ) ; { sw write start element ( " key " ) ; sw write characters ( tag get key ( ) ) ; sw write end element ( ) ; sw write start element ( " value " ) ; sw write characters ( tag get value ( ) ) ; sw write end element ( ) ; } sw write end element ( ) ; } sw write end element ( ) ; } sw write end element ( ) ; } sw write end element ( ) ; } sw write end element ( ) ; } sw write end element ( ) ; } sw write end element ( ) ; sw write end document ( ) ; sw flush ( ) ; } } catch ( exception e ) { throw new runtime exception ( e ) ; } return out to string ( ) get bytes ( utf 8 ) ; }


get or create { @ link annotation type mappings } for the specified annotation type

annotation type mappings get ( class < ? extends annotation > annotation type ) { return this mappings compute if absent ( annotation type , this : : create mappings ) ; }


sets the settings to be updated ( either json or yaml format )

public update settings request settings ( map < string , ? > source ) { this settings = settings builder ( ) load from map ( source ) build ( ) ; return this ; }


short argument that matches both given argument matchers see examples in javadoc for { @ link additional matchers } class

public static short and ( short first , short second ) { mocking progress ( ) get argument matcher storage ( ) report and ( ) ; return 0 ; }


gets the index of the given type , which must have been added to this instance

public int index of ( type type ) { if ( type = = null ) { throw new null pointer exception ( " type = = null " ) ; } throw if not prepared ( ) ; type id item item = type ids get ( type ) ; if ( item = = null ) { throw new illegal argument exception ( " not found : " + type ) ; } return item get index ( ) ; }


returns the key of this parameter , e g " jobid "

public final string get key ( ) { return key ; }


the name of the type this corresponds to the ' type ' part of a full resource name of the form package : typeentry the set of legal type names is listed in resource cpp < code > optional string name = 2 ; < code >

private void set name ( java lang string value ) { if ( value = = null ) { throw new null pointer exception ( ) ; } bit field 0 | = 0x 0 0 0 0 0 0 0 2 ; name = value ; }


return the web socket protocol extensions supported by the underlying web socket server

list < web socket extension > get supported extensions ( server http request request ) ;


deserializes the { @ link rva va debug header } information from a { @ link pdb byte reader }

public void deserialize ( pdb byte reader reader ) throws pdb exception { super deserialize ( reader ) ; relative virtual address data base = reader parse unsigned int val ( ) ; virtual address image base = reader parse unsigned long val ( ) ; unsigned int reserved 1 = reader parse unsigned int val ( ) ; unsigned int reserved 2 = reader parse unsigned int val ( ) ; }


return the configured list of media types

public list < media type > get content types ( ) { return this content types ; }


set the reader ( andor reader group ) list string

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


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


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


returns the total number of shards plus the number of empty groups

public int total size with 1 for empty ( ) { int size = 0 ; for ( shard it shard : iterators ) { size + = math max ( 1 , shard size ( ) ) ; } return size ; }


return whether the file is newmodifieddeleted


public put repository request settings ( settings builder settings ) { this settings = settings build ( ) ; return this ; }


implements { @ link options parser # as list of option values ( ) }

list < option value description > as list of effective options ( ) { list < option value description > result = new array list < > ( ) ; for ( map entry < string , option definition > map entry : options data get all option definitions ( ) ) { option definition option definition = map entry get value ( ) ; option value description option value = option values get ( option definition ) ; if ( option value = = null ) { result add ( option value description get default option value ( option definition ) ) ; } else { result add ( option value ) ; } } return result ; }


method called when the action is invoked

public void action performed ( action context context ) { int user choice = option dialog show option dialog ( panel , " remove all fields ? " , " there is no undo for this action \ n " + " are you sure you want to remove all fields ? " , " continue " , option dialog warning message ) ; if ( user choice = = option dialog cancel option ) { return ; } panel set tab lock ( true ) ; field header location loc = ( field header location ) context get context object ( ) ; field format model model at location = loc get model ( ) ; model at location remove all factories ( ) ; }


this method is deprecated and will be removed in the future releases handle async db operation in your own logic instead

public static count executor count async ( final string table name ) { final count executor executor = new count executor ( ) ; runnable runnable = new runnable ( ) { @ override public void run ( ) { synchronized ( lite pal support class ) { final int count = count ( table name ) ; if ( executor get listener ( ) ! = null ) { operator get handler ( ) post ( new runnable ( ) { @ override public void run ( ) { executor get listener ( ) on finish ( count ) ; } } ) ; } } } } ; executor submit ( runnable ) ; return executor ; }


callback hook for nested spring : argument tags to pass their value to the parent tag

void add argument ( @ nullable object argument ) throws jsp tag exception ;


public com google common util concurrent listenable future < io grpc benchmarks proto control void > quit worker ( io grpc benchmarks proto control void request ) { return io grpc stub client calls future unary call ( get channel ( ) new call ( get quit worker method ( ) , get call options ( ) ) , request ) ; }


helper method to set api key value for the first api key authentication

public void set api key ( string api key ) { for ( authentication auth : authentications values ( ) ) { if ( auth instanceof api key auth ) { ( ( api key auth ) auth ) set api key ( api key ) ; return ; } } throw new runtime exception ( " no api key authentication configured ! " ) ; }


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


protected abstract model and view handle request internal ( http servlet request request , http servlet response response ) throws exception ;


whether suffix pattern matching should work only against path extensions explicitly registered when you { @ link web mvc configurer # configure content negotiation configure content negotiation } this is generally recommended to reduce ambiguity and to avoid issues such as when a " " appears in the path for other reasons by default this is set to " false " note : this property is mutually exclusive with and ignored when { @ link # set pattern parser ( path pattern parser ) } is set

public path match configurer set use registered suffix pattern match ( boolean registered suffix pattern match ) { this registered suffix pattern match = registered suffix pattern match ; return this ; }


return whether the rom is made by lenovo

public static boolean is lenovo ( ) { return rom lenovo [ 0 ] equals ( get rom info ( ) name ) ; }


ensures the truth of an expression involving the state of the calling instance , but not involving any parameters to the calling method

public static void check state ( boolean expression , @ nullable object error message ) { if ( ! expression ) { throw new illegal state exception ( string value of ( error message ) ) ; } }


convenient call for { @ link org greenrobot greendao abstract dao # delete ( object ) } entity must attached to an entity context

public void delete ( ) { throw if detached ( ) ; my dao delete ( this ) ; }


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


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


template to allow for customizing the given { @ link x stream } the default implementation is empty

protected void customize x stream ( x stream xstream ) { }


create a { @ link uri components builder } by invoking a " mock " controller method the controller method and the supplied argument values are then used to delegate to { @ link # from method ( class , method , object ) } for example , given this controller : < pre class = " code " > & # 064 ; request mapping ( " people { id } addresses " ) class address controller { & # 064 ; request mapping ( " { country } " ) public http entity & lt ; void & gt ; get addresses for country ( & # 064 ; path variable string country ) { } & # 064 ; request mapping ( value = " " , method = request method post ) public void add address ( address address ) { } } a uri components builder can be created : < pre class = " code " > inline style with static import of " mvc uri components builder on " mvc uri components builder from method call ( on ( address controller class ) get addresses for country ( " us " ) ) build and expand ( 1 ) ; longer form useful for repeated invocation ( and void controller methods ) address controller controller = mvc uri components builder on ( address controller class ) ; controller add address ( null ) ; builder = mvc uri components builder from method call ( controller ) ; controller get addresses for country ( " us " ) builder = mvc uri components builder from method call ( controller ) ; note : this method extracts values from " forwarded " and " x - forwarded - " headers if found see class - level docs

public static uri components builder from method call ( object info ) { assert is instance of ( method invocation info class , info , " method invocation info required " ) ; method invocation info invocation info = ( method invocation info ) info ; class < ? > controller type = invocation info get controller type ( ) ; method method = invocation info get controller method ( ) ; object [ ] arguments = invocation info get argument values ( ) ; return from method internal ( null , controller type , method , arguments ) ; }


adds the specified number of new free objects to the pool usually called early on as a pre - allocation mechanism but can be used at any time

public void fill ( int size ) { for ( int i = 0 ; i < size ; i + + ) if ( free objects size < max ) free objects add ( new object ( ) ) ; peak = math max ( peak , free objects size ) ; }


public static string get file content ( file file , string charset name ) throws i o exception { random access file fis = null ; file lock rlock = null ; try { fis = new random access file ( file , " r " ) ; file channel fcin = fis get channel ( ) ; int i = 0 ; do { try { rlock = fcin try lock ( 0l , long max value , true ) ; } catch ( exception e ) { + + i ; if ( i > retry count ) { naming logger error ( " [ na ] read " + file get name ( ) + " fail ; retryed time : " + i , e ) ; throw new i o exception ( " read " + file get absolute path ( ) + " conflict " ) ; } sleep ( sleep basetime * i ) ; naming logger warn ( " read " + file get name ( ) + " conflict ; retry time : " + i ) ; } } while ( null = = rlock ) ; int file size = ( int ) fcin size ( ) ; byte buffer byte buffer = byte buffer allocate ( file size ) ; fcin read ( byte buffer ) ; byte buffer flip ( ) ; return byte buffer to string ( byte buffer , charset name ) ; } finally { if ( rlock ! = null ) { rlock release ( ) ; rlock = null ; } if ( fis ! = null ) { io utils close quietly ( fis ) ; fis = null ; } } }


creates a result might start threads or opens sockets so every created result must be closed

public < t > dynamic result < t > create result ( environment env , table schema schema , execution config config ) { if ( env get execution ( ) in streaming mode ( ) ) { / / determine gateway address ( and port if possible ) final inet address gateway address = get gateway address ( env get deployment ( ) ) ; final int gateway port = get gateway port ( env get deployment ( ) ) ; if ( env get execution ( ) is changelog mode ( ) | | env get execution ( ) is tableau mode ( ) ) { return new changelog collect stream result < > ( schema , config , gateway address , gateway port ) ; } else { return new materialized collect stream result < > ( schema , config , gateway address , gateway port , env get execution ( ) get max table result rows ( ) ) ; } } else { / / batch execution if ( env get execution ( ) is table mode ( ) | | env get execution ( ) is tableau mode ( ) ) { return new materialized collect batch result < > ( schema , config ) ; } else { throw new sql execution exception ( " results of batch queries can only be served in table or tableau mode " ) ; } } }


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


invokes a specified callable , timing out after the specified time limit if the target method call finishes before the limit is reached , the return value or a wrapped exception is propagated if , on the other hand , the time limit is reached , we attempt to abort the call to the target , and throw a { @ link timeout exception } to the caller

default < t > t call with timeout ( callable < t > callable , duration timeout ) throws timeout exception , interrupted exception , execution exception { return call with timeout ( callable , to nanos saturated ( timeout ) , time unit nanoseconds ) ; }


sets a custom option any existing value for the key is overwritten

public < t > call options with option ( key < t > key , t value ) { preconditions check not null ( key , " key " ) ; preconditions check not null ( value , " value " ) ; call options new options = new call options ( this ) ; int existing idx = - 1 ; for ( int i = 0 ; i < custom options length ; i + + ) { if ( key equals ( custom options [ i ] [ 0 ] ) ) { existing idx = i ; break ; } } new options custom options = new object [ custom options length + ( existing idx = = - 1 ? 1 : 0 ) ] [ 2 ] ; system arraycopy ( custom options , 0 , new options custom options , 0 , custom options length ) ; if ( existing idx = = - 1 ) { / / add a new option new options custom options [ custom options length ] = new object [ ] { key , value } ; } else { / / replace an existing option new options custom options [ existing idx ] = new object [ ] { key , value } ; } return new options ; }


returns the list of files that are required to execute this spawn ( e g the compiler binary ) , in contrast to files necessary for the tool to do its work ( e g source code to be compiled ) the returned set of files is a subset of what get input files ( ) returns this method explicitly does not expand middleman artifacts pass the result to an appropriate utility method on { @ link com google devtools build lib actions artifact } to expand the middlemen this is for use with persistent workers , so we can restart workers when their binaries have changed

nested set < ? extends action input > get tool files ( ) ;


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


public long get total space ( ) { return this total space ; }


compute the path where the output of a committed task is stored until the entire job is committed

path get committed task path ( task attempt context context ) { path out = get output path ( context ) ; return out = = null ? null : org apache hadoop mapreduce lib output file output committer get committed task path ( context , out ) ; }


retrieve a snapshot of total requests , error count and error percentage this metrics should measure the actual health of a { @ link hystrix command } for that reason , the following are included : { @ link hystrix event type # success } { @ link hystrix event type # failure } { @ link hystrix event type # timeout } { @ link hystrix event type # thread pool rejected } { @ link hystrix event type # semaphore rejected } the following are not included in either attemptsfailures : { @ link hystrix event type # bad request } - this event denotes bad arguments to the command and not a problem with the command { @ link hystrix event type # short circuited } - this event measures a health problem in the past , not a problem with the current state { @ link hystrix event type # cancelled } - this event denotes a user - cancelled command it ' s not known if it would have been a success or failure , so it shouldn ' t count for either all fallback metrics { @ link hystrix event type # emit } - this event is not a terminal state for the command { @ link hystrix event type # collapsed } - this event is about the batching process , not the command execution

public health counts get health counts ( ) { return health counts stream get latest ( ) ; }


invokes jenkins exe with a scm management command

static int run elevated ( file jenkins exe , string command , task listener out , file pwd ) throws i o exception , interrupted exception { return new local launcher ( out ) launch ( ) cmds ( jenkins exe , command ) stdout ( out ) pwd ( pwd ) join ( ) ; }


public int get queue length ( ) { return queue length ; }


test used to verify the happy path of { @ link thread async executor # start process ( callable , async callback ) } when a task takes a while to execute

void test long running task with callback ( ) throws exception { assert timeout ( of millis ( 5000 ) , ( ) - > { / / instantiate a new executor and start a new ' null ' task final var executor = new thread async executor ( ) ; final var result = new object ( ) ; when ( task call ( ) ) then answer ( i - > { thread sleep ( 1500 ) ; return result ; } ) ; final var async result = executor start process ( task , callback ) ; assert not null ( async result ) ; assert false ( async result is completed ( ) ) ; verify zero interactions ( callback ) ; try { async result get value ( ) ; fail ( " expected illegal state exception when calling async result # get value on a non - completed task " ) ; } catch ( illegal state exception e ) { assert not null ( e get message ( ) ) ; } / / our task should only execute once , but it can take a while verify ( task , timeout ( 3000 ) times ( 1 ) ) call ( ) ; verify ( callback , timeout ( 3000 ) times ( 1 ) ) on complete ( eq ( result ) , optional captor capture ( ) ) ; final var optional exception = optional captor get value ( ) ; assert not null ( optional exception ) ; assert false ( optional exception is present ( ) ) ; / / prevent timing issues , and wait until the result is available async result await ( ) ; assert true ( async result is completed ( ) ) ; verify no more interactions ( task , callback ) ; / / and the result should be exactly the same object assert same ( result , async result get value ( ) ) ; } ) ; }


resolve the argument also matching to the given type

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


private void create radix panel ( ) { row layout row layout 1 = new row layout ( ) ; / / row layout 1 margin height = 5 ; row layout 1 margin top = 2 ; row layout 1 margin bottom = 2 ; / / row layout 1 margin width = 5 ; row layout 1 type = swt vertical ; composite composite = new composite ( text composite , swt none ) ; composite set layout ( row layout 1 ) ; selection adapter hex text selection adapter = new selection adapter ( ) { @ override public void widget selected ( org eclipse swt events selection event e ) { text set text ( text get text ( ) ) ; / / generate event last hex button selected = e widget = = hex radio button ; } } ; / / besides the crashes : the user always knows which number is entering , don ' t need any automatic / / conversion what does sometimes happen is one enters the right number and the wrong binary or dec was / / selected in that case automatic conversion is the wrong thing to do and very annoying hex radio button = new button ( composite , swt radio ) ; hex radio button set text ( " hex " ) ; / / $ non - nls - 1 $ hex radio button add selection listener ( default selection adapter ) ; hex radio button add selection listener ( hex text selection adapter ) ; dec radio button = new button ( composite , swt radio ) ; dec radio button set text ( " dec " ) ; / / $ non - nls - 1 $ dec radio button add selection listener ( default selection adapter ) ; dec radio button add selection listener ( hex text selection adapter ) ; / / dec text selection adapter ) ; }


returns the number of documents in the in this commit

public int get num docs ( ) { return num docs ; }


check if this symbol consumes an operand index of its constructor

public boolean takes operand index ( ) { return true ; }


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


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


the new rename which has the posix semantic

static rename result rename to int ( f s directory fsd , f s permission checker pc , final string src arg , final string dst arg , boolean log retry cache , options rename options ) throws i o exception { string src = src arg ; string dst = dst arg ; if ( name node state change log is debug enabled ( ) ) { name node state change log debug ( " dir * name system rename to : with options - " + " " + src + " to " + dst ) ; } blocks map update info collected blocks = new blocks map update info ( ) ; / / returns resolved path return rename to ( fsd , pc , src , dst , collected blocks , log retry cache , options ) ; }


adds constraints describing the execution environment

public builder add exec constraints ( iterable < constraint value info > constraints ) { this exec constraints add constraints ( constraints ) ; return this ; }


serializes the template to x content , making sure not to nest mappings under the type name note that this method should currently only be used for creating rest responses , and not when directly updating stored templates index templates are still stored in the old , typed format , and have yet to be migrated to be typeless

public static void to x content ( index template metadata index template metadata , x content builder builder , to x content params params ) throws i o exception { builder start object ( index template metadata name ( ) ) ; to inner x content ( index template metadata , builder , params , false ) ; builder end object ( ) ; }


returns an instance for the given register number , type , and variable info this method is allowed to return shared instances ( but doesn ' t necessarily do so )

public static register spec make ( int reg , type bearer type , local item local ) { if ( local = = null ) { throw new null pointer exception ( " local = = null " ) ; } return intern ( reg , type , local ) ; }


public web security configurer adapter cas configuration server web security configurer adapter ( final server properties server properties ) { return new web security configurer adapter ( ) { @ override protected void configure ( final http security http ) throws exception { val path = server properties get servlet ( ) get context path ( ) ; http authorize requests ( ) ant matchers ( path + " / decrypt / * * " ) authenticated ( ) and ( ) csrf ( ) disable ( ) ; http authorize requests ( ) ant matchers ( path + " / encrypt


emits pcode to assign the result of a cpool op to the call target register for an invocation

static void emit pcode to resolve method reference ( pcode op emitter p code , int offset , abstract constant pool info java [ ] constant pool , java invocation type type ) { switch ( type ) { case invoke dynamic : p code emit assign register from pcode op call ( call target , constant pool java cpool op , static offset , integer to string ( offset ) , constant pool java cpool invokedynamic ) ; break ; case invoke interface : p code emit assign register from pcode op call ( call target , constant pool java cpool op , this , integer to string ( offset ) , constant pool java cpool invokeinterface ) ; break ; case invoke special : p code emit assign register from pcode op call ( call target , constant pool java cpool op , this , integer to string ( offset ) , constant pool java cpool invokespecial ) ; break ; case invoke static : p code emit assign register from pcode op call ( call target , constant pool java cpool op , static offset , integer to string ( offset ) , constant pool java cpool invokestatic ) ; break ; case invoke virtual : p code emit assign register from pcode op call ( call target , constant pool java cpool op , this , integer to string ( offset ) , constant pool java cpool invokevirtual ) ; break ; default : throw new illegal argument exception ( " unimplemented java method type : " + type to string ( ) ) ; } }


returns a new { @ link repository remote executor } or { @ code null }


add one or more resource locations from which to serve static content each location must point to a valid directory multiple locations may be specified as a comma - separated list , and the locations will be checked for a given resource in the order specified for example , { { @ code " " } , { @ code " classpath : meta - i n fpublic - web - resources " } } allows resources to be served both from the web application root and from any jar on the classpath that contains a { @ code meta - i n fpublic - web - resources } directory , with resources in the web application root taking precedence

public resource handler registration add resource locations ( string resource locations ) { this location values add all ( arrays as list ( resource locations ) ) ; return this ; }


balance the entries contained within two adjacent child interior nodes one of the two nodes must be half - full or less this could result in the removal of a child node if entries will fit within one node

private fixed key node balance child ( fixed key interior node left node , fixed key interior node right node ) throws i o exception { field right key = right node get key field ( 0 ) ; int left key count = left node key count ; int right key count = right node key count ; int new left key count = left key count + right key count ; / / can right keys fit within left node if ( new left key count < = max key count ) { / / right node is elliminated and all entries stored in left node move keys left ( left node , right node , right key count ) ; node mgr delete node ( right node ) ; return delete child ( right key ) ; } new left key count = new left key count / 2 ; if ( new left key count < left key count ) { move keys right ( left node , right node , left key count - new left key count ) ; } else if ( new left key count > left key count ) { move keys left ( left node , right node , new left key count - left key count ) ; } this key changed ( right key , right node get key ( 0 ) ) ; return get root ( ) ; }


create a new { @ code server service definition } whose { @ link server call handler } s will call { @ code interceptors } before calling the pre - existing { @ code server call handler } the last interceptor will have its { @ link server interceptor # intercept call } called first

public static server service definition intercept ( server service definition service def , server interceptor interceptors ) { return intercept ( service def , arrays as list ( interceptors ) ) ; }


get the byte string for frequently used fixed and small set strings

public static byte string get fixed byte string ( string key ) { byte string value = fixed bytestring cache get ( key ) ; if ( value = = null ) { value = byte string copy from utf 8 ( key ) ; fixed bytestring cache put ( key , value ) ; } return value ; }


whether the given type is a handler with handler methods

protected abstract boolean is handler ( class < ? > bean type ) ;


check if we are ready to send another chunk

private void check flush ( boolean force ) { if ( ( force & & sb length ( ) > 0 ) | | sb length ( ) > 2048 ) { send buffer sync ( byte buffer wrap ( sb to string ( ) get bytes ( utf 8 ) ) ) ; / / clear our internal buffer sb set length ( 0 ) ; } }


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


generates a go to event and handles any history state that needs to be saved this method will attempt to find the program that contains the given program location

public boolean go to ( program location loc ) ;


clears all selected records from multi - select mode

void clear selection ( ) { selected clear ( ) ; }


public account find account by user ( user user ) { if ( ! user 2 account contains key ( user ) ) { return null ; } return user 2 account get ( user ) ; }


public void small snake test ( ) { / / todo : test small snake }


specify whether to submit a binary stream character stream to the jdbc driver as explicit lob content , using the jdbc 4 0 { @ code set blob } { @ code set clob } method with a stream argument default is " false " , using the common jdbc 2 0 { @ code set binary stream } { @ code set character stream } method for setting the content switch this to " true " for explicit jdbc 4 0 streaming , provided that your jdbc driver actually supports those jdbc 4 0 operations ( e g derby ' s ) this setting affects stream arguments as well as byte array string arguments , requiring jdbc 4 0 support for supporting lob content against jdbc 3 0 , check out the { @ link # set wrap as lob " wrap as lob " } setting

public void set stream as lob ( boolean stream as lob ) { this stream as lob = stream as lob ; }


writes b length bytes from the specified byte array to this output stream the general contract for write ( b ) is that it should have exactly the same effect as the call write ( b , 0 , b length )

public void write ( byte [ ] b ) throws i o exception { check open ( ) ; try { out write ( b ) ; } catch ( i o exception e ) { if ( e get cause ( ) instanceof storage exception ) { storage exception storage excp = ( storage exception ) e get cause ( ) ; log error ( " encountered storage exception for write on blob : { } " + " exception details : { } error code : { } " , key , e get message ( ) , storage excp get error code ( ) ) ; } throw e ; } }


compatible with old design , it will be perfected in the future

static config service create config service ( nacos config properties nacos config properties ) { if ( objects is null ( service ) ) { synchronized ( nacos config manager class ) { try { if ( objects is null ( service ) ) { service = nacos factory create config service ( nacos config properties assemble config service properties ( ) ) ; } } catch ( nacos exception e ) { log error ( e get message ( ) ) ; throw new nacos connection failure exception ( nacos config properties get server addr ( ) , e get message ( ) , e ) ; } } } return service ; }


returns the number of bytes in the file region described by this source split

public long length ( ) { return length ; }


generate a { @ link snapshot diff report listing } based on detailed diff information

public snapshot diff report listing generate report ( ) { return new snapshot diff report listing ( last path , modified list , created list , deleted list , last index , is from earlier ( ) ) ; }


1 run a set of operations 2 trigger the nn failover 3 check the retry cache on the original standby nn

public void test retry cache on standby n n ( ) throws exception { / / 1 run operations d f s test util run operations ( cluster , dfs , conf , block size , 0 ) ; / / check retry cache in nn1 f s namesystem fsn 0 = cluster get namesystem ( 0 ) ; light weight cache < cache entry , cache entry > cache set = ( light weight cache < cache entry , cache entry > ) fsn 0 get retry cache ( ) get cache set ( ) ; assert equals ( " retry cache size is wrong " , 39 , cache set size ( ) ) ; map < cache entry , cache entry > old entries = new hash map < cache entry , cache entry > ( ) ; iterator < cache entry > iter = cache set iterator ( ) ; while ( iter has next ( ) ) { cache entry entry = iter next ( ) ; old entries put ( entry , entry ) ; } / / 2 failover the current standby to active cluster get name node ( 0 ) get rpc server ( ) roll edit log ( ) ; cluster get name node ( 1 ) get namesystem ( ) get edit log tailer ( ) do tail edits ( ) ; cluster shutdown name node ( 0 ) ; cluster transition to active ( 1 ) ; / / 3 check the retry cache on the new active nn f s namesystem fsn 1 = cluster get namesystem ( 1 ) ; cache set = ( light weight cache < cache entry , cache entry > ) fsn 1 get retry cache ( ) get cache set ( ) ; assert equals ( " retry cache size is wrong " , 39 , cache set size ( ) ) ; iter = cache set iterator ( ) ; while ( iter has next ( ) ) { cache entry entry = iter next ( ) ; assert true ( old entries contains key ( entry ) ) ; } }


encode the header field into the header block the given { @ link char sequence } s must be immutable !

public void encode headers ( int stream id , byte buf out , http 2 headers headers , sensitivity detector sensitivity detector ) throws http 2 exception { if ( ignore max header list size ) { encode headers ignore max header list size ( out , headers , sensitivity detector ) ; } else { encode headers enforce max header list size ( stream id , out , headers , sensitivity detector ) ; } }


test if the rpc server gets the retry count from client

public void test call retry count ( ) throws i o exception { final int retry count = 255 ; / / override client to store the call id final client client = new client ( long writable class , conf ) ; client set call id and retry count ( client next call id ( ) , 255 , null ) ; / / attach a listener that tracks every call id received by the server final test server server = new test server ( 1 , false ) ; server call listener = new runnable ( ) { @ override public void run ( ) { / / we have not set the retry count for the client , thus on the server / / side we should see retry count as 0 assert assert equals ( retry count , server get call retry count ( ) ) ; } } ; try { inet socket address addr = net utils get connect address ( server ) ; server start ( ) ; final serial caller caller = new serial caller ( client , addr , 10 ) ; caller run ( ) ; assert false ( caller failed ) ; } finally { client stop ( ) ; server stop ( ) ; } }


tells whether the target has managed code andor data present

public boolean is managed code data present ( ) { return managed code data present ; }


admin settings find by key ( tenant id tenant id , string key ) ;


returns < code > string class < code > regardless of < code > column index < code >

public class < ? > get column class ( int column index ) { if ( column index = = get data type column ( ) ) { return data type instance class ; } return string class ; }


set the maximum interval , in milliseconds , at which the " system " relay session expects , in the absence of any other data , to receive a heartbeat from the stomp broker a value of zero will configure the relay session to expect not to receive heartbeats from the broker the default value is 10000

public stomp broker relay registration set system heartbeat receive interval ( long heartbeat receive interval ) { this system heartbeat receive interval = heartbeat receive interval ; return this ; }


puts all the entries in the map to the builder

public builder < v type > put all ( map < integer , v type > map ) { for ( map entry < integer , v type > entry : map entry set ( ) ) { this map put ( entry get key ( ) , entry get value ( ) ) ; } return this ; }


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


computes how much of the queue can be filled by splits with the network topology distance to a node given by split affinity a split with zero affinity can only fill half the queue , whereas one that matches exactly can fill the entire queue

private int calculate max pending splits ( int split affinity , int total depth ) { if ( total depth = = 0 ) { return max pending splits per task ; } / / use half the queue for any split / / reserve the other half for splits that have some amount of network affinity double queue fraction = 0 5 * ( 1 0 + split affinity / ( double ) total depth ) ; return ( int ) math ceil ( max pending splits per task * queue fraction ) ; }


returns the metric group for the parallel subtask of the source that runs this { @ link serialization schema } instances of this class can be used to register new metrics with flink and to create a nested hierarchy based on the group names see { @ link metric group } for more information for the metrics system


public sequence item get item ( ) { return frequent item ; }


test case where a bunch of threads are continuously calling hflush ( ) while another thread appends some data and then closes the file the hflushing threads should eventually catch an i o exception stating that the stream was closed - - and not an npe or anything like that

public void test hflush while closing ( ) throws throwable { configuration conf = new configuration ( ) ; mini d f s cluster cluster = new mini d f s cluster builder ( conf ) build ( ) ; file system fs = cluster get file system ( ) ; path p = new path ( " / hflush - and - close dat " ) ; final f s data output stream stm = create file ( fs , p , 1 ) ; array list < thread > flushers = new array list < thread > ( ) ; final atomic reference < throwable > thrown = new atomic reference < throwable > ( ) ; try { for ( int i = 0 ; i < 10 ; i + + ) { thread flusher = new thread ( ) { @ override public void run ( ) { try { while ( true ) { try { stm hflush ( ) ; } catch ( closed channel exception ioe ) { / / expected exception caught ignoring return ; } } } catch ( throwable t ) { thrown set ( t ) ; } } } ; flusher start ( ) ; flushers add ( flusher ) ; } / / write some data for ( int i = 0 ; i < 10000 ; i + + ) { stm write ( 1 ) ; } / / close it while the flushing threads are still flushing stm close ( ) ; / / wait for the flushers to all die for ( thread t : flushers ) { t join ( ) ; } / / they should have all gotten the expected exception , not anything / / else if ( thrown get ( ) ! = null ) { throw thrown get ( ) ; } } finally { fs close ( ) ; cluster shutdown ( ) ; } }


sets an intercept touch handler that will be invoked when { @ link host view # on intercept touch event } is called

public void set intercept touch event handler ( @ nullable intercept touch handler intercept touch event handler ) { m on intercept touch event handler = intercept touch event handler ; }


look up the offsets for the given partitions by timestamp the returned offset for each partition is the earliest offset whose timestamp is greater than or equal to the given timestamp in the corresponding partition this is a blocking call the consumer does not have to be assigned the partitions if the message format version in a partition is before 0 10 0 , i e the messages do not have timestamps , null will be returned for that partition

public map < topic partition , offset and timestamp > offsets for times ( map < topic partition , long > timestamps to search , duration timeout ) { acquire and ensure open ( ) ; try { for ( map entry < topic partition , long > entry : timestamps to search entry set ( ) ) { / / we explicitly exclude the earliest and latest offset here so the timestamp in the returned / / offset and timestamp is always positive if ( entry get value ( ) < 0 ) throw new illegal argument exception ( " the target time for partition " + entry get key ( ) + " is " + entry get value ( ) + " the target time cannot be negative " ) ; } return fetcher offsets for times ( timestamps to search , time timer ( timeout ) ) ; } finally { release ( ) ; } }


handles phi uses of new objects will merge together the sources of a phi into a single escape set adds the result of the phi to the worklist so its uses can be followed

private void process phi use ( ssa insn use , escape set esc set , array list < register spec > reg worklist ) { int set index = find set index ( use get result ( ) ) ; if ( set index ! = lattice values size ( ) ) { / / check if result is in a set already escape set merge set = lattice values get ( set index ) ; if ( merge set ! = esc set ) { / / if it is , merge the sets and states , then delete the copy esc set replaceable array = false ; esc set reg set or ( merge set reg set ) ; if ( esc set escape compare to ( merge set escape ) < 0 ) { esc set escape = merge set escape ; } replace node ( esc set , merge set ) ; lattice values remove ( set index ) ; } } else { / / if no set is found , add it to this esc set and the worklist esc set reg set set ( use get result ( ) get reg ( ) ) ; reg worklist add ( use get result ( ) ) ; } }


tells if the function is declspec ( strict gs check )

public boolean is declspec strict gs check ( ) { return is declspec strict gs check ; }


{ @ link ip 4 subnet filter rule } or { @ link ip 6 subnet filter rule }

ip filter rule get filter rule ( ) { return filter rule ; }


fill in the space portion of a fixed handle , based on this const

public void fillin space ( fixed handle hand , parser walker walker ) { switch ( type ) { case j curspace : hand space = walker get cur space ( ) ; return ; case handle : { fixed handle otherhand = walker get fixed handle ( handle index ) ; switch ( select ) { case v space : hand space = otherhand space ; return ; default : break ; } } case spaceid : hand space = value spaceid ; return ; default : break ; } throw new sleigh exception ( " const tpl is not a spaceid as expected " ) ; }


sets an exception to be re - thrown by render

protected final void set pending playback exception ( exo playback exception exception ) { pending playback exception = exception ; }


public int get connect timeout ( ) { return connection timeout ; }