idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
139,800
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 .
139,801
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 .
139,802
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
139,803
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 .
139,804
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 .
139,805
public void addChar ( char nextCh ) throws IOException { int ch ; while ( ( ch = readChar ( ) ) >= 0 ) { outputChar ( ( char ) ch ) ; } outputChar ( nextCh ) ; }
Adds the next character .
139,806
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 .
139,807
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 .
139,808
public void setNameAndType ( String name , String type ) { _nameAndTypeIndex = getConstantPool ( ) . addNameAndType ( name , type ) . getIndex ( ) ; }
Sets the method name and type
139,809
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 .
139,810
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
139,811
@ 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
139,812
@ 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 .
139,813
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 .
139,814
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 .
139,815
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 .
139,816
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 .
139,817
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 .
139,818
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 .
139,819
@ 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 .
139,820
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 .
139,821
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 .
139,822
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 .
139,823
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 .
139,824
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 .
139,825
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 .
139,826
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 .
139,827
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 .
139,828
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 .
139,829
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
139,830
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
139,831
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 .
139,832
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 .
139,833
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 .
139,834
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 .
139,835
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 .
139,836
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
139,837
public ServiceRefAmp session ( String name ) { String address = "session:///" + name + "/" ; return sessionImpl ( address ) ; }
Find the session by its service name .
139,838
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 .
139,839
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 .
139,840
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 .
139,841
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 .
139,842
public JMethod getMethod ( String name , JClass [ ] types ) { JClassLoader jClassLoader = getClassLoader ( ) ; return getMethod ( _class , name , types , jClassLoader ) ; }
Returns the matching methods .
139,843
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 .
139,844
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 .
139,845
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 .
139,846
public Level getLevel ( ) { if ( _localLevel != null ) { Level level = _localLevel . get ( ) ; if ( level != null ) { return level ; } } return _systemLevel ; }
Returns the logger s assigned level .
139,847
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 .
139,848
public Handler [ ] getHandlers ( ) { Handler [ ] handlers = _localHandlers . get ( ) ; if ( handlers != null ) return handlers ; else return EMPTY_HANDLERS ; }
Returns the handlers .
139,849
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 .
139,850
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
139,851
public boolean getUseParentHandlers ( ) { Boolean value = _useParentHandlers . get ( ) ; if ( value != null ) return Boolean . TRUE . equals ( value ) ; else return true ; }
Returns the use - parent - handlers
139,852
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 .
139,853
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 .
139,854
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 .
139,855
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
139,856
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 .
139,857
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 .
139,858
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 .
139,859
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 .
139,860
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 .
139,861
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 .
139,862
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
139,863
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 .
139,864
public void close ( ) { if ( _isFree ) TempCharBuffer . freeAll ( _head ) ; _head = null ; _buffer = null ; _offset = 0 ; _length = 0 ; }
Closes the reader .
139,865
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 .
139,866
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 .
139,867
public void startOnInit ( DeployService2Impl < I > deploy , Result < I > result ) { deploy . startImpl ( result ) ; }
Called at initialization time for automatic start .
139,868
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 .
139,869
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 .
139,870
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 .
139,871
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 .
139,872
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 .
139,873
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
139,874
public StreamBuilderImpl < T , U > reduce ( T init , BinaryOperatorSync < T > op ) { return new ReduceOpInitSync < > ( this , init , op ) ; }
Reduce with a binary function
139,875
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
139,876
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 .
139,877
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 .
139,878
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 .
139,879
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 .
139,880
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 .
139,881
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 .
139,882
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 .
139,883
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 .
139,884
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 .
139,885
private ExprKraken parseSelectExpr ( ) { Token token = scanToken ( ) ; if ( token == Token . STAR ) { throw new UnsupportedOperationException ( getClass ( ) . getName ( ) ) ; } else { _token = token ; return parseExpr ( ) ; } }
Parses a select expression .
139,886
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 .
139,887
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 .
139,888
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
139,889
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 .
139,890
private QueryBuilderKraken parseUpdate ( ) { Token token ; UpdateQueryBuilder query = new UpdateQueryBuilder ( _tableManager , _sql ) ; String tableName = parseTableName ( ) ; query . setTableName ( tableName ) ; _query = query ; if ( ( token = scanToken ( ) ) != Token . SET ) { throw error ( L . l ( "expected SET at {...
Parses the update .
139,891
private void parseSetItem ( UpdateQueryBuilder query ) { Token token ; if ( ( token = scanToken ( ) ) != Token . IDENTIFIER ) { throw error ( L . l ( "expected identifier at '{0}'" , token ) ) ; } String columnName = _lexeme ; if ( ( token = scanToken ( ) ) != Token . EQ ) { throw error ( "expected '=' at {0}" , token ...
Parses a set item .
139,892
private ExprKraken parseAndExpr ( ) { AndExpr andExpr = new AndExpr ( ) ; andExpr . add ( parseNotExpr ( ) ) ; while ( true ) { Token token = scanToken ( ) ; switch ( token ) { case AND : andExpr . add ( parseNotExpr ( ) ) ; break ; default : _token = token ; return andExpr . getSingleExpr ( ) ; } } }
Parses an AND expression .
139,893
private ExprKraken parseCmpExpr ( ) { ExprKraken left = parseAddExpr ( ) ; Token token = scanToken ( ) ; boolean isNot = false ; switch ( token ) { case EQ : return new BinaryExpr ( BinaryOp . EQ , left , parseAddExpr ( ) ) ; case NE : return new BinaryExpr ( BinaryOp . NE , left , parseAddExpr ( ) ) ; case LT : return...
Parses a CMP expression .
139,894
private ExprKraken parseSimpleTerm ( ) { Token token = scanToken ( ) ; switch ( token ) { case MINUS : return new UnaryExpr ( UnaryOp . MINUS , parseSimpleTerm ( ) ) ; case LPAREN : { ExprKraken expr = parseExpr ( ) ; if ( ( token = scanToken ( ) ) != Token . RPAREN ) { throw error ( "Expected ')' at '{0}'" , token ) ;...
Parses a simple term .
139,895
private String parseIdentifier ( ) { Token token = scanToken ( ) ; if ( token != Token . IDENTIFIER ) { throw error ( "expected identifier at {0}" , token ) ; } return _lexeme ; }
Parses an identifier .
139,896
public I get ( ) { I instance = _instance ; if ( instance == null || instance . isModified ( ) ) { _instance = instance = service ( ) . get ( ) ; } return instance ; }
Returns the current instance .
139,897
public V put ( K key , V value ) { Entry < V > oldValue = _cache . put ( key , new Entry < V > ( _expireInterval , value ) ) ; if ( oldValue != null ) return oldValue . getValue ( ) ; else return null ; }
Put a new item in the cache .
139,898
public V get ( K key ) { Entry < V > entry = _cache . get ( key ) ; if ( entry == null ) return null ; if ( entry . isValid ( ) ) return entry . getValue ( ) ; else { _cache . remove ( key ) ; return null ; } }
Gets an item from the cache returning null if expired .
139,899
private int parseUtf8 ( InputStream is , int length ) throws IOException { if ( length <= 0 ) return 0 ; if ( length > 256 ) { is . skip ( length ) ; return 0 ; } int offset = _charBufferOffset ; if ( _charBuffer . length <= offset + length ) { char [ ] buffer = new char [ 2 * _charBuffer . length ] ; System . arraycop...
Parses the UTF .