idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
16,600
public PathImpl getParent ( ) { if ( _pathname . length ( ) <= 1 ) return lookup ( "/" ) ; int length = _pathname . length ( ) ; int lastSlash = _pathname . lastIndexOf ( '/' ) ; if ( lastSlash < 1 ) return lookup ( "/" ) ; if ( lastSlash == length - 1 ) { lastSlash = _pathname . lastIndexOf ( '/' , length - 2 ) ; if (...
Return the parent Path
16,601
static protected String normalizePath ( String oldPath , String newPath , int offset , char separatorChar ) { CharBuffer cb = new CharBuffer ( ) ; normalizePath ( cb , oldPath , newPath , offset , separatorChar ) ; return cb . toString ( ) ; }
wrapper for the real normalize path routine to use CharBuffer .
16,602
static protected void normalizePath ( CharBuffer cb , String oldPath , String newPath , int offset , char separatorChar ) { cb . clear ( ) ; cb . append ( oldPath ) ; if ( cb . length ( ) == 0 || cb . lastChar ( ) != '/' ) cb . append ( '/' ) ; int length = newPath . length ( ) ; int i = offset ; while ( i < length ) {...
Normalizes a filesystemPath path .
16,603
public String getFullPath ( ) { if ( _root == this || _root == null ) return getPath ( ) ; String rootPath = _root . getFullPath ( ) ; String path = getPath ( ) ; if ( rootPath . length ( ) <= 1 ) return path ; else if ( path . length ( ) <= 1 ) return rootPath ; else return rootPath + path ; }
For chrooted filesystems return the real system path .
16,604
public Class < ? > getClass ( int index ) { Object value = _values [ index - 1 ] ; if ( value == null ) { return null ; } else { return value . getClass ( ) ; } }
Returns the class of the column .
16,605
public String getString ( int index ) { Object value = _values [ index - 1 ] ; if ( value != null ) { return value . toString ( ) ; } else { return null ; } }
Returns the column as a String .
16,606
public long getLong ( int index ) { Object value = _values [ index - 1 ] ; if ( value instanceof Long ) { return ( Long ) value ; } else if ( value instanceof Integer ) { return ( Integer ) value ; } else { return Long . valueOf ( value . toString ( ) ) ; } }
Returns the column as a long .
16,607
public double getDouble ( int index ) { Object value = _values [ index - 1 ] ; if ( value instanceof Double ) { return ( Double ) value ; } else if ( value instanceof Float ) { return ( Float ) value ; } else if ( value instanceof Number ) { return ( Double ) ( ( Number ) value ) ; } else { return Double . valueOf ( va...
Returns the column as a double .
16,608
public boolean getBoolean ( int index ) { Object value = _values [ index - 1 ] ; if ( value instanceof Boolean ) { return ( Boolean ) value ; } else { return Boolean . valueOf ( value . toString ( ) ) ; } }
Returns the column as a boolean .
16,609
@ InService ( SegmentServiceImpl . class ) public Page writeCheckpoint ( TableKelp table , OutSegment sOut , long oldSequence , int saveLength , int tail , int saveSequence ) throws IOException { return null ; }
Called by the segment writing service to write the page to the stream .
16,610
public String getJavaCreateString ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "new com.caucho.v5.make.DependencyList()" ) ; for ( int i = 0 ; i < _dependencyList . size ( ) ; i ++ ) { sb . append ( ".add(" ) ; sb . append ( _dependencyList . get ( i ) . getJavaCreateString ( ) ) ; sb . append ( ")" )...
Returns a string to recreate the dependency .
16,611
protected void initRequest ( ) { _hostHeader = null ; _xForwardedHostHeader = null ; _expect100Continue = false ; _cookies . clear ( ) ; _contentLengthIn = - 1 ; _hasReadStream = false ; _readEncoding = null ; _startTime = - 1 ; _expireTime = - 1 ; _isUpgrade = false ; _statusCode = 200 ; _statusMessage = "OK" ; _heade...
Prepare the Request object for a new request .
16,612
public void clientDisconnect ( ) { try { OutHttpApp responseStream = _responseStream ; if ( responseStream != null ) { responseStream . close ( ) ; } } catch ( Exception e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; } ConnectionTcp conn = connTcp ( ) ; if ( conn != null ) { conn . clientDisconnect ( ) ; } ...
Called when the client has disconnected
16,613
public int getServerPort ( ) { String host = null ; CharSequence rawHost ; if ( ( rawHost = getHost ( ) ) != null ) { int length = rawHost . length ( ) ; int i ; for ( i = length - 1 ; i >= 0 ; i -- ) { if ( rawHost . charAt ( i ) == ':' ) { int port = 0 ; for ( i ++ ; i < length ; i ++ ) { char ch = rawHost . charAt (...
Returns the server s port .
16,614
public CharSegment getHeaderBuffer ( String name ) { String value = header ( name ) ; if ( value != null ) return new CharBuffer ( value ) ; else return null ; }
Fills the result with the header values as CharSegment values . Most implementations will implement this directly .
16,615
protected boolean addHeaderInt ( char [ ] keyBuf , int keyOff , int keyLen , CharSegment value ) { if ( keyLen < 4 ) { return true ; } int key1 = keyBuf [ keyOff ] | 0x20 | ( keyLen << 8 ) ; switch ( key1 ) { case CONNECTION_KEY : if ( match ( keyBuf , keyOff , keyLen , CONNECTION ) ) { char [ ] valueBuffer = value . b...
Adds the header checking for known values .
16,616
private boolean match ( char [ ] a , int aOff , int aLength , char [ ] b ) { int bLength = b . length ; if ( aLength != bLength ) return false ; for ( int i = aLength - 1 ; i >= 0 ; i -- ) { char chA = a [ aOff + i ] ; char chB = b [ i ] ; if ( chA != chB && chA + 'a' - 'A' != chB ) { return false ; } } return true ; }
Matches case insensitively with the second normalized to lower case .
16,617
public Enumeration < String > getHeaders ( String name ) { String value = header ( name ) ; if ( value == null ) { return Collections . emptyEnumeration ( ) ; } ArrayList < String > list = new ArrayList < String > ( ) ; list . add ( value ) ; return Collections . enumeration ( list ) ; }
Returns an enumeration of the headers for the named attribute .
16,618
public void getHeaderBuffers ( String name , ArrayList < CharSegment > resultList ) { String value = header ( name ) ; if ( value != null ) resultList . add ( new CharBuffer ( value ) ) ; }
Fills the result with a list of the header values as CharSegment values . Most implementations will implement this directly .
16,619
public int getIntHeader ( String key ) { CharSegment value = getHeaderBuffer ( key ) ; if ( value == null ) return - 1 ; int len = value . length ( ) ; if ( len == 0 ) throw new NumberFormatException ( value . toString ( ) ) ; int iValue = 0 ; int i = 0 ; int ch = value . charAt ( i ) ; int sign = 1 ; if ( ch == '+' ) ...
Returns the named header converted to an integer .
16,620
public String encoding ( ) { if ( _readEncoding != null ) return _readEncoding ; CharSegment value = getHeaderBuffer ( "Content-Type" ) ; if ( value == null ) return null ; int i = value . indexOf ( "charset" ) ; if ( i < 0 ) return null ; int len = value . length ( ) ; for ( i += 7 ; i < len && Character . isWhitespac...
Returns the character encoding of a post .
16,621
CookieWeb [ ] fillCookies ( ) { int size = _cookies . size ( ) ; if ( size > 0 ) { CookieWeb [ ] cookiesIn = new WebCookie [ size ] ; for ( int i = size - 1 ; i >= 0 ; i -- ) { cookiesIn [ i ] = _cookies . get ( i ) ; } return cookiesIn ; } else { return NULL_COOKIES ; } }
Parses cookie information from the cookie headers .
16,622
private void finishRequest ( ) throws IOException { try { cleanup ( ) ; } catch ( Exception e ) { log . log ( Level . WARNING , e . toString ( ) , e ) ; } finally { } }
Cleans up at the end of the request
16,623
public final OutHttpApp out ( ) { OutHttpApp stream = _responseStream ; if ( stream == null ) { stream = createOut ( ) ; _responseStream = stream ; } return stream ; }
Gets the response stream .
16,624
public boolean containsHeaderOut ( String name ) { ArrayList < String > headerKeys = _headerKeysOut ; int size = headerKeys . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { String oldKey = headerKeys . get ( i ) ; if ( oldKey . equalsIgnoreCase ( name ) ) { return true ; } } if ( name . equalsIgnoreCase ( "content-ty...
Returns true if the response already contains the named header .
16,625
public String headerOut ( String name ) { ArrayList < String > keys = _headerKeysOut ; int headerSize = keys . size ( ) ; for ( int i = 0 ; i < headerSize ; i ++ ) { String oldKey = keys . get ( i ) ; if ( oldKey . equalsIgnoreCase ( name ) ) { return ( String ) _headerValuesOut . get ( i ) ; } } if ( name . equalsIgno...
Returns the value of an already set output header .
16,626
public void addHeaderOutImpl ( String key , String value ) { if ( headerOutSpecial ( key , value ) ) { return ; } ArrayList < String > keys = _headerKeysOut ; ArrayList < String > values = _headerValuesOut ; int size = keys . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { if ( keys . get ( i ) . equals ( key ) && val...
Adds a new header . If an old header with that name exists both headers are output .
16,627
private boolean headerOutSpecial ( String key , String value ) { int length = key . length ( ) ; if ( length == 0 ) { return false ; } int ch = key . charAt ( 0 ) ; if ( 'A' <= ch && ch <= 'Z' ) { ch += 'a' - 'A' ; } int code = ( length << 8 ) + ch ; switch ( code ) { case 0x0d00 + 'c' : if ( CACHE_CONTROL . matchesIgn...
Special processing for a special value .
16,628
public void setFooter ( String key , String value ) { Objects . requireNonNull ( value ) ; int i = 0 ; boolean hasFooter = false ; for ( i = _footerKeys . size ( ) - 1 ; i >= 0 ; i -- ) { String oldKey = _footerKeys . get ( i ) ; if ( oldKey . equalsIgnoreCase ( key ) ) { if ( hasFooter ) { _footerKeys . remove ( i ) ;...
Sets a footer replacing an already - existing footer
16,629
public void addFooter ( String key , String value ) { if ( headerOutSpecial ( key , value ) ) { return ; } _footerKeys . add ( key ) ; _footerValues . add ( value ) ; }
Adds a new footer . If an old footer with that name exists both footers are output .
16,630
public final boolean isOutCommitted ( ) { OutHttpApp stream = out ( ) ; if ( stream . isCommitted ( ) ) { return true ; } if ( _contentLengthOut > 0 && _contentLengthOut <= stream . contentLength ( ) ) { return true ; } return false ; }
Returns true if some data has been sent to the browser .
16,631
public long contentLengthSent ( ) { OutHttpApp stream = _responseStream ; if ( stream != null ) { return stream . contentLength ( ) ; } else { return Math . max ( _contentLengthOut , 0 ) ; } }
Returns the number of bytes sent to the output .
16,632
private boolean enableKeepalive ( PollController conn , boolean isNew ) throws IOException { if ( _selectMax <= _connectionCount . get ( ) ) { throw new IllegalStateException ( this + " keepalive overflow " + _connectionCount + " max=" + _selectMax ) ; } JniSocketImpl socket = ( JniSocketImpl ) conn . getSocket ( ) ; i...
Enables keepalive and checks to see if data is available .
16,633
private void runSelectTask ( ) { if ( _lifecycle . isActive ( ) || _lifecycle . isAfterStopping ( ) ) { log . warning ( this + " cannot start because an instance is active" ) ; return ; } initNative ( _fd ) ; synchronized ( _thread ) { _thread . notify ( ) ; } if ( ! _lifecycle . toActive ( ) ) { log . warning ( this +...
Running process accepting connections .
16,634
@ SuppressWarnings ( "unchecked" ) private void initTypesMapping ( ) { if ( mapping == null ) { throw new IllegalStateException ( "Mapping does contain any information in " + "DeployerTypesResolver " + this ) ; } if ( mapping . containsKey ( NODE_TYPES_MAPPING_SECTION ) ) { log . debug ( "Mapping contains NodeTypes map...
Initialize the different types mapping .
16,635
public int addressRemote ( byte [ ] buffer , int offset , int length ) { return _socket . getRemoteAddress ( buffer , offset , length ) ; }
Adds from the socket s remote address .
16,636
public void requestWake ( ) { try { _state = _state . toWake ( ) ; requestLoop ( ) ; } catch ( Exception e ) { log . log ( Level . WARNING , e . toString ( ) , e ) ; } }
Wake a connection .
16,637
private StateConnection processPoll ( ) throws IOException { PortTcp port = _port ; if ( port . isClosed ( ) ) { return StateConnection . DESTROY ; } if ( readStream ( ) . available ( ) > 0 ) { return StateConnection . ACTIVE ; } long timeout = _idleTimeout ; _idleStartTime = CurrentTime . currentTime ( ) ; _idleExpire...
Starts a keepalive either returning available data or returning false to close the loop
16,638
private void initSocket ( ) throws IOException { _idleTimeout = _port . getKeepaliveTimeout ( ) ; _port . ssl ( _socket ) ; writeStream ( ) . init ( _socket . stream ( ) ) ; _readStream . init ( _socket . stream ( ) ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( dbgId ( ) + "starting connection " + thi...
Initialize the socket for a new connection
16,639
private void destroy ( ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( this + " destroying connection" ) ; } try { _socket . forceShutdown ( ) ; } catch ( Throwable e ) { } try { closeConnection ( ) ; } catch ( Throwable e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; } _port . removeConnecti...
Destroy kills the connection and drops it from the connection pool .
16,640
private boolean isCacheValid ( ) { long now = CurrentTime . currentTime ( ) ; if ( ( now - _lastTime < 100 ) && ! CurrentTime . isTest ( ) ) return true ; long oldLastModified = _lastModified ; long oldLength = _length ; long newLastModified = getBacking ( ) . getLastModified ( ) ; long newLength = getBacking ( ) . len...
Returns the last modified time for the path .
16,641
public void setContextLoader ( ClassLoader loader ) { if ( loader != null ) _loaderRef = new WeakReference < ClassLoader > ( loader ) ; else _loaderRef = null ; }
Sets the class loader .
16,642
public static JClassLoaderWrapper create ( ClassLoader loader ) { JClassLoaderWrapper jLoader = _localClassLoader . getLevel ( loader ) ; if ( jLoader == null ) { jLoader = new JClassLoaderWrapper ( loader ) ; _localClassLoader . set ( jLoader , loader ) ; } return jLoader ; }
Creates the class loader with the context class loader .
16,643
private ByExpressionBuilder parseBy ( ) { ByExpressionBuilder by = new ByExpressionBuilder ( ) ; int x = _parseIndex ; Token token = scanToken ( ) ; if ( token == null ) throw new IllegalStateException ( L . l ( "expected field name at {0} in {1}" , x , _method . getName ( ) ) ) ; do { switch ( token ) { case IDENTIFIE...
Parse the by expression in the method name .
16,644
public static boolean isCaseInsensitive ( ) { Boolean value = _caseInsensitive . get ( ) ; if ( value == null ) { return _isCaseInsensitive ; } else return value . booleanValue ( ) ; }
Returns true if the local environment is case sensitive .
16,645
public void validate ( ) throws ConfigException { for ( int i = 0 ; i < _jarList . size ( ) ; i ++ ) { _jarList . get ( i ) . validate ( ) ; } }
Validates the loader .
16,646
public void getResources ( Vector < URL > vector , String name ) { if ( _pathMap != null ) { String cleanName = name ; if ( cleanName . endsWith ( "/" ) ) cleanName = cleanName . substring ( 0 , cleanName . length ( ) - 1 ) ; JarMap . JarList jarEntryList = _pathMap . get ( cleanName ) ; for ( ; jarEntryList != null ; ...
Adds resources to the enumeration .
16,647
public PathImpl getPath ( String pathName ) { if ( _pathMap != null ) { String cleanPathName = pathName ; if ( cleanPathName . endsWith ( "/" ) ) cleanPathName = cleanPathName . substring ( 0 , cleanPathName . length ( ) - 1 ) ; JarMap . JarList jarEntryList = _pathMap . get ( cleanPathName ) ; if ( jarEntryList != nul...
Find a given path somewhere in the classpath
16,648
protected void clearJars ( ) { synchronized ( this ) { ArrayList < JarEntry > jars = new ArrayList < JarEntry > ( _jarList ) ; _jarList . clear ( ) ; if ( _pathMap != null ) _pathMap . clear ( ) ; for ( int i = 0 ; i < jars . size ( ) ; i ++ ) { JarEntry jarEntry = jars . get ( i ) ; JarPath jarPath = jarEntry . getJar...
Closes the jars .
16,649
public final double sampleSigma ( int n ) { synchronized ( _lock ) { long count = _count . get ( ) ; long lastCount = _lastStdCount ; _lastStdCount = count ; double sum = _sum . get ( ) ; double lastSum = _lastStdSum ; _lastStdSum = sum ; double sumSquare = _sumSquare ; _sumSquare = 0 ; if ( count == lastCount ) return...
Return the probe s next 2 - sigma
16,650
public static int getInt ( String strValue ) { int value = 0 ; if ( StringUtils . isNotBlank ( strValue ) ) { Matcher m = Pattern . compile ( "^(\\d+)(?:\\w+|%)?$" ) . matcher ( strValue ) ; if ( m . find ( ) ) { value = Integer . parseInt ( m . group ( 1 ) ) ; } } return value ; }
get int value of string
16,651
boolean isKeepaliveAllowed ( long connectionStartTime ) { if ( ! _lifecycle . isActive ( ) ) { return false ; } else if ( connectionStartTime + _keepaliveTimeMax < CurrentTime . currentTime ( ) ) { return false ; } else if ( _keepaliveMax <= _keepaliveAllocateCount . get ( ) ) { return false ; } else { return true ; } ...
Allocates a keepalive for the connection .
16,652
int keepaliveThreadRead ( ReadStream is , long timeoutConn ) throws IOException { if ( isClosed ( ) ) { return - 1 ; } int available = is . availableBuffer ( ) ; if ( available > 0 ) { return available ; } long timeout = Math . min ( getKeepaliveTimeout ( ) , getSocketTimeout ( ) ) ; if ( timeoutConn > 0 ) { timeout = ...
Reads data from a keepalive connection
16,653
@ Friend ( ConnectionTcp . class ) void freeConnection ( ConnectionTcp conn ) { if ( removeConnection ( conn ) ) { _idleConn . free ( conn ) ; } else if ( isActive ( ) ) { System . out . println ( "Possible Double Close: " + this + " " + conn ) ; } }
Closes the stats for the connection .
16,654
public void init ( String dc_sync_period , String resources_keep_alive_period , String manager_ip , String manager_port ) { if ( registryInitialized ) throw new RuntimeException ( "Registry was already initialized" ) ; if ( dc_sync_period != null ) { CONFIG_SYNC_PERIOD = Integer . parseInt ( dc_sync_period ) ; } if ( r...
This method is used to initialized the collecting of each metric . It initializes a DCAgent with the manager_ip and manager_port parameters in order to communicate with Tower 4Clouds . It then build a DCDescriptor with the list of all the provided metrics and the set of monitored resources for each provided metric . It...
16,655
public static void addResource ( String type , String id , String url ) { logger . info ( "Adding the following new resource to the Data Collector Descriptor: {}, {}" , type , id ) ; try { resources . put ( new InternalComponent ( type , id ) , new URL ( url ) ) ; } catch ( MalformedURLException e ) { logger . error ( ...
This method allow to add a new monitored resource to the Registry .
16,656
static Throwable cause ( Throwable e ) { while ( e . getCause ( ) != null && ( e instanceof InstantiationException || e instanceof InvocationTargetException || e . getClass ( ) . equals ( RuntimeExceptionConfig . class ) ) ) { e = e . getCause ( ) ; } return e ; }
Unwraps noise from the exception trace .
16,657
public void alarm ( DeployService2Impl < I > deploy , Result < I > result ) { LifecycleState state = deploy . getState ( ) ; if ( ! state . isActive ( ) ) { result . ok ( deploy . get ( ) ) ; } else if ( deploy . isModifiedNow ( ) ) { deploy . logModified ( deploy . getLog ( ) ) ; deploy . restartImpl ( result ) ; } el...
Restart if the controller is active .
16,658
String parseLine ( CharCursor is , LineMap lineMap ) throws IOException { int ch = is . read ( ) ; _buf . clear ( ) ; String filename = null ; int line = 0 ; _token . clear ( ) ; line : for ( ; ch != is . DONE ; ch = is . read ( ) ) { while ( ch == ':' ) { line = 0 ; for ( ch = is . read ( ) ; ch >= '0' && ch <= '9' ; ...
Scans errors .
16,659
public static long generate ( long crc , long value ) { crc = next ( crc , ( byte ) ( value >> 56 ) ) ; crc = next ( crc , ( byte ) ( value >> 48 ) ) ; crc = next ( crc , ( byte ) ( value >> 40 ) ) ; crc = next ( crc , ( byte ) ( value >> 32 ) ) ; crc = next ( crc , ( byte ) ( value >> 24 ) ) ; crc = next ( crc , ( byt...
Calculates CRC from a long
16,660
public String toObjectExpr ( String columnName ) { if ( _value == null ) { return "null" ; } else if ( _value instanceof String ) { return "'" + _value + "'" ; } else { return String . valueOf ( _value ) ; } }
Object expr support .
16,661
public int copyTo ( byte [ ] buffer , int rowOffset , int blobTail ) { byte [ ] blockBuffer = _block . getBuffer ( ) ; System . arraycopy ( blockBuffer , _rowOffset , buffer , rowOffset , _length ) ; return _row . copyBlobs ( blockBuffer , _rowOffset , buffer , rowOffset , blobTail ) ; }
Copies the row and its inline blobs to the target buffer .
16,662
public PathImpl schemeWalk ( String userPath , Map < String , Object > newAttributes , String newPath , int offset ) { return getWrappedPath ( ) . schemeWalk ( userPath , newAttributes , newPath , offset ) ; }
Path - specific lookup . Path implementations will override this .
16,663
final void executorTimeout ( ExecutorThrottle executor , long timeout ) { _executor = executor ; _activeSlowExpireTime = CurrentTime . getCurrentTimeActual ( ) + timeout ; }
Sets timeouts .
16,664
public void run ( ) { try { _launcher . onChildIdleBegin ( ) ; _launcher . onChildThreadLaunchBegin ( ) ; _pool . addThread ( this ) ; runTasks ( ) ; } catch ( Throwable e ) { log . log ( Level . WARNING , e . toString ( ) , e ) ; } finally { _pool . removeThread ( this ) ; _launcher . onChildIdleEnd ( ) ; _launcher . ...
The main thread execution method .
16,665
private void runTasks ( ) { ClassLoader systemClassLoader = ClassLoader . getSystemClassLoader ( ) ; ThreadPoolBase pool = _pool ; Thread thread = this ; Outbox outbox = outbox ( ) ; boolean isWake = false ; setName ( _name ) ; while ( ! _isClose ) { RunnableItem taskItem = pool . poll ( isWake ) ; isWake = false ; if ...
Main thread loop .
16,666
private static long addDigest ( long digest , long v ) { digest = Crc64 . generate ( digest , ( byte ) ( v >> 24 ) ) ; digest = Crc64 . generate ( digest , ( byte ) ( v >> 16 ) ) ; digest = Crc64 . generate ( digest , ( byte ) ( v >> 8 ) ) ; digest = Crc64 . generate ( digest , ( byte ) v ) ; return digest ; }
Adds the int to the digest .
16,667
private int compareView ( ViewRef < ? > viewA , ViewRef < ? > viewB , Class < ? > type ) { int cmp = viewB . priority ( ) - viewA . priority ( ) ; if ( cmp != 0 ) { return cmp ; } cmp = typeDepth ( viewA . type ( ) , type ) - typeDepth ( viewB . type ( ) , type ) ; if ( cmp != 0 ) { return cmp ; } String nameA = viewA ...
sort views .
16,668
private int typeDepth ( Class < ? > match , Class < ? > actual ) { if ( actual == null ) { return Integer . MAX_VALUE / 2 ; } if ( match . equals ( Object . class ) ) { return Integer . MAX_VALUE / 4 ; } if ( match . equals ( actual ) ) { return 0 ; } int cost = 1 + typeDepth ( match , actual . getSuperclass ( ) ) ; fo...
count of how closely the source matches the target .
16,669
public final void configure ( Object bean ) { Objects . requireNonNull ( bean ) ; Thread thread = Thread . currentThread ( ) ; ClassLoader loader = thread . getContextClassLoader ( ) ; }
Configures a bean with a configuration file .
16,670
final public void configureImpl ( Object bean ) throws ConfigException { Objects . requireNonNull ( bean ) ; try { InjectContext env = InjectContextImpl . CONTEXT ; injectTop ( bean , env ) ; } finally { } }
Configures the object .
16,671
public boolean add ( String srcFilename , int srcLine , int dstLine ) { return add ( srcFilename , srcLine , dstLine , false ) ; }
Adds a new line map entry .
16,672
public void addLine ( int startLine , String sourceFile , int repeatCount , int outputLine , int outputIncrement ) { _lines . add ( new Line ( startLine , sourceFile , repeatCount , outputLine , outputIncrement ) ) ; }
Adds a line from the smap
16,673
public String convertError ( String filename , int line , int column , String message ) { String srcFilename = null ; int destLine = 0 ; int srcLine = 0 ; for ( int i = 0 ; i < _lines . size ( ) ; i ++ ) { Line map = _lines . get ( i ) ; if ( filename != null && ! filename . endsWith ( _dstFilename ) ) { } else if ( ma...
Converts an error in the generated file to a CompileError based on the source .
16,674
private void convertError ( CharBuffer buf , int line ) { String srcFilename = null ; int destLine = 0 ; int srcLine = 0 ; int srcTailLine = Integer . MAX_VALUE ; for ( int i = 0 ; i < _lines . size ( ) ; i ++ ) { Line map = ( Line ) _lines . get ( i ) ; if ( map . _dstLine <= line && line <= map . getLastDestinationLi...
Maps a destination line to an error location .
16,675
public void copyFrom ( Invocation invocation ) { _classLoader = invocation . _classLoader ; _rawHost = invocation . _rawHost ; _rawURI = invocation . _rawURI ; _hostName = invocation . _hostName ; _port = invocation . _port ; _uri = invocation . _uri ; _depend = invocation . _depend ; _queryString = invocation . _query...
Copies from the invocation .
16,676
final public void print ( long v ) { Writer out = this . out ; if ( out == null ) return ; if ( v == 0x8000000000000000L ) { print ( "-9223372036854775808" ) ; return ; } try { if ( v < 0 ) { out . write ( '-' ) ; v = - v ; } else if ( v == 0 ) { out . write ( '0' ) ; return ; } int j = 31 ; while ( v > 0 ) { _tempChar...
Prints a long .
16,677
final public void println ( long v ) { Writer out = this . out ; if ( out == null ) return ; print ( v ) ; try { out . write ( _newline , 0 , _newline . length ) ; } catch ( IOException e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; } }
Prints a long followed by a newline .
16,678
public void exportCode ( JavaClass source , JavaClass target ) throws Exception { ExportAnalyzer analyzer = new ExportAnalyzer ( source , target ) ; CodeEnhancer visitor = new CodeEnhancer ( source , this ) ; visitor . analyze ( analyzer , false ) ; visitor . update ( ) ; }
Exports code .
16,679
protected void fillChunkHeader ( TempBuffer tBuf , int length ) { if ( length == 0 ) throw new IllegalStateException ( ) ; byte [ ] buffer = tBuf . buffer ( ) ; buffer [ 0 ] = ( byte ) '\r' ; buffer [ 1 ] = ( byte ) '\n' ; buffer [ 2 ] = hexDigit ( length >> 12 ) ; buffer [ 3 ] = hexDigit ( length >> 8 ) ; buffer [ 4 ]...
Fills the chunk header .
16,680
public static < T > Key < T > of ( Type type , Class < ? extends Annotation > [ ] annTypes ) { return new Key < > ( type , annTypes ) ; }
Builds Key from Type and annotation types
16,681
public static < T > Key < T > of ( Class < T > type , Class < ? extends Annotation > annType ) { Objects . requireNonNull ( type ) ; Objects . requireNonNull ( annType ) ; return new Key < > ( type , new Class [ ] { annType } ) ; }
Builds Key from Class and annotation type
16,682
public static < T > Key < T > of ( Class < T > type , Annotation ann ) { Objects . requireNonNull ( type ) ; Objects . requireNonNull ( ann ) ; return new Key < > ( type , new Annotation [ ] { ann } ) ; }
Builds Key from a Class and annotation
16,683
public Class < T > rawClass ( ) { Type type = type ( ) ; if ( type instanceof Class ) { return ( Class ) type ; } else if ( type instanceof ParameterizedType ) { ParameterizedType pType = ( ParameterizedType ) type ; return ( Class ) pType . getRawType ( ) ; } else { throw new UnsupportedOperationException ( type + " "...
Returns raw class of associated type
16,684
public boolean isAnnotationPresent ( Class < ? extends Annotation > annTypeTest ) { for ( Class < ? > annType : _annTypes ) { if ( annType . equals ( annTypeTest ) ) { return true ; } } return false ; }
Tests if annotation type is present in Key s annotations
16,685
public boolean isAssignableFrom ( Key < ? super T > key ) { Objects . requireNonNull ( key ) ; for ( Class < ? extends Annotation > annType : _annTypes ) { if ( ! containsType ( annType , key . _annTypes ) ) { return false ; } } if ( _type instanceof ParameterizedType ) { if ( ! ( key . _type instanceof ParameterizedTy...
Tests if key is assignable . Key is considered assignable if annotation types match Type matches and annotation instances match .
16,686
public static void syslog ( int facility , int severity , String text ) { _jniTroubleshoot . checkIsValid ( ) ; if ( ! _isOpen ) { _isOpen = true ; nativeOpenSyslog ( ) ; } int priority = facility * 8 + severity ; nativeSyslog ( priority , text ) ; }
Writes data .
16,687
public Object removeAttribute ( String name ) { if ( _attributes == null ) return null ; else return _attributes . remove ( name ) ; }
Removes the named attributes
16,688
public InputStream getResourceAsStream ( String name ) { ResourceEntry entry = _resourceCacheMap . get ( name ) ; if ( entry == null || entry . isModified ( ) ) { URL resource = super . getResource ( name ) ; entry = new ResourceEntry ( resource ) ; _resourceCacheMap . put ( name , entry ) ; } return entry . getResourc...
Overrides getResource to implement caching .
16,689
private void initListeners ( ) { ClassLoader parent = getParent ( ) ; for ( ; parent != null ; parent = parent . getParent ( ) ) { if ( parent instanceof EnvironmentClassLoader ) { EnvironmentClassLoader loader = ( EnvironmentClassLoader ) parent ; if ( _stopListener == null ) _stopListener = new WeakStopListener ( thi...
Adds self as a listener .
16,690
public void addURL ( URL url , boolean isScanned ) { if ( containsURL ( url ) ) { return ; } super . addURL ( url , isScanned ) ; if ( isScanned ) _pendingScanRoots . add ( new ScanRoot ( url , null ) ) ; }
Adds the URL to the URLClassLoader .
16,691
public String getHash ( ) { String superHash = super . getHash ( ) ; long crc = Crc64 . generate ( superHash ) ; for ( String pkg : _packageList ) { crc = Crc64 . generate ( crc , pkg ) ; } return Long . toHexString ( Math . abs ( crc ) ) ; }
Add the custom packages to the classloader hash .
16,692
public void start ( ) { if ( ! getLifecycle ( ) . toStarting ( ) ) { startListeners ( ) ; return ; } try { make ( ) ; } catch ( Exception e ) { log ( ) . log ( Level . WARNING , e . toString ( ) , e ) ; e . printStackTrace ( ) ; } startListeners ( ) ; getLifecycle ( ) . toActive ( ) ; if ( isAdminEnable ( ) ) { Thread ...
Marks the environment of the class loader as started . The class loader itself doesn t use this but a callback might .
16,693
public void stop ( ) { if ( ! getLifecycle ( ) . toStop ( ) ) { return ; } ArrayList < EnvLoaderListener > listeners = getEnvironmentListeners ( ) ; Thread thread = Thread . currentThread ( ) ; ClassLoader oldLoader = thread . getContextClassLoader ( ) ; thread . setContextClassLoader ( this ) ; try { if ( listeners !=...
Stops the environment closing down any resources .
16,694
public void destroy ( ) { Thread thread = Thread . currentThread ( ) ; ClassLoader oldLoader = thread . getContextClassLoader ( ) ; try { thread . setContextClassLoader ( this ) ; WeakStopListener stopListener = _stopListener ; _stopListener = null ; super . destroy ( ) ; thread . setContextClassLoader ( oldLoader ) ; ...
Destroys the class loader .
16,695
public void update ( Result < Integer > result , int nodeIndex , String sql , Object [ ] args ) { NodePodAmp node = _podKraken . getNode ( nodeIndex ) ; for ( int i = 0 ; i < node . serverCount ( ) ; i ++ ) { ServerBartender server = node . server ( i ) ; if ( server != null && server . isUp ( ) ) { ClusterServiceKrake...
Distributed update table . All owning nodes will get a request .
16,696
protected void doAttach ( ) throws Exception { if ( file == null ) { String fileName = rootFile + getName ( ) . getPathDecoded ( ) ; file = new File ( fileName ) ; } }
Attaches this file object to its file resource .
16,697
protected FileType doGetType ( ) throws Exception { if ( ! file . exists ( ) && file . length ( ) < 1 ) { return FileType . IMAGINARY ; } if ( file . isDirectory ( ) ) { return FileType . FOLDER ; } return FileType . FILE ; }
Returns the file s type .
16,698
protected void doRename ( final FileObject newfile ) throws Exception { AludraLocalFile newLocalFile = ( AludraLocalFile ) FileObjectUtils . getAbstractFileObject ( newfile ) ; if ( ! file . renameTo ( newLocalFile . getLocalFile ( ) ) ) { throw new FileSystemException ( "vfs.provider.local/rename-file.error" , new Str...
rename this file
16,699
public void openWrite ( Result < OutputStream > result , WriteOption ... options ) { result . ok ( _root . openWriteFile ( _path , options ) ) ; }
Open a file for writing .