idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
16,100 | private JarDepend getJarDepend ( ) { if ( _depend == null || _depend . isModified ( ) ) _depend = new JarDepend ( new Depend ( getBacking ( ) ) ) ; return _depend ; } | Returns the dependency . |
16,101 | public Certificate [ ] getCertificates ( String path ) { if ( ! isSigned ( ) ) return null ; if ( path . length ( ) > 0 && path . charAt ( 0 ) == '/' ) path = path . substring ( 1 ) ; try { if ( ! getBacking ( ) . canRead ( ) ) return null ; JarFile jarFile = getJarFile ( ) ; JarEntry entry ; InputStream is = null ; tr... | Returns any certificates . |
16,102 | public long getLastModified ( String path ) { try { ZipEntry entry = getZipEntry ( path ) ; return entry != null ? entry . getTime ( ) : - 1 ; } catch ( IOException e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; } return - 1 ; } | Returns the last - modified time of the entry in the jar file . |
16,103 | public long getLength ( String path ) { try { ZipEntry entry = getZipEntry ( path ) ; long length = entry != null ? entry . getSize ( ) : - 1 ; return length ; } catch ( IOException e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; return - 1 ; } } | Returns the length of the entry in the jar file . |
16,104 | public boolean canRead ( String path ) { try { ZipEntry entry = getZipEntry ( path ) ; return entry != null && ! entry . isDirectory ( ) ; } catch ( IOException e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; return false ; } } | Readable if the jar is readable and the path refers to a file . |
16,105 | public void clearCache ( ) { ZipFile zipFile = _zipFileRef . getAndSet ( null ) ; if ( zipFile != null ) try { zipFile . close ( ) ; } catch ( Exception e ) { } } | Clears any cached JarFile . |
16,106 | public ClassLoader buildClassLoader ( ClassLoader serviceLoader ) { synchronized ( _loaderMap ) { SoftReference < ClassLoader > extLoaderRef = _loaderMap . get ( serviceLoader ) ; if ( extLoaderRef != null ) { ClassLoader extLoader = extLoaderRef . get ( ) ; if ( extLoader != null ) { return extLoader ; } } } String pa... | Builds a combined class - loader with the target service loader as a parent and this calling pod loader as a child . |
16,107 | public ServerHeartbeat getServer ( String serverId ) { ServerHeartbeat server = _serverMap . get ( serverId ) ; return server ; } | Returns the server with the given canonical id . |
16,108 | public ServerBartender findServerByName ( String name ) { for ( ClusterHeartbeat cluster : _clusterMap . values ( ) ) { ServerBartender server = cluster . findServerByName ( name ) ; if ( server != null ) { return server ; } } return null ; } | Returns the server with the given display name . |
16,109 | ClusterHeartbeat createCluster ( String clusterName ) { ClusterHeartbeat cluster = _clusterMap . get ( clusterName ) ; if ( cluster == null ) { cluster = new ClusterHeartbeat ( clusterName , this ) ; _clusterMap . putIfAbsent ( clusterName , cluster ) ; cluster = _clusterMap . get ( clusterName ) ; } return cluster ; } | Returns the cluster with the given name creating it if necessary . |
16,110 | public int read ( byte [ ] buffer , int offset , int length ) throws IOException { int sublen = getDelegate ( ) . read ( buffer , offset , length ) ; if ( sublen > 0 ) { logStream ( ) . write ( buffer , offset , sublen ) ; } return sublen ; } | Reads the next chunk from the stream . |
16,111 | public int readTimeout ( byte [ ] buffer , int offset , int length , long timeout ) throws IOException { int sublen = getDelegate ( ) . readTimeout ( buffer , offset , length , timeout ) ; if ( sublen > 0 ) { logStream ( ) . write ( buffer , offset , sublen ) ; } return sublen ; } | Reads the next chunk from the stream in non - blocking mode . |
16,112 | public static String ObjectToXml ( Object object ) throws JAXBException { JAXBContext jaxbContext = JAXBContext . newInstance ( object . getClass ( ) ) ; Marshaller marshaller = jaxbContext . createMarshaller ( ) ; StringWriter sw = new StringWriter ( ) ; marshaller . marshal ( object , sw ) ; return sw . toString ( ) ... | Transforms an annotated Object to a XML string using javax . xml . bind . Marshaller |
16,113 | public void setEncoding ( String encoding ) throws UnsupportedEncodingException { if ( encoding != null ) { _readEncoding = Encoding . getReadEncoding ( this , encoding ) ; _readEncodingName = Encoding . getMimeName ( encoding ) ; } else { _readEncoding = null ; _readEncodingName = null ; } } | Sets the encoding for the converter . |
16,114 | public void addByte ( int b ) throws IOException { int nextHead = ( _byteHead + 1 ) % _byteBuffer . length ; while ( nextHead == _byteTail ) { int ch = readChar ( ) ; if ( ch < 0 ) { break ; } outputChar ( ch ) ; } _byteBuffer [ _byteHead ] = ( byte ) b ; _byteHead = nextHead ; } | Adds the next byte . |
16,115 | public void addChar ( char nextCh ) throws IOException { int ch ; while ( ( ch = readChar ( ) ) >= 0 ) { outputChar ( ( char ) ch ) ; } outputChar ( nextCh ) ; } | Adds the next character . |
16,116 | private int readChar ( ) throws IOException { Reader readEncoding = _readEncoding ; if ( readEncoding == null ) return read ( ) ; else { if ( readEncoding . read ( _charBuffer , 0 , 1 ) == 1 ) { return _charBuffer [ 0 ] ; } else { return - 1 ; } } } | Reads the next converted character . |
16,117 | public int read ( ) throws IOException { if ( _byteHead == _byteTail ) { return - 1 ; } int b = _byteBuffer [ _byteTail ] & 0xff ; _byteTail = ( _byteTail + 1 ) % _byteBuffer . length ; return b ; } | For internal use only . Reads the next byte from the byte buffer . |
16,118 | public void setNameAndType ( String name , String type ) { _nameAndTypeIndex = getConstantPool ( ) . addNameAndType ( name , type ) . getIndex ( ) ; } | Sets the method name and type |
16,119 | public void putWithVersion ( RowCursor cursor , Result < Boolean > cont ) { _tableService . put ( cursor , PutType . PUT , cont ) ; } | Put using the version in the cursor instead of clearing it . |
16,120 | void format ( StringBuilder sb , Temporal localDate ) { int len = _timestamp . length ; for ( int j = 0 ; j < len ; j ++ ) { _timestamp [ j ] . format ( sb , localDate ) ; } } | Formats the timestamp |
16,121 | @ InService ( TableWriterService . class ) public void writePage ( Page page , SegmentStream sOut , long oldSequence , int saveLength , int saveTail , int sequenceWrite , Result < Integer > result ) { try { sOut . writePage ( this , page , saveLength , saveTail , sequenceWrite , result ) ; } catch ( Exception e ) { e .... | Writes a page to the current segment |
16,122 | @ InService ( TableWriterService . class ) public void writeBlobPage ( PageBlob page , int saveSequence , Result < Integer > result ) { SegmentStream sOut = getBlobStream ( ) ; int saveLength = 0 ; int saveTail = 0 ; if ( _blobSizeMax < page . getLength ( ) ) { _blobSizeMax = page . getLength ( ) ; calculateSegmentSize... | Writes a blob page to the current output segment . |
16,123 | public OutSegment openWriter ( ) { if ( isGcRequired ( ) ) { _table . getGcService ( ) . gc ( _seqGen . get ( ) ) ; _seqSinceGcCount = 0 ; } _seqSinceGcCount ++ ; long sequence = _seqGen . get ( ) ; return openWriterSeq ( sequence ) ; } | Opens a new segment writer . The segment s sequence id will be the next sequence number . |
16,124 | private void calculateSegmentSize ( ) { DatabaseKelp db = _table . database ( ) ; _segmentSizeNew = calculateSegmentSize ( db . getSegmentSizeFactorNew ( ) , _segmentSizeNew ) ; _segmentSizeGc = calculateSegmentSize ( db . getSegmentSizeFactorGc ( ) , _segmentSizeGc ) ; } | Calculates the dynamic segment size based on the current table size . |
16,125 | private int calculateSegmentSize ( int factor , int segmentSizeOld ) { DatabaseKelp db = _table . database ( ) ; long segmentFactor = _tableLength / db . getSegmentSizeMin ( ) ; long segmentFactorNew = segmentFactor / factor ; if ( segmentFactorNew > 0 ) { int bit = 63 - Long . numberOfLeadingZeros ( segmentFactorNew )... | Calculate the dynamic segment size . |
16,126 | public void fsync ( Result < Boolean > result ) throws IOException { SegmentStream nodeStream = _nodeStream ; if ( nodeStream != null ) { nodeStream . fsync ( result ) ; } else { result . ok ( true ) ; } } | sync the output stream with the filesystem when possible . |
16,127 | public void afterDeliver ( ) { SegmentStream nodeStream = _nodeStream ; if ( nodeStream != null ) { if ( _isBlobDirty ) { _isBlobDirty = false ; nodeStream . fsync ( Result . ignore ( ) ) ; } else { nodeStream . flush ( Result . ignore ( ) ) ; } } } | Flushes the stream after a batch of writes . |
16,128 | public void close ( Result < Boolean > result ) { _lifecycle . toDestroy ( ) ; SegmentStream nodeStream = _nodeStream ; _nodeStream = null ; if ( nodeStream != null ) { nodeStream . closeFsync ( result . then ( v -> closeImpl ( ) ) ) ; } else { result . ok ( true ) ; } } | Closes the store . |
16,129 | @ InService ( SegmentServiceImpl . class ) public Page writePage ( Page page , long oldSequence , int saveLength , int saveTail , int saveSequence , Result < Integer > result ) { if ( isClosed ( ) ) { return null ; } int pid = page . getId ( ) ; int nextPid = page . getNextId ( ) ; WriteStream out = out ( ) ; int head ... | Writes the page to the segment . |
16,130 | public void flushData ( ) { if ( isClosed ( ) ) { if ( _pendingFlushEntries . size ( ) > 0 ) { System . out . println ( "PENDING_FLUSH" ) ; } return ; } WriteStream out = _out ; if ( out != null ) { try { out . flush ( ) ; } catch ( Exception e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; } } completePendin... | Flushes the buffered data to the segment . |
16,131 | public void write ( byte [ ] buffer , int offset , int length , boolean isEnd ) throws IOException { int position = _position ; if ( length < 0 ) { throw new IllegalArgumentException ( ) ; } if ( _indexAddress < position + length ) { throw new IllegalArgumentException ( L . l ( "Segment write overflow pos=0x{0} len=0x{... | Writes to the file from the WriteStream flush . |
16,132 | private void completePendingFlush ( ) { int size = _pendingFlushEntries . size ( ) ; if ( size == 0 ) { return ; } for ( int i = 0 ; i < size ; i ++ ) { PendingEntry entry = _pendingFlushEntries . get ( i ) ; entry . afterFlush ( ) ; _pendingFsyncEntries . add ( entry ) ; } _pendingFlushEntries . clear ( ) ; } | Notifies the calling service after the entry is written to the mmap . |
16,133 | private void fsyncImpl ( Result < Boolean > result , FsyncType fsyncType ) { try { flushData ( ) ; ArrayList < SegmentFsyncCallback > fsyncListeners = new ArrayList < > ( _fsyncListeners ) ; _fsyncListeners . clear ( ) ; Result < Boolean > resultNext = result . then ( ( v , r ) -> afterDataFsync ( r , _position , fsync... | Syncs the segment to the disk . After the segment s data is synced the headers can be written . A second sync is needed to complete the header writes . |
16,134 | private void afterDataFsync ( Result < Boolean > result , int position , FsyncType fsyncType , ArrayList < SegmentFsyncCallback > listeners ) { try { completeIndex ( position ) ; Result < Boolean > cont = result . then ( ( v , r ) -> afterIndexFsync ( r , fsyncType , listeners ) ) ; if ( fsyncType . isSchedule ( ) ) { ... | Callback after the page data has been fynced so the index can be written . |
16,135 | private void afterIndexFsync ( Result < Boolean > result , FsyncType fsyncType , ArrayList < SegmentFsyncCallback > fsyncListeners ) { try { if ( fsyncType . isClose ( ) ) { _isClosed = true ; _segment . finishWriting ( ) ; if ( _pendingFlushEntries . size ( ) > 0 || _pendingFsyncEntries . size ( ) > 0 ) { System . out... | Callback after the index has been flushed . |
16,136 | private void writeIndex ( int entryAddress , byte [ ] entryBuffer , int offset , int length ) { long address = _segment . getAddress ( ) + entryAddress ; if ( _segment . length ( ) < entryAddress + length ) { throw new IllegalStateException ( L . l ( "offset=0x{0} length={1}" , entryAddress , length ) ) ; } _sOut . wri... | Write the current header to the output . |
16,137 | private static Constructor < ? > createImpl ( Class < ? > cl , ClassLoader loader ) { ClassGeneratorVault < ? > generator = new ClassGeneratorVault < > ( cl , loader ) ; Class < ? > proxyClass = generator . generate ( ) ; return proxyClass . getConstructors ( ) [ 0 ] ; } | Must return Constructor not MethodHandle because MethodHandles cache the type in the permgen . |
16,138 | private void introspectMethods ( JavaClass jClass ) { for ( Method method : getMethods ( ) ) { Class < ? > [ ] paramTypes = method . getParameterTypes ( ) ; int paramLen = paramTypes . length ; if ( ! Modifier . isAbstract ( method . getModifiers ( ) ) ) { continue ; } if ( Modifier . isStatic ( method . getModifiers (... | Introspect the methods to find abstract methods . |
16,139 | public static DynamicClassLoader create ( PathImpl path ) { DynamicClassLoader loader = new DynamicClassLoader ( null ) ; CompilingLoader compilingLoader = new CompilingLoader ( loader , path ) ; compilingLoader . init ( ) ; loader . init ( ) ; return loader ; } | Create a class loader based on the compiling loader |
16,140 | public static DynamicClassLoader create ( ClassLoader parent , PathImpl classDir , PathImpl sourceDir , String args , String encoding ) { DynamicClassLoader loader = new DynamicClassLoader ( parent ) ; loader . addLoader ( new CompilingLoader ( loader , classDir , sourceDir , args , encoding ) ) ; loader . init ( ) ; r... | Creates a new compiling class loader |
16,141 | public void make ( ) { synchronized ( this ) { if ( CurrentTime . currentTime ( ) < _lastMakeTime + 2000 ) return ; try { makeImpl ( ) ; } catch ( Exception e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; } _lastMakeTime = CurrentTime . currentTime ( ) ; } } | Compiles all changed files in the class directory . |
16,142 | private void findAllModifiedClasses ( String name , PathImpl sourceDir , PathImpl classDir , String sourcePath , ArrayList < String > sources ) throws IOException , ClassNotFoundException { String [ ] list ; try { list = sourceDir . list ( ) ; } catch ( IOException e ) { return ; } for ( int i = 0 ; list != null && i <... | Returns the classes which need compilation . |
16,143 | protected ClassEntry getClassEntry ( String name , String pathName ) throws ClassNotFoundException { PathImpl classFile = _classDir . lookup ( pathName ) ; String javaName = name . replace ( '.' , '/' ) + _sourceExt ; PathImpl javaFile = _sourceDir . lookup ( javaName ) ; for ( int i = 0 ; i < INNER_CLASS_SEPARATORS . ... | Loads the specified class compiling if necessary . |
16,144 | boolean checkSource ( PathImpl sourceDir , String javaName ) { try { while ( javaName != null && ! javaName . equals ( "" ) ) { int p = javaName . indexOf ( '/' ) ; String head ; if ( p >= 0 ) { head = javaName . substring ( 0 , p ) ; javaName = javaName . substring ( p + 1 ) ; } else { head = javaName ; javaName = nul... | Checks that the case is okay for the source . |
16,145 | public PathImpl getPath ( String name ) { PathImpl path = _classDir . lookup ( name ) ; if ( path != null && path . exists ( ) ) return path ; path = _sourceDir . lookup ( name ) ; if ( path != null && path . exists ( ) ) return path ; return null ; } | Returns the path for the given name . |
16,146 | protected void buildClassPath ( ArrayList < String > pathList ) { if ( ! _classDir . getScheme ( ) . equals ( "file" ) ) return ; try { if ( ! _classDir . isDirectory ( ) && _sourceDir . isDirectory ( ) ) { try { _classDir . mkdirs ( ) ; } catch ( IOException e ) { } } if ( _classDir . isDirectory ( ) ) { String path =... | Adds the classpath we re responsible for to the classpath |
16,147 | public ServiceRefAmp session ( String name ) { String address = "session:///" + name + "/" ; return sessionImpl ( address ) ; } | Find the session by its service name . |
16,148 | public < X > X session ( Class < X > type ) { String address = services ( ) . address ( type ) ; if ( address . startsWith ( "/" ) ) { address = "session://" + address ; } return sessionImpl ( address + "/" ) . as ( type ) ; } | Find the session by its service type . |
16,149 | private ServiceRefAmp sessionImpl ( String address ) { if ( ! address . startsWith ( "session:" ) || ! address . endsWith ( "/" ) ) { throw new IllegalArgumentException ( address ) ; } String sessionId = cookie ( "JSESSIONID" ) ; if ( sessionId == null ) { sessionId = generateSessionId ( ) ; cookie ( "JSESSIONID" , ses... | Find or create a session cookie as the session id and find or create a session with the generated address . |
16,150 | public void upgrade ( Object protocol ) { Objects . requireNonNull ( protocol ) ; if ( protocol instanceof ServiceWebSocket ) { ServiceWebSocket < ? , ? > webSocket = ( ServiceWebSocket < ? , ? > ) protocol ; upgradeWebSocket ( webSocket ) ; } else { throw new IllegalArgumentException ( protocol . toString ( ) ) ; } } | Starts an upgrade of the HTTP request to a protocol on raw TCP . |
16,151 | public JMethod [ ] getMethods ( ) { Method [ ] methods = _class . getMethods ( ) ; JMethod [ ] jMethods = new JMethod [ methods . length ] ; for ( int i = 0 ; i < methods . length ; i ++ ) { jMethods [ i ] = new JMethodWrapper ( methods [ i ] , getClassLoader ( ) ) ; } return jMethods ; } | Returns the public methods . |
16,152 | public JMethod getMethod ( String name , JClass [ ] types ) { JClassLoader jClassLoader = getClassLoader ( ) ; return getMethod ( _class , name , types , jClassLoader ) ; } | Returns the matching methods . |
16,153 | public JMethod [ ] getConstructors ( ) { Constructor [ ] methods = _class . getConstructors ( ) ; JMethod [ ] jMethods = new JMethod [ methods . length ] ; for ( int i = 0 ; i < methods . length ; i ++ ) { jMethods [ i ] = new JConstructorWrapper ( methods [ i ] , getClassLoader ( ) ) ; } return jMethods ; } | Returns the public constructors . |
16,154 | public void scan ( InH3Amp in , PathH3Amp path , Object [ ] values ) { int ch = read ( ) ; switch ( ch ) { case 0xd0 : readDefinition ( in ) ; scan ( in , path , values ) ; return ; case 0xd1 : case 0xd2 : case 0xd3 : case 0xd4 : case 0xd5 : case 0xd6 : case 0xd7 : case 0xd8 : case 0xd9 : case 0xda : case 0xdb : case 0... | Scan for a query . |
16,155 | public void setParent ( Logger parent ) { if ( parent . equals ( _parent ) ) return ; super . setParent ( parent ) ; if ( parent instanceof EnvironmentLogger ) { _parent = ( EnvironmentLogger ) parent ; _parent . addChild ( this ) ; } updateEffectiveLevel ( _systemClassLoader ) ; } | Sets the logger s parent . This should only be called by the LogManager code . |
16,156 | public Level getLevel ( ) { if ( _localLevel != null ) { Level level = _localLevel . get ( ) ; if ( level != null ) { return level ; } } return _systemLevel ; } | Returns the logger s assigned level . |
16,157 | public void setLevel ( Level level ) { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( loader == null ) { loader = _systemClassLoader ; } if ( loader != _systemClassLoader ) { if ( _localLevel == null ) _localLevel = new EnvironmentLocal < Level > ( ) ; _localLevel . set ( level ) ; i... | Application API to set the level . |
16,158 | public Handler [ ] getHandlers ( ) { Handler [ ] handlers = _localHandlers . get ( ) ; if ( handlers != null ) return handlers ; else return EMPTY_HANDLERS ; } | Returns the handlers . |
16,159 | public void removeHandler ( Handler handler ) { synchronized ( this ) { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( loader == null ) { loader = _systemClassLoader ; } for ( int i = _loaders . size ( ) - 1 ; i >= 0 ; i -- ) { WeakReference < ClassLoader > ref = _loaders . get ( i )... | Removes a handler . |
16,160 | public final boolean isLoggable ( Level level ) { if ( level == null ) return false ; int intValue = level . intValue ( ) ; if ( intValue < _finestEffectiveLevelValue ) return false ; else if ( ! _hasLocalEffectiveLevel ) { return true ; } else { Integer localValue = _localEffectiveLevel . get ( ) ; if ( localValue != ... | True if the level is loggable |
16,161 | public boolean getUseParentHandlers ( ) { Boolean value = _useParentHandlers . get ( ) ; if ( value != null ) return Boolean . TRUE . equals ( value ) ; else return true ; } | Returns the use - parent - handlers |
16,162 | public void log ( LogRecord record ) { if ( record == null ) return ; Level recordLevel = record . getLevel ( ) ; if ( ! isLoggable ( recordLevel ) ) return ; for ( Logger ptr = this ; ptr != null ; ptr = ptr . getParent ( ) ) { Handler handlers [ ] = ptr . getHandlers ( ) ; if ( handlers != null ) { for ( int i = 0 ; ... | Logs the message . |
16,163 | private void addHandler ( Handler handler , ClassLoader loader ) { ArrayList < Handler > handlers = new ArrayList < Handler > ( ) ; handlers . add ( handler ) ; for ( ClassLoader ptr = loader ; ptr != null ; ptr = ptr . getParent ( ) ) { Handler [ ] localHandlers = _localHandlers . getLevel ( ptr ) ; if ( localHandlers... | Adds a new handler with a given classloader context . |
16,164 | private boolean isParentLoader ( ClassLoader parent , ClassLoader child ) { for ( ; child != null ; child = child . getParent ( ) ) { if ( child == parent ) return true ; } return false ; } | Returns true if parent is a parent classloader of child . |
16,165 | public boolean addCustomLogger ( Logger logger ) { if ( logger . getClass ( ) . getName ( ) . startsWith ( "java" ) ) return false ; Logger oldLogger = _localLoggers . get ( ) ; if ( oldLogger != null ) return false ; _localLoggers . set ( logger ) ; if ( _parent != null ) { logger . setParent ( _parent ) ; } return tr... | Sets a custom logger if possible |
16,166 | private void addLoader ( ClassLoader loader ) { for ( int i = _loaders . size ( ) - 1 ; i >= 0 ; i -- ) { WeakReference < ClassLoader > ref = _loaders . get ( i ) ; ClassLoader refLoader = ref . get ( ) ; if ( refLoader == null ) _loaders . remove ( i ) ; if ( refLoader == loader ) return ; } _loaders . add ( new WeakR... | Adds a class loader to the list of dependency loaders . |
16,167 | private synchronized void updateEffectiveLevel ( ClassLoader loader ) { if ( loader == null ) loader = _systemClassLoader ; int oldEffectiveLevel = getEffectiveLevel ( loader ) ; Level newEffectiveLevel = calculateEffectiveLevel ( loader ) ; if ( oldEffectiveLevel == newEffectiveLevel . intValue ( ) && loader != _syste... | Recalculate the dynamic assigned levels . |
16,168 | private Level getFinestLevel ( ) { Level level ; if ( _parent == null ) level = Level . INFO ; else if ( _parent . isLocalLevel ( ) ) level = selectFinestLevel ( _systemLevel , _parent . getFinestLevel ( ) ) ; else if ( _systemLevel != null ) level = _systemLevel ; else level = _parent . getFinestLevel ( ) ; if ( _loca... | Returns the finest assigned level for any classloader environment . |
16,169 | private Level selectFinestLevel ( Level a , Level b ) { if ( a == null ) return b ; else if ( b == null ) return a ; else if ( b . intValue ( ) < a . intValue ( ) ) return b ; else return a ; } | Returns the finest of the two levels . |
16,170 | private Level getAssignedLevel ( ClassLoader loader ) { Level level = null ; if ( _localLevel != null ) { return _localLevel . get ( loader ) ; } return null ; } | Returns the most specific assigned level for the given classloader i . e . children override parents . |
16,171 | private synchronized void removeLoader ( ClassLoader loader ) { int i ; for ( i = _loaders . size ( ) - 1 ; i >= 0 ; i -- ) { WeakReference < ClassLoader > ref = _loaders . get ( i ) ; ClassLoader refLoader = ref . get ( ) ; if ( refLoader == null ) _loaders . remove ( i ) ; else if ( refLoader == loader ) _loaders . r... | Removes the specified loader . |
16,172 | public void classLoaderDestroy ( DynamicClassLoader loader ) { removeLoader ( loader ) ; _localHandlers . remove ( loader ) ; HandlerEntry ownHandlers = _ownHandlers . getLevel ( loader ) ; if ( ownHandlers != null ) _ownHandlers . remove ( loader ) ; if ( ownHandlers != null ) ownHandlers . destroy ( ) ; if ( _localLe... | Classloader destroy callback |
16,173 | public void init ( TempCharBuffer head ) { _top = head ; _head = head ; if ( head != null ) { _buffer = head . buffer ( ) ; _length = head . getLength ( ) ; } else _length = 0 ; _offset = 0 ; } | Initialize the reader . |
16,174 | public void close ( ) { if ( _isFree ) TempCharBuffer . freeAll ( _head ) ; _head = null ; _buffer = null ; _offset = 0 ; _length = 0 ; } | Closes the reader . |
16,175 | private void createValidation ( Class < ? > vaultClass , Class < ? > assetClass , Class < ? > idClass ) { for ( Method method : vaultClass . getMethods ( ) ) { if ( ! method . getName ( ) . startsWith ( "create" ) ) { continue ; } if ( ! Modifier . isAbstract ( method . getModifiers ( ) ) ) { continue ; } TypeRef resul... | Validate the create methods . |
16,176 | private void findValidation ( Class < ? > vaultClass , Class < ? > assetClass , Class < ? > idClass ) { for ( Method method : vaultClass . getMethods ( ) ) { if ( ! method . getName ( ) . startsWith ( "find" ) ) { continue ; } if ( ! Modifier . isAbstract ( method . getModifiers ( ) ) ) { continue ; } TypeRef resultRef... | Validate the find methods . |
16,177 | public void startOnInit ( DeployService2Impl < I > deploy , Result < I > result ) { deploy . startImpl ( result ) ; } | Called at initialization time for automatic start . |
16,178 | public void update ( DeployService2Impl < I > deploy , Result < I > result ) { LifecycleState state = deploy . getState ( ) ; if ( state . isStopped ( ) ) { deploy . startImpl ( result ) ; } else if ( state . isError ( ) ) { deploy . restartImpl ( result ) ; } else if ( deploy . isModifiedNow ( ) ) { deploy . restartIm... | Checks for updates from an admin command . The target state will be the initial state i . e . update will not start a lazy instance . |
16,179 | public void request ( DeployService2Impl < I > deploy , Result < I > result ) { result . ok ( deploy . get ( ) ) ; } | Returns the current instance . This strategy does not lazily restart the instance . |
16,180 | public static int getPodHash ( String key ) { byte [ ] buffer = new byte [ 16 ] ; int sublen = Math . min ( key . length ( ) , 8 ) ; for ( int i = 0 ; i < sublen ; i ++ ) { buffer [ i ] = ( byte ) key . charAt ( i ) ; } long hash = Murmur64 . generate ( Murmur64 . SEED , key ) ; BitsUtil . writeLong ( buffer , 8 , hash... | Convenience for calculating the pod hash for a string . |
16,181 | public void get ( RowCursor cursor , Result < Boolean > result ) { TablePod tablePod = getTablePod ( ) ; int hash = getPodHash ( cursor ) ; if ( tablePod . getNode ( hash ) . isSelfCopy ( ) ) { _tableKelp . getDirect ( cursor , result ) ; } else { getTablePod ( ) . get ( cursor . getKey ( ) , result . then ( ( v , r ) ... | Gets a row from the table when the primary key is known . |
16,182 | public int read ( byte [ ] buffer , int offset , int length ) throws IOException { try { if ( _length < length ) length = ( int ) _length ; if ( length <= 0 ) return - 1 ; int len = _next . read ( buffer , offset , length ) ; if ( len > 0 ) { _length -= len ; } else { _length = - 1 ; } return len ; } catch ( SocketTime... | Reads from the buffer limiting to the content length . |
16,183 | public String format ( LogRecord log ) { StringBuilder sb = new StringBuilder ( ) ; int mark = 0 ; for ( FormatItem item : _formatList ) { item . format ( sb , log , mark ) ; if ( item instanceof PrettyPrintMarkItem ) { mark = sb . length ( ) ; } } return sb . toString ( ) ; } | Formats the record |
16,184 | public StreamBuilderImpl < T , U > reduce ( T init , BinaryOperatorSync < T > op ) { return new ReduceOpInitSync < > ( this , init , op ) ; } | Reduce with a binary function |
16,185 | public < R > StreamBuilderImpl < R , U > reduce ( R identity , BiFunctionSync < R , ? super T , R > accumulator , BinaryOperatorSync < R > combiner ) { return new ReduceAccumSync < > ( this , identity , accumulator , combiner ) ; } | Reduce with an accumulator and combiner |
16,186 | public void setModified ( boolean isModified ) { _isModified = isModified ; if ( _isModified ) _checkExpiresTime = Long . MAX_VALUE / 2 ; else _checkExpiresTime = CurrentTime . currentTime ( ) + _checkInterval ; if ( ! isModified ) _isModifiedLog = false ; } | Sets the modified . |
16,187 | private static ServiceWeb buildWebService ( WebBuilder builder , Function < RequestWeb , Object > beanFactory , Method method ) { Parameter [ ] params = method . getParameters ( ) ; WebParam [ ] webParam = new WebParam [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { webParam [ i ] = buildParam ( ... | Builds a HTTP service from a method . |
16,188 | public String getAttribute ( String key ) { List < String > values = _headers . get ( key . toLowerCase ( Locale . ENGLISH ) ) ; if ( values != null && values . size ( ) > 0 ) return values . get ( 0 ) ; return null ; } | Returns a read attribute from the multipart mime . |
16,189 | public int getAvailable ( ) throws IOException { if ( _isPartDone ) return 0 ; else if ( _peekOffset < _peekLength ) return _peekLength - _peekOffset ; else { int ch = read ( ) ; if ( ch < 0 ) return 0 ; _peekOffset = 0 ; _peekLength = 1 ; _peek [ 0 ] = ( byte ) ch ; return 1 ; } } | Returns the number of available bytes . |
16,190 | public int read ( byte [ ] buffer , int offset , int length ) throws IOException { int b = - 1 ; if ( _isPartDone ) return - 1 ; int i = 0 ; while ( _peekOffset + 1 < _peekLength && length > 0 ) { buffer [ offset + i ++ ] = _peek [ _peekOffset ++ ] ; length -- ; } while ( i < length && ( b = read ( ) ) >= 0 ) { boolean... | Reads from the multipart mime buffer . |
16,191 | public ServiceRefAmp ref ( ) { if ( _isForeign ) { return null ; } if ( workers ( ) > 1 ) { return buildWorkers ( ) ; } if ( _worker != null ) { return buildWorker ( ) ; } else { return buildService ( ) ; } } | Build the service and return the service ref . |
16,192 | private ServiceRefAmp service ( StubFactoryAmp stubFactory ) { validateOpen ( ) ; Thread thread = Thread . currentThread ( ) ; ClassLoader oldLoader = thread . getContextClassLoader ( ) ; OutboxAmp outbox = OutboxAmp . current ( ) ; Object oldContext = null ; try { thread . setContextClassLoader ( _services . classLoad... | Main service builder . Called from ServiceBuilder and ServiceRefBean . |
16,193 | ServiceRefAmp service ( QueueServiceFactoryInbox serviceFactory , ServiceConfig config ) { QueueDeliverBuilderImpl < MessageAmp > queueBuilder = new QueueDeliverBuilderImpl < > ( ) ; queueBuilder . setClassLoader ( _services . classLoader ( ) ) ; queueBuilder . sizeMax ( config . queueSizeMax ( ) ) ; queueBuilder . siz... | Used by journal builder . |
16,194 | public QueryBuilderKraken parse ( ) { Token token = scanToken ( ) ; switch ( token ) { case CREATE : return parseCreate ( ) ; case EXPLAIN : return parseExplain ( ) ; case INSERT : return parseInsert ( ) ; case REPLACE : return parseReplace ( ) ; case SELECT : return parseSelect ( ) ; case SELECT_LOCAL : return parseSe... | Parses the query . |
16,195 | private ExprKraken parseSelectExpr ( ) { Token token = scanToken ( ) ; if ( token == Token . STAR ) { throw new UnsupportedOperationException ( getClass ( ) . getName ( ) ) ; } else { _token = token ; return parseExpr ( ) ; } } | Parses a select expression . |
16,196 | private QueryBuilderKraken parseCreate ( ) { Token token ; if ( ( token = scanToken ( ) ) != Token . TABLE ) throw error ( "expected TABLE at '{0}'" , token ) ; if ( ( token = scanToken ( ) ) != Token . IDENTIFIER ) throw error ( "expected identifier at '{0}'" , token ) ; String name = _lexeme ; String pod = null ; whi... | Parses the create . |
16,197 | public void parseReferences ( ArrayList < String > name ) { String foreignTable = parseIdentifier ( ) ; Token token = scanToken ( ) ; ArrayList < String > foreignColumns = new ArrayList < String > ( ) ; if ( token == Token . LPAREN ) { _token = token ; foreignColumns = parseColumnNames ( ) ; } else { _token = token ; }... | Parses the references clause . |
16,198 | public ArrayList < String > parseColumnNames ( ) { ArrayList < String > columns = new ArrayList < String > ( ) ; Token token = scanToken ( ) ; if ( token == Token . LPAREN ) { do { columns . add ( parseIdentifier ( ) ) ; token = scanToken ( ) ; } while ( token == Token . COMMA ) ; if ( token != Token . RPAREN ) { throw... | Parses a list of column names |
16,199 | private QueryBuilderKraken parseInsert ( ) { Token token ; if ( ( token = scanToken ( ) ) != Token . INTO ) { throw error ( "expected INTO at '{0}'" , token ) ; } TableKraken table = parseTable ( ) ; Objects . requireNonNull ( table ) ; TableKelp tableKelp = table . getTableKelp ( ) ; ArrayList < Column > columns = new... | Parses the insert . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.