idx
int64 0
41.2k
| question
stringlengths 83
4.15k
| target
stringlengths 5
715
|
|---|---|---|
36,300
|
protected int position ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "position" , this ) ; int position = _absolutePosition + _buffer . position ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "position" , new Integer ( position ) ) ; return position ; }
|
Returns the position of the byte cursor for the mapped byte buffer .
|
36,301
|
protected void position ( int newPosition ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "position" , new Object [ ] { this , new Integer ( newPosition ) } ) ; newPosition -= _absolutePosition ; _buffer . position ( newPosition ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "position" ) ; }
|
Sets the position of the byte cursor for the mapped byte buffer .
|
36,302
|
protected void advancePosition ( int bytes ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "advancePosition" , new Object [ ] { this , new Integer ( bytes ) } ) ; final int newPosition = _buffer . position ( ) + bytes ; _buffer . position ( newPosition ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Buffer's position now " + newPosition ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "advancePosition" ) ; }
|
Moves the current byte cursor position for the mapped byte buffer forwards .
|
36,303
|
protected void get ( byte [ ] bytes ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "get" , new Object [ ] { this , new Integer ( bytes . length ) } ) ; _buffer . get ( bytes ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , RLSUtils . toHexString ( bytes , RLSUtils . MAX_DISPLAY_BYTES ) ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "get" ) ; }
|
Getter method used to read bytes . length bytes from the mapped byte buffer at the current byte cursor position into the supplied byte array . The byte cursor is advanced by bytes . length .
|
36,304
|
protected int getInt ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getInt" , this ) ; int data = _buffer . getInt ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getInt" , new Integer ( data ) ) ; return data ; }
|
Getter method used to read an integer from the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of an integer .
|
36,305
|
protected long getLong ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getLong" , this ) ; long data = _buffer . getLong ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getLong" , new Long ( data ) ) ; return data ; }
|
Getter method used to a long from the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of a long .
|
36,306
|
protected short getShort ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getShort" , this ) ; short data = _buffer . getShort ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getShort" , new Short ( data ) ) ; return data ; }
|
Getter method used to a short from the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of a short .
|
36,307
|
protected boolean getBoolean ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getBoolean" , this ) ; byte dataByte = _buffer . get ( ) ; boolean data = ( dataByte == TRUE ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getBoolean" , new Boolean ( data ) ) ; return data ; }
|
Getter method used to a boolean from the mapped byte buffer at the current byte cursor position . The byte cursor is advanced by the size of a boolean .
|
36,308
|
private Object readItem ( ) { Object itemRead = null ; try { currentChunkStatus . incrementItemsTouchedInCurrentChunk ( ) ; for ( ItemReadListenerProxy readListenerProxy : itemReadListeners ) { readListenerProxy . beforeRead ( ) ; } itemRead = readerProxy . readItem ( ) ; for ( ItemReadListenerProxy readListenerProxy : itemReadListeners ) { readListenerProxy . afterRead ( itemRead ) ; } if ( itemRead == null ) { currentChunkStatus . markReadNull ( ) ; currentChunkStatus . decrementItemsTouchedInCurrentChunk ( ) ; } } catch ( Exception e ) { runtimeStepExecution . setException ( e ) ; for ( ItemReadListenerProxy readListenerProxy : itemReadListeners ) { readListenerProxy . onReadError ( e ) ; } if ( ! currentChunkStatus . isRetryingAfterRollback ( ) ) { if ( retryReadException ( e ) ) { if ( ! retryHandler . isRollbackException ( e ) ) { itemRead = readItem ( ) ; } else { currentChunkStatus . markForRollbackWithRetry ( e ) ; } } else if ( skipReadException ( e ) ) { currentItemStatus . setSkipped ( true ) ; runtimeStepExecution . getMetric ( MetricImpl . MetricType . READ_SKIP_COUNT ) . incValue ( ) ; } else { throw new BatchContainerRuntimeException ( e ) ; } } else { if ( skipReadException ( e ) ) { currentItemStatus . setSkipped ( true ) ; runtimeStepExecution . getMetric ( MetricImpl . MetricType . READ_SKIP_COUNT ) . incValue ( ) ; } else if ( retryReadException ( e ) ) { if ( ! retryHandler . isRollbackException ( e ) ) { itemRead = readItem ( ) ; } else { currentChunkStatus . markForRollbackWithRetry ( e ) ; } } else { throw new BatchContainerRuntimeException ( e ) ; } } } catch ( Throwable e ) { throw new BatchContainerRuntimeException ( e ) ; } logger . exiting ( sourceClass , "readItem" , itemRead == null ? "<null>" : itemRead ) ; return itemRead ; }
|
Reads an item from the reader
|
36,309
|
private void publishCheckpointEvent ( String stepName , long jobInstanceId , long jobExecutionId , long stepExecutionId ) { BatchEventsPublisher publisher = getBatchEventsPublisher ( ) ; if ( publisher != null ) { String correlationId = runtimeWorkUnitExecution . getCorrelationId ( ) ; publisher . publishCheckpointEvent ( stepName , jobInstanceId , jobExecutionId , stepExecutionId , correlationId ) ; } }
|
Helper method to publish checkpoint event
|
36,310
|
private int initStepTransactionTimeout ( ) { logger . entering ( sourceClass , "initStepTransactionTimeout" ) ; Properties p = runtimeStepExecution . getProperties ( ) ; int timeout = DEFAULT_TRAN_TIMEOUT_SECONDS ; if ( p != null && ! p . isEmpty ( ) ) { String propertyTimeOut = p . getProperty ( "javax.transaction.global.timeout" ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . log ( Level . FINE , "javax.transaction.global.timeout = {0}" , propertyTimeOut == null ? "<null>" : propertyTimeOut ) ; } if ( propertyTimeOut != null && ! propertyTimeOut . isEmpty ( ) ) { timeout = Integer . parseInt ( propertyTimeOut , 10 ) ; } } logger . exiting ( sourceClass , "initStepTransactionTimeout" , timeout ) ; return timeout ; }
|
Note we can rely on the StepContext properties already having been set at this point .
|
36,311
|
private static String replaceWhitespace ( String value ) { final int length = value . length ( ) ; for ( int i = 0 ; i < length ; ++ i ) { char c = value . charAt ( i ) ; if ( c < 0x20 && ( c == 0x9 || c == 0xA || c == 0xD ) ) { return replace0 ( value , i , length ) ; } } return value ; }
|
Replaces all occurrences of 0x9 0xA and 0xD with 0x20 .
|
36,312
|
private void setMessagingEngineUuid ( SIBUuid8 uuid ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setMessagingEngineUuid" , new Object [ ] { uuid } ) ; messagingEngineUuid = uuid ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setMessagingEngineUuid" ) ; }
|
Set the messagingEngineUuid .
|
36,313
|
public static Map < String , List < Map < String , Object > > > nest ( Map < String , Object > map , String ... keys ) { Map < String , List < Map < String , Object > > > result = new HashMap < String , List < Map < String , Object > > > ( keys . length ) ; String keyMatch = "" ; for ( String key : keys ) { result . put ( key , new ArrayList < Map < String , Object > > ( ) ) ; keyMatch = MessageFormat . format ( "{0}{1}|" , keyMatch , Pattern . quote ( key ) ) ; } String patternString = MessageFormat . format ( "^({0})\\.([0-9]*)\\.(.*)" , keyMatch . substring ( 0 , keyMatch . length ( ) - 1 ) ) ; Pattern pattern = Pattern . compile ( patternString ) ; for ( Map . Entry < String , Object > entry : map . entrySet ( ) ) { String k = entry . getKey ( ) ; Matcher matcher = pattern . matcher ( k ) ; if ( matcher . matches ( ) ) { int base = 1 ; String key = matcher . group ( 1 ) ; processMatch ( result . get ( key ) , entry . getValue ( ) , matcher , base ) ; } } return result ; }
|
Extracts all sub configurations starting with any of the specified keys
|
36,314
|
private static String getUserHome ( ) { String home ; if ( platformType == SelfExtractUtils . PlatformType_CYGWIN ) { home = System . getenv ( "HOME" ) ; } else { home = System . getProperty ( "user.home" ) ; } return home ; }
|
Determine user home based on platform type . Java user . home property is correct in all cases except for cygwin . For cygwin user . home is Windows home so use HOME env var instead .
|
36,315
|
private static String createIfNeeded ( String dir ) { File f = new File ( dir ) ; if ( f . exists ( ) ) { return dir ; } else { boolean success = f . mkdirs ( ) ; if ( success ) return dir ; else return null ; } }
|
Create input directory if it does not exist
|
36,316
|
private static String jarFileName ( ) { createExtractor ( ) ; String fullyQualifiedFileName = extractor . container . getName ( ) ; int lastSeparator = fullyQualifiedFileName . lastIndexOf ( File . separatorChar ) ; String simpleFileName = fullyQualifiedFileName . substring ( lastSeparator + 1 ) ; int dotIdx = simpleFileName . lastIndexOf ( '.' ) ; if ( dotIdx != - 1 ) { return simpleFileName . substring ( 0 , simpleFileName . lastIndexOf ( '.' ) ) ; } return simpleFileName ; }
|
Return jar file name from input archive
|
36,317
|
private static void disable2PC ( String extractDirectory , String serverName ) throws IOException { String fileName = extractDirectory + File . separator + "wlp" + File . separator + "usr" + File . separator + "servers" + File . separator + serverName + File . separator + "jvm.options" ; BufferedReader br = null ; BufferedWriter bw = null ; StringBuffer sb = new StringBuffer ( ) ; try { String sCurrentLine ; File file = new File ( fileName ) ; if ( ! file . exists ( ) ) { boolean success = file . createNewFile ( ) ; if ( ! success ) { throw new IOException ( "Failed to create file " + fileName ) ; } } else { br = new BufferedReader ( new InputStreamReader ( new FileInputStream ( fileName ) , "UTF-8" ) ) ; while ( ( sCurrentLine = br . readLine ( ) ) != null ) { sb . append ( sCurrentLine + "\n" ) ; } } String content = "-Dcom.ibm.tx.jta.disable2PC=true" ; bw = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( file . getAbsoluteFile ( ) ) , "UTF-8" ) ) ; bw . write ( sb . toString ( ) ) ; bw . write ( content ) ; } finally { if ( br != null ) br . close ( ) ; if ( bw != null ) bw . close ( ) ; } }
|
Write property into jvm . options to disable 2PC transactions . 2PC transactions are disabled by default because default transaction log is stored in extract directory and therefore foils transaction recovery if the server terminates unexpectedly .
|
36,318
|
private static int runServer ( String extractDirectory , String serverName , String [ ] args ) throws IOException , InterruptedException { int rc = 0 ; Runtime rt = Runtime . getRuntime ( ) ; String action = "run" ; if ( System . getenv ( "WLP_JAR_DEBUG" ) != null ) action = "debug" ; if ( System . getenv ( "WLP_JAR_ENABLE_2PC" ) == null ) disable2PC ( extractDirectory , serverName ) ; String cmd = extractDirectory + File . separator + "wlp" + File . separator + "bin" + File . separator + "server " + action + " " + serverName ; if ( args . length > 0 ) { StringBuilder appArgs = new StringBuilder ( " --" ) ; for ( String arg : args ) { appArgs . append ( " " ) . append ( arg ) ; } cmd += appArgs . toString ( ) ; } System . out . println ( cmd ) ; if ( platformType == SelfExtractUtils . PlatformType_UNIX ) { } else if ( platformType == SelfExtractUtils . PlatformType_WINDOWS ) { cmd = "cmd /k " + cmd ; } else if ( platformType == SelfExtractUtils . PlatformType_CYGWIN ) { cmd = "bash -c " + '"' + cmd . replace ( '\\' , '/' ) + '"' ; } Process proc = rt . exec ( cmd , SelfExtractUtils . runEnv ( extractDirectory ) , null ) ; StreamReader errorReader = new StreamReader ( proc . getErrorStream ( ) , "ERROR" ) ; errorReader . start ( ) ; StreamReader outputReader = new StreamReader ( proc . getInputStream ( ) , "OUTPUT" ) ; outputReader . start ( ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( new ShutdownHook ( platformType , extractDirectory , serverName , outputReader , errorReader ) ) ) ; rc = proc . waitFor ( ) ; return rc ; }
|
Run server extracted from jar If environment variable WLP_JAR_DEBUG is set use server debug instead
|
36,319
|
private void isInitialized ( boolean condition , String propName ) { if ( condition == true ) { IllegalStateException e = new IllegalStateException ( "J2CGlobalConfigProperties: internal error. Set once property already set." ) ; Tr . error ( tc , "SET_ONCE_PROP_ALREADY_SET_J2CA0159" , ( Object ) null ) ; throw e ; } }
|
Utility method for set once methods .
|
36,320
|
public synchronized final void applyRequestGroupConfigChanges ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "applyRequestGroupConfigChanges" ) ; changeSupport . firePropertyChange ( "applyRequestGroupConfigChanges" , false , true ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "applyRequestGroupConfigChanges" ) ; }
|
Request Stat variable group
|
36,321
|
public Object get ( int key ) throws SIErrorException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "get" ) ; if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "key: " + key ) ; captiveComparitorKey . setValue ( key ) ; if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "captiveComparitorKey: " + captiveComparitorKey ) ; Object retObject = map . get ( captiveComparitorKey ) ; if ( retObject == null ) { throw new SIErrorException ( nls . getFormattedMessage ( "NO_SUCH_KEY_SICO2059" , new Object [ ] { "" + key } , null ) ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "get" ) ; return retObject ; }
|
Retrives the object associated with a particular key from the map .
|
36,322
|
public Object remove ( int key ) throws SIErrorException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "remove" , "" + key ) ; captiveComparitorKey . setValue ( key ) ; Object retObject = map . remove ( captiveComparitorKey ) ; if ( retObject == null ) { throw new SIErrorException ( nls . getFormattedMessage ( "NO_SUCH_KEY_SICO2059" , new Object [ ] { "" + key } , null ) ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "remove" ) ; return retObject ; }
|
Removes an object from the map .
|
36,323
|
public Iterator iterator ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "iterator" ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "iterator" ) ; return map . values ( ) . iterator ( ) ; }
|
Returns an iterator with which to browse the values
|
36,324
|
public boolean containsKey ( int id ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "get" , "" + id ) ; captiveComparitorKey . setValue ( id ) ; final boolean result = map . containsKey ( captiveComparitorKey ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "get" , "" + result ) ; return result ; }
|
Determines if the specified id is present in the IdToObjectMap
|
36,325
|
public static Object checkCast ( Object value , Object object , String valueClassName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { ClassLoader valueLoader = value == null ? null : AccessController . doPrivileged ( new GetClassLoaderPrivileged ( value . getClass ( ) ) ) ; ClassLoader contextLoader = AccessController . doPrivileged ( new GetContextClassLoaderPrivileged ( ) ) ; ClassLoader objectLoader = AccessController . doPrivileged ( new GetClassLoaderPrivileged ( object . getClass ( ) ) ) ; ClassLoader objectValueLoader ; try { Class < ? > objectValueClass = Class . forName ( valueClassName , false , objectLoader ) ; objectValueLoader = objectValueClass == null ? null : AccessController . doPrivileged ( new GetClassLoaderPrivileged ( objectValueClass ) ) ; } catch ( Throwable t ) { Tr . debug ( tc , "checkCast: failed to load " + valueClassName , t ) ; objectValueLoader = null ; } Tr . debug ( tc , "checkCast: value=" + Util . identity ( value ) + ", valueClassName=" + valueClassName , ", valueLoader=" + Util . identity ( valueLoader ) + ", contextLoader=" + Util . identity ( contextLoader ) + ", object=" + Util . identity ( object ) + ", objectLoader=" + Util . identity ( objectLoader ) + ", objectValueLoader=" + Util . identity ( objectValueLoader ) ) ; } return value ; }
|
Called by JIT - deployed code that is performing a checkcast . For the convenience of generated code the input value is returned directly .
|
36,326
|
GBSNode getNode ( Object newKey ) { GBSNode p ; if ( _nodePool == null ) p = new GBSNode ( this , newKey ) ; else { p = _nodePool ; _nodePool = p . rightChild ( ) ; p . reset ( newKey ) ; } return p ; }
|
Allocate a new node for the tree .
|
36,327
|
public void prePopulate ( int x ) { for ( int i = 0 ; i < x ; i ++ ) { GBSNode p = new GBSNode ( this ) ; releaseNode ( p ) ; } }
|
Add some number of free nodes to the node pool for testing .
|
36,328
|
public int maximumFringeImbalance ( ) { int maxBal ; GBSNode q = root ( ) ; if ( q . leftChild ( ) == null ) { maxBal = kFactor ( ) - 1 ; if ( maxBal < 3 ) maxBal = 3 ; } else { if ( ( kFactor ( ) % 3 ) == 0 ) maxBal = kFactor ( ) + 2 ; else maxBal = kFactor ( ) + 1 ; } return maxBal ; }
|
Return the maximum imbalance allowed for a fringe .
|
36,329
|
private int calcTZeroDepth ( int proposedK ) { int d = - 1 ; if ( ( proposedK >= 0 ) && ( proposedK < _t0_d . length ) ) d = _t0_d [ proposedK ] ; if ( d < 0 ) { String x = "K Factor (" + proposedK + ") is invalid.\n" + "Valid K factors are: " + kFactorString ( ) + "." ; throw new IllegalArgumentException ( x ) ; } return d ; }
|
Set the depth of a T0 sub - tree .
|
36,330
|
static boolean checkForPossibleIndexChange ( int v1 , int v2 , Throwable exc , String msg ) { if ( v1 != v2 ) return pessimisticNeeded ; else { GBSTreeException x = new GBSTreeException ( msg + ", v1 = " + v1 , exc ) ; throw x ; } }
|
Process an exception that may have occurred while the index was changing .
|
36,331
|
public Iterator iterator ( ) { GBSIterator x = new GBSIterator ( this ) ; Iterator q = ( Iterator ) x ; return q ; }
|
Create and return an Iterator positioned on the beginning of the tree .
|
36,332
|
public Object searchEqual ( Object searchKey ) { SearchComparator comp = searchComparator ( SearchComparator . EQ ) ; Object p = find ( comp , searchKey ) ; return p ; }
|
Find the first key in the index that is equal to the given key .
|
36,333
|
public Object searchGreater ( Object searchKey ) { SearchComparator comp = searchComparator ( SearchComparator . GT ) ; Object p = find ( comp , searchKey ) ; return p ; }
|
Find the first key in the index that is greater than the given key .
|
36,334
|
public Object searchGreaterOrEqual ( Object searchKey ) { SearchComparator comp = searchComparator ( SearchComparator . GE ) ; Object p = find ( comp , searchKey ) ; return p ; }
|
Find the first key in the index that is greater than or equal to the given key .
|
36,335
|
private SearchNode getSearchNode ( ) { Object x = _searchNode . get ( ) ; SearchNode g = null ; if ( x != null ) { g = ( SearchNode ) x ; g . reset ( ) ; } else { g = new SearchNode ( ) ; x = ( Object ) g ; _searchNode . set ( x ) ; } return g ; }
|
Find a SearchNode for use by the current thread .
|
36,336
|
private boolean optimisticFind ( SearchComparator comp , Object searchKey , SearchNode point ) { point . reset ( ) ; int v1 = _vno ; if ( root ( ) != null ) { if ( ( v1 & 1 ) != 0 ) return pessimisticNeeded ; synchronized ( point ) { } try { internalFind ( comp , searchKey , point ) ; } catch ( NullPointerException npe ) { _nullPointerExceptions ++ ; return checkForPossibleIndexChange ( v1 , _vno , npe , "optimisticInsert" ) ; } catch ( OptimisticDepthException ode ) { _optimisticDepthExceptions ++ ; return checkForPossibleIndexChange ( v1 , _vno , ode , "optimisticInsert" ) ; } if ( v1 != _vno ) return pessimisticNeeded ; } _optimisticFinds ++ ; return optimisticWorked ; }
|
Optimistic find in a GBS Tree
|
36,337
|
private void pessimisticFind ( SearchComparator comp , Object searchKey , SearchNode point ) { point . reset ( ) ; synchronized ( this ) { internalFind ( comp , searchKey , point ) ; _pessimisticFinds ++ ; } }
|
Pessimistic find in a GBS Tree
|
36,338
|
synchronized Object iteratorFind ( DeleteStack stack , SearchComparator comp , Object searchKey , SearchNode point ) { point . reset ( ) ; GBSNode p = root ( ) ; GBSNode l = null ; GBSNode r = null ; int lx = 0 ; int rx = 0 ; Object ret = null ; stack . start ( dummyTopNode ( ) , "GBSTree.iteratorFind" ) ; while ( p != null ) { int xcc = comp . compare ( searchKey , p . middleKey ( ) ) ; if ( xcc == 0 ) { point . setFound ( p , p . middleIndex ( ) ) ; p = null ; } else if ( xcc < 0 ) { if ( p . leftChild ( ) != null ) { stack . push ( NodeStack . PROCESS_CURRENT , p , "GBSTree.iteratorFind(1)" ) ; l = p ; lx = stack . index ( ) ; p = p . leftChild ( ) ; } else { leftSearch ( comp , p , r , searchKey , point ) ; if ( point . wasFound ( ) ) { if ( point . foundNode ( ) == r ) stack . reset ( rx - 1 ) ; } p = null ; } } else { if ( p . rightChild ( ) != null ) { stack . push ( NodeStack . DONE_VISITS , p , "GBSTree.iteratorFind(2)" ) ; r = p ; rx = stack . index ( ) ; p = p . rightChild ( ) ; } else { rightSearch ( comp , p , l , searchKey , point ) ; if ( point . wasFound ( ) ) { if ( point . foundNode ( ) == l ) stack . reset ( lx - 1 ) ; } p = null ; } } } if ( point . wasFound ( ) ) { ret = point . foundNode ( ) . key ( point . foundIndex ( ) ) ; point . setLocation ( ret ) ; } return ret ; }
|
Search the index from an Iterator .
|
36,339
|
private void leftSearch ( SearchComparator comp , GBSNode p , GBSNode r , Object searchKey , SearchNode point ) { if ( r == null ) { int idx = p . searchLeft ( comp , searchKey ) ; if ( ! ( idx < 0 ) ) point . setFound ( p , idx ) ; } else { int xcc = comp . compare ( searchKey , r . rightMostKey ( ) ) ; if ( xcc == 0 ) point . setFound ( r , r . rightMostIndex ( ) ) ; else if ( xcc > 0 ) { int idx = p . searchLeft ( comp , searchKey ) ; if ( ! ( idx < 0 ) ) point . setFound ( p , idx ) ; } else { int idx = r . searchRight ( comp , searchKey ) ; if ( ! ( idx < 0 ) ) point . setFound ( r , idx ) ; } } }
|
Search after falling off a left edge .
|
36,340
|
private void rightSearch ( SearchComparator comp , GBSNode p , GBSNode l , Object searchKey , SearchNode point ) { int xcc = comp . compare ( searchKey , p . rightMostKey ( ) ) ; if ( xcc == 0 ) point . setFound ( p , 0 ) ; else if ( xcc < 0 ) { int idx = p . searchRight ( comp , searchKey ) ; if ( ! ( idx < 0 ) ) point . setFound ( p , idx ) ; } else { if ( l != null ) { int idx = l . searchLeft ( comp , searchKey ) ; if ( ! ( idx < 0 ) ) point . setFound ( l , idx ) ; } } }
|
Search after falling off a right edge .
|
36,341
|
private InsertStack getInsertStack ( ) { Object x = _insertStack . get ( ) ; InsertStack g = null ; if ( x != null ) { g = ( InsertStack ) x ; g . reset ( ) ; } else { g = new InsertStack ( this ) ; x = ( Object ) g ; _insertStack . set ( x ) ; } return g ; }
|
Find an InsertStack for use by the current thread .
|
36,342
|
public boolean insert ( Object new1 ) { boolean result ; InsertStack stack = getInsertStack ( ) ; if ( root ( ) == null ) pessimisticInsert ( stack , new1 ) ; else { boolean didit = optimisticInsert ( stack , new1 ) ; if ( didit == pessimisticNeeded ) pessimisticInsert ( stack , new1 ) ; } if ( stack . isDuplicate ( ) ) result = false ; else result = true ; return result ; }
|
Insert into a GBS Tree .
|
36,343
|
private boolean optimisticInsert ( InsertStack stack , Object new1 ) { InsertNodes point = stack . insertNodes ( ) ; int v1 = _vno ; if ( root ( ) == null ) return pessimisticNeeded ; if ( ( v1 & 1 ) != 0 ) return pessimisticNeeded ; synchronized ( stack ) { } try { findInsert ( point , stack , new1 ) ; } catch ( NullPointerException npe ) { _nullPointerExceptions ++ ; return checkForPossibleIndexChange ( v1 , _vno , npe , "optimisticInsert" ) ; } catch ( OptimisticDepthException ode ) { _optimisticDepthExceptions ++ ; return checkForPossibleIndexChange ( v1 , _vno , ode , "optimisticInsert" ) ; } synchronized ( this ) { if ( v1 != _vno ) { _optimisticInsertSurprises ++ ; return pessimisticNeeded ; } _optimisticInserts ++ ; if ( point . isDuplicate ( ) ) stack . markDuplicate ( ) ; else { _vno ++ ; if ( ( _vno & 1 ) == 1 ) { finishInsert ( point , stack , new1 ) ; _population ++ ; } synchronized ( stack ) { } _vno ++ ; } } return optimisticWorked ; }
|
Optimistic insert into a GBS Tree .
|
36,344
|
private synchronized boolean pessimisticInsert ( InsertStack stack , Object new1 ) { _vno ++ ; if ( ( _vno & 1 ) == 1 ) { if ( root ( ) == null ) { addFirstNode ( new1 ) ; _population ++ ; } else { InsertNodes point = stack . insertNodes ( ) ; findInsert ( point , stack , new1 ) ; if ( point . isDuplicate ( ) ) stack . markDuplicate ( ) ; else { finishInsert ( point , stack , new1 ) ; _population ++ ; } } } synchronized ( stack ) { } _vno ++ ; _pessimisticInserts ++ ; return optimisticWorked ; }
|
Pessimistic insert into a GBS Tree .
|
36,345
|
private void findInsert ( InsertNodes point , InsertStack stack , Object new1 ) { java . util . Comparator comp = insertComparator ( ) ; NodeInsertPoint ip = stack . nodeInsertPoint ( ) ; GBSNode p ; int xcc ; GBSNode l_last = null ; GBSNode r_last = null ; p = root ( ) ; stack . start ( dummyTopNode ( ) , "GBSTree.findInsert" ) ; for ( ; ; ) { xcc = comp . compare ( new1 , p . middleKey ( ) ) ; if ( ! ( xcc > 0 ) ) { GBSNode leftChild = p . leftChild ( ) ; if ( leftChild != null ) { l_last = p ; stack . balancedPush ( NodeStack . PROCESS_CURRENT , p ) ; p = leftChild ; } else { leftAdd ( p , r_last , new1 , ip , point ) ; break ; } } else { GBSNode rightChild = p . rightChild ( ) ; if ( rightChild != null ) { r_last = p ; stack . balancedPush ( NodeStack . DONE_VISITS , p ) ; p = rightChild ; } else { rightAdd ( p , l_last , new1 , ip , point ) ; break ; } } } }
|
Find the insert point within the tree .
|
36,346
|
private void leftAdd ( GBSNode p , GBSNode r , Object new1 , NodeInsertPoint ip , InsertNodes point ) { if ( r == null ) leftAddNoPredecessor ( p , new1 , ip , point ) ; else leftAddWithPredecessor ( p , r , new1 , ip , point ) ; }
|
Add to predecssor or current .
|
36,347
|
private void leftAddNoPredecessor ( GBSNode p , Object new1 , NodeInsertPoint ip , InsertNodes point ) { p . findInsertPointInLeft ( new1 , ip ) ; point . setInsert ( p , ip ) ; }
|
Add to left side with no predecessor present .
|
36,348
|
private void leftAddWithPredecessor ( GBSNode p , GBSNode r , Object new1 , NodeInsertPoint ip , InsertNodes point ) { java . util . Comparator comp = r . insertComparator ( ) ; int xcc = comp . compare ( new1 , r . rightMostKey ( ) ) ; if ( xcc > 0 ) { p . findInsertPointInLeft ( new1 , ip ) ; point . setInsert ( p , ip ) ; } else { r . findInsertPointInRight ( new1 , ip ) ; if ( ip . isDuplicate ( ) ) point . setInsert ( r , ip ) ; else { point . setInsertAndPosition ( p , - 1 , r , ip . insertPoint ( ) ) ; point . setRight ( ) ; } } }
|
Add to left side with an upper predecessor present .
|
36,349
|
private void rightAdd ( GBSNode p , GBSNode l , Object new1 , NodeInsertPoint ip , InsertNodes point ) { if ( l == null ) rightAddNoSuccessor ( p , new1 , ip , point ) ; else rightAddWithSuccessor ( p , l , new1 , ip , point ) ; }
|
Add to current or successor .
|
36,350
|
private void rightAddNoSuccessor ( GBSNode p , Object new1 , NodeInsertPoint ip , InsertNodes point ) { if ( p . lessThanHalfFull ( ) ) point . setInsert ( p , p . rightMostIndex ( ) ) ; else { p . findInsertPointInRight ( new1 , ip ) ; point . setInsert ( p , ip ) ; } }
|
Add to right side with no upper successor present .
|
36,351
|
private void rightAddWithSuccessor ( GBSNode p , GBSNode l , Object new1 , NodeInsertPoint ip , InsertNodes point ) { java . util . Comparator comp = l . insertComparator ( ) ; int xcc = comp . compare ( new1 , l . leftMostKey ( ) ) ; if ( xcc < 0 ) { if ( p . lessThanHalfFull ( ) ) point . setInsert ( p , p . rightMostIndex ( ) ) ; else { p . findInsertPointInRight ( new1 , ip ) ; point . setInsert ( p , ip ) ; } } else { l . findInsertPointInLeft ( new1 , ip ) ; if ( ip . isDuplicate ( ) ) point . setInsert ( l , ip ) ; else { point . setInsertAndPosition ( p , p . rightMostIndex ( ) , l , ip . insertPoint ( ) ) ; point . setLeft ( ) ; } } }
|
Add to right side with an upper successor present .
|
36,352
|
private void finishInsert ( InsertNodes point , InsertStack stack , Object new1 ) { Object insertKey = new1 ; if ( point . positionNode ( ) != null ) { GBSNode p = point . positionNode ( ) ; int ix = point . positionIndex ( ) ; if ( point . rightSide ( ) ) insertKey = p . insertByRightShift ( ix , insertKey ) ; else insertKey = p . insertByLeftShift ( ix , insertKey ) ; } Object migrateKey = null ; if ( point . insertIndex ( ) == point . insertNode ( ) . topMostIndex ( ) ) migrateKey = insertKey ; else migrateKey = point . insertNode ( ) . insertByRightShift ( point . insertIndex ( ) , insertKey ) ; insertFringeMigrate ( stack , point . insertNode ( ) , migrateKey ) ; }
|
Do the write phase of the insert .
|
36,353
|
private void insertFringeMigrate ( InsertStack stack , GBSNode p , Object mkey ) { GBSNode endp = p ; int endIndex = stack . index ( ) ; int maxBal = maximumFringeImbalance ( ) ; stack . setMigratingKey ( mkey ) ; if ( mkey != null ) { stack . processSubFringe ( p ) ; endp = stack . lastNode ( ) ; endIndex = stack . lastIndex ( ) ; } if ( stack . migrating ( ) ) { _xno ++ ; endp . addRightLeaf ( stack . migratingKey ( ) ) ; } insertCheckFringeBalance ( stack , endp , endIndex , maxBal ) ; }
|
Migrate a key from a partial leaf through to the proper place in its fringe adding a node to the right side of the fringe if necessary .
|
36,354
|
private void insertCheckFringeBalance ( InsertStack stack , GBSNode endp , int endIndex , int maxBal ) { GBSNode fpoint = null ; int fDepth = 0 ; int fpidx = 0 ; if ( ( endp . isFull ( ) ) && ( endp . leftChild ( ) == null ) ) { fDepth = 1 ; for ( int j = endIndex ; j > 0 ; j -- ) { GBSNode q = stack . node ( j ) ; if ( q . leftChild ( ) != null ) break ; else { fDepth ++ ; fpoint = q ; fpidx = j ; } } if ( fDepth >= maxBal ) { _xno ++ ; GBSInsertFringe . singleInstance ( ) . balance ( kFactor ( ) , stack , fpoint , fpidx , maxBal ) ; } } }
|
Check to see if fringe balancing is necessary and do it if needed .
|
36,355
|
private DeleteStack getDeleteStack ( ) { Object x = _deleteStack . get ( ) ; DeleteStack g = null ; if ( x != null ) { g = ( DeleteStack ) x ; g . reset ( ) ; } else { g = new DeleteStack ( this ) ; x = ( Object ) g ; _deleteStack . set ( x ) ; } return g ; }
|
Find a DeleteStack for use by the current thread .
|
36,356
|
private boolean optimisticDelete ( DeleteStack stack , Object deleteKey ) { DeleteNode point = stack . deleteNode ( ) ; int v1 = _vno ; if ( ( v1 & 1 ) != 0 ) return pessimisticNeeded ; synchronized ( stack ) { } try { findDelete ( point , stack , deleteKey ) ; } catch ( NullPointerException npe ) { _nullPointerExceptions ++ ; return checkForPossibleIndexChange ( v1 , _vno , npe , "optimisticDelete" ) ; } catch ( OptimisticDepthException ode ) { _optimisticDepthExceptions ++ ; return checkForPossibleIndexChange ( v1 , _vno , ode , "optimisticDelete" ) ; } synchronized ( this ) { if ( v1 != _vno ) { _optimisticDeleteSurprises ++ ; return pessimisticNeeded ; } _optimisticDeletes ++ ; if ( point . wasFound ( ) ) { _vno ++ ; if ( ( _vno & 1 ) == 1 ) { finishDelete ( point , stack , deleteKey ) ; if ( _population <= 0 ) throw new GBSTreeException ( "_population = " + _population ) ; _population -- ; } synchronized ( stack ) { } _vno ++ ; } } return optimisticWorked ; }
|
Optimistic delete from a GBS Tree .
|
36,357
|
void iteratorSpecialDelete ( Iterator iter , GBSNode node , int index ) { _vno ++ ; if ( ( _vno & 1 ) == 1 ) { node . deleteByLeftShift ( index ) ; node . adjustMedian ( ) ; _population -- ; } synchronized ( iter ) { } _vno ++ ; }
|
Allow an Iterator to delete an item by direct removal from a single node .
|
36,358
|
private void finishDelete ( DeleteNode point , DeleteStack stack , Object deleteKey ) { adjustTarget ( point ) ; point . deleteNode ( ) . deleteByLeftShift ( point . deleteIndex ( ) ) ; deleteFringeMigrate ( stack , point . deleteNode ( ) ) ; }
|
Do the write phase of the delete .
|
36,359
|
private void findDelete ( DeleteNode point , DeleteStack stack , Object deleteKey ) { java . util . Comparator comp = deleteComparator ( ) ; GBSNode p ; int xcc ; GBSNode l_last = null ; GBSNode r_last = null ; p = root ( ) ; stack . start ( dummyTopNode ( ) , "GBSTree.findDelete" ) ; while ( p != null ) { xcc = comp . compare ( deleteKey , p . middleKey ( ) ) ; if ( xcc == 0 ) { midDelete ( stack , p , point ) ; p = null ; } else if ( xcc < 0 ) { if ( p . leftChild ( ) != null ) { l_last = p ; stack . push ( NodeStack . PROCESS_CURRENT , p , "GBSTree.findDelete(1)" ) ; p = p . leftChild ( ) ; } else { leftDelete ( p , r_last , deleteKey , point ) ; p = null ; } } else { if ( p . rightChild ( ) != null ) { r_last = p ; stack . push ( NodeStack . DONE_VISITS , p , "GBSTree.findDelete(2)" ) ; p = p . rightChild ( ) ; } else { rightDelete ( p , l_last , deleteKey , point ) ; p = null ; } } } }
|
Find the delete point within the tree .
|
36,360
|
private void midDelete ( DeleteStack stack , GBSNode p , DeleteNode point ) { point . setDelete ( p , p . middleIndex ( ) ) ; GBSNode q = p . lowerPredecessor ( stack ) ; if ( q != null ) { point . setDelete ( q , q . rightMostIndex ( ) ) ; point . setTarget ( p , p . middleIndex ( ) , DeleteNode . ADD_LEFT ) ; } else { q = p . lowerSuccessor ( stack ) ; if ( q != null ) { point . setDelete ( q , 0 ) ; point . setTarget ( p , p . middleIndex ( ) , DeleteNode . ADD_RIGHT ) ; } } }
|
Delete a key with an equal match .
|
36,361
|
private void leftDelete ( GBSNode p , GBSNode r , Object deleteKey , DeleteNode point ) { if ( r == null ) leftDeleteNoPredecessor ( p , deleteKey , point ) ; else leftDeleteWithPredecessor ( p , r , deleteKey , point ) ; }
|
Delete from current or predecessor .
|
36,362
|
private void leftDeleteNoPredecessor ( GBSNode p , Object deleteKey , DeleteNode point ) { int idx = p . findDeleteInLeft ( deleteKey ) ; if ( idx >= 0 ) point . setDelete ( p , idx ) ; }
|
Delete from left side with no upper predecessor .
|
36,363
|
private void leftDeleteWithPredecessor ( GBSNode p , GBSNode r , Object deleteKey , DeleteNode point ) { java . util . Comparator comp = p . deleteComparator ( ) ; int xcc = comp . compare ( deleteKey , r . rightMostKey ( ) ) ; if ( xcc == 0 ) { point . setDelete ( p , 0 ) ; point . setTarget ( r , r . rightMostIndex ( ) , DeleteNode . OVERLAY_RIGHT ) ; } else if ( xcc > 0 ) { int ix = p . findDeleteInLeft ( deleteKey ) ; if ( ! ( ix < 0 ) ) point . setDelete ( p , ix ) ; } else { int ix = r . findDeleteInRight ( deleteKey ) ; if ( ! ( ix < 0 ) ) { point . setTarget ( r , ix , DeleteNode . ADD_RIGHT ) ; point . setDelete ( p , 0 ) ; } } }
|
Delete from left side with an upper predecessor present .
|
36,364
|
private void rightDelete ( GBSNode p , GBSNode l , Object deleteKey , DeleteNode point ) { if ( l == null ) rightDeleteNoSuccessor ( p , deleteKey , point ) ; else rightDeleteWithSuccessor ( p , l , deleteKey , point ) ; }
|
Delete from current or successor .
|
36,365
|
private void rightDeleteNoSuccessor ( GBSNode p , Object deleteKey , DeleteNode point ) { int idx = p . findDeleteInRight ( deleteKey ) ; if ( idx >= 0 ) point . setDelete ( p , idx ) ; }
|
Delete from right side with no successor .
|
36,366
|
private void rightDeleteWithSuccessor ( GBSNode p , GBSNode l , Object deleteKey , DeleteNode point ) { java . util . Comparator comp = p . deleteComparator ( ) ; int xcc = comp . compare ( deleteKey , l . leftMostKey ( ) ) ; if ( xcc == 0 ) { point . setDelete ( p , p . rightMostIndex ( ) ) ; point . setTarget ( l , 0 , DeleteNode . OVERLAY_LEFT ) ; } else if ( xcc < 0 ) { int ix = p . findDeleteInRight ( deleteKey ) ; if ( ix >= 0 ) point . setDelete ( p , ix ) ; } else { int ix = l . findDeleteInLeft ( deleteKey ) ; if ( ix >= 0 ) { point . setDelete ( p , p . rightMostIndex ( ) ) ; point . setTarget ( l , ix , DeleteNode . ADD_LEFT ) ; } } }
|
Delete from right side with successor node present .
|
36,367
|
private void deleteFringeMigrate ( DeleteStack stack , GBSNode p ) { GBSNode endp = p ; int endIndex = stack . index ( ) ; stack . add ( 0 , p ) ; int maxBal = maximumFringeImbalance ( ) ; stack . processSubFringe ( p ) ; endp = stack . lastNode ( ) ; endIndex = stack . lastIndex ( ) ; deleteCheckFringeBalance ( stack , endp , endIndex , maxBal ) ; }
|
Migrate a hole from a partial leaf through to the proper place in its fringe deleting a node from the right side of the fringe if necessary .
|
36,368
|
private void deleteCheckFringeBalance ( DeleteStack stack , GBSNode endp , int endIndex , int maxBal ) { int fDepth = 0 ; fDepth = 0 ; if ( endp . leftChild ( ) == null ) { fDepth = 1 ; for ( int j = endIndex ; j > 0 ; j -- ) { GBSNode q = stack . node ( j ) ; if ( q . leftChild ( ) == null ) fDepth ++ ; else break ; } } int t0_depth = tZeroDepth ( ) ; int t = t0_depth ; if ( t < 1 ) t = 1 ; if ( ( stack . maxDepth ( ) >= t ) && ( endp . population ( ) == ( endp . width ( ) - 1 ) ) ) { int j = 1 ; if ( ( kFactor ( ) % 3 ) == 0 ) j = 2 ; if ( fDepth == j ) { _xno ++ ; GBSDeleteFringe . singleInstance ( ) . balance ( tZeroDepth ( ) , stack ) ; } } else { if ( endp . population ( ) != 0 ) endp . adjustMedian ( ) ; else { _xno ++ ; GBSNode p = stack . node ( endIndex ) ; if ( p . leftChild ( ) == endp ) p . setLeftChild ( null ) ; else p . setRightChild ( null ) ; } } }
|
Check to see if fringe balancing is required following a delete and do the fringe rebalancing if needed .
|
36,369
|
public static ThreadContextDescriptor deserialize ( byte [ ] bytes , Map < String , String > execProps ) throws ClassNotFoundException , IOException { return new ThreadContextDescriptorImpl ( execProps , bytes ) ; }
|
Deserializes a thread context descriptor .
|
36,370
|
public static File [ ] listFiles ( final File target , final List < Pattern > patterns , final boolean include ) { if ( patterns == null || patterns . isEmpty ( ) ) return target . listFiles ( ) ; return target . listFiles ( new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { for ( Pattern pattern : patterns ) { Matcher matcher = pattern . matcher ( name ) ; if ( matcher . matches ( ) ) return include ; } return ! include ; } } ) ; }
|
List files according to the patterns and the pattern type
|
36,371
|
public static void copyFile ( File dest , File source ) throws IOException { InputStream input = null ; try { input = new FileInputStream ( source ) ; createFile ( dest , input ) ; } finally { Utils . tryToClose ( input ) ; } }
|
Copy from one file to the other
|
36,372
|
public static void createFile ( final File dest , final InputStream sourceInput ) throws IOException { if ( sourceInput == null || dest == null ) return ; FileOutputStream fos = null ; try { if ( ! dest . getParentFile ( ) . exists ( ) ) { if ( ! dest . getParentFile ( ) . mkdirs ( ) ) { throw new FileNotFoundException ( ) ; } } fos = TextFileOutputStreamFactory . createOutputStream ( dest ) ; byte [ ] buffer = new byte [ DEFAULT_BUFFER_SIZE ] ; int count = - 1 ; while ( ( count = sourceInput . read ( buffer ) ) > 0 ) { fos . write ( buffer , 0 , count ) ; } fos . flush ( ) ; } finally { Utils . tryToClose ( fos ) ; Utils . tryToClose ( sourceInput ) ; } }
|
Read the content from an inputStream and write out to the other file
|
36,373
|
public static void copyDir ( File from , File to ) throws FileNotFoundException , IOException { File [ ] files = from . listFiles ( ) ; if ( files != null ) { for ( File ff : files ) { File tf = new File ( to , ff . getName ( ) ) ; if ( ff . isDirectory ( ) ) { if ( tf . mkdir ( ) ) { copyDir ( ff , tf ) ; } } else if ( ff . isFile ( ) ) { copyFile ( tf , ff ) ; } } } }
|
Recursively copy the files from one dir to the other .
|
36,374
|
public static boolean isUnderDirectory ( File child , File parent ) { if ( child == null || parent == null ) return false ; URI childUri = child . toURI ( ) ; URI relativeUri = parent . toURI ( ) . relativize ( childUri ) ; return relativeUri . equals ( childUri ) ? false : true ; }
|
If child is under parent will return true otherwise return false .
|
36,375
|
public static String normalizeEntryPath ( String entryPath ) { if ( entryPath == null || entryPath . isEmpty ( ) ) return "" ; entryPath = entryPath . replace ( "\\" , "/" ) ; if ( entryPath . startsWith ( "/" ) ) { if ( entryPath . length ( ) == 1 ) { entryPath = "" ; } else { entryPath = entryPath . substring ( 1 , entryPath . length ( ) ) ; } } return entryPath ; }
|
Normalize a relative entry path so that it can be used in an archive .
|
36,376
|
public static String normalizeDirPath ( String dirPath ) { if ( dirPath == null || dirPath . isEmpty ( ) ) return "" ; dirPath = dirPath . replace ( "\\" , "/" ) ; if ( ! dirPath . endsWith ( "/" ) ) { dirPath = dirPath + "/" ; } return dirPath ; }
|
Normalize a path that represents a directory
|
36,377
|
private static final boolean contains ( Collection < String > list , String value ) { for ( String item : list ) if ( item . contains ( value ) ) return true ; return false ; }
|
Utility method that determines if some text is found as a substring within the contents of a list .
|
36,378
|
static String getConnectionPoolDataSourceClassName ( String vendorPropertiesPID ) { String [ ] classNames = classNamesByPID . get ( vendorPropertiesPID ) ; return classNames == null ? null : classNames [ 1 ] ; }
|
Infer the vendor implementation class name for javax . sql . ConnectionPoolDataSource based on the PID of the vendor properties . A best effort is made for the known vendors .
|
36,379
|
static String getDataSourceClassName ( Collection < String > fileNames ) { for ( Map . Entry < String , String [ ] > entry : classNamesByKey . entrySet ( ) ) if ( contains ( fileNames , entry . getKey ( ) ) ) { String [ ] classNames = entry . getValue ( ) ; return classNames == null ? null : classNames [ 0 ] ; } return null ; }
|
Infer the vendor implementation class name for javax . sql . DataSource based on the JAR or ZIP names . A best effort is made for the known vendors .
|
36,380
|
static String getDataSourceClassName ( String vendorPropertiesPID ) { String [ ] classNames = classNamesByPID . get ( vendorPropertiesPID ) ; return classNames == null ? null : classNames [ 0 ] ; }
|
Infer the vendor implementation class name for javax . sql . DataSource based on the PID of the vendor properties . A best effort is made for the known vendors .
|
36,381
|
static String getXADataSourceClassName ( String vendorPropertiesPID ) { String [ ] classNames = classNamesByPID . get ( vendorPropertiesPID ) ; return classNames == null ? null : classNames [ 2 ] ; }
|
Infer the vendor implementation class name for javax . sql . XADataSource based on the PID of the vendor properties . A best effort is made for the known vendors .
|
36,382
|
private static String tryToLoad ( Class < ? > type , ClassLoader loader , String ... classNames ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; for ( String className : classNames ) try { Class < ? > c = loader . loadClass ( className ) ; boolean isInstance = type . isAssignableFrom ( c ) ; if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , className + " is " + ( isInstance ? "" : "not " ) + "an instance of " + type . getName ( ) ) ; if ( type . isAssignableFrom ( c ) ) return className ; } catch ( ClassNotFoundException x ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , className + " not found on " + loader ) ; } return null ; }
|
Attempt to load the specified class names returning the first that successfully loads and is an instance of the specified type .
|
36,383
|
protected final String [ ] getAttributes ( String key ) { ArrayList < String > array = this . _attributes . get ( key ) ; if ( array != null && array . size ( ) > 0 ) { String [ ] type = new String [ array . size ( ) ] ; return array . toArray ( type ) ; } return null ; }
|
Get the attribute value based on the named value . A string array is returned containing all values of the attribute previously set .
|
36,384
|
public Object handleOperation ( String operation , Object [ ] params ) throws IOException { if ( OPERATION_DOWNLOAD . equals ( operation ) ) { if ( params . length == 2 ) { downloadFile ( ( String ) params [ 0 ] , ( String ) params [ 1 ] ) ; } else { return downloadFile ( ( String ) params [ 0 ] , ( String ) params [ 1 ] , ( Long ) params [ 2 ] , ( Long ) params [ 3 ] ) ; } } else if ( OPERATION_UPLOAD . equals ( operation ) ) { uploadFile ( ( String ) params [ 0 ] , ( String ) params [ 1 ] , ( Boolean ) params [ 2 ] ) ; } else if ( OPERATION_DELETE . equals ( operation ) ) { deleteFile ( ( String ) params [ 0 ] ) ; } else if ( OPERATION_DELETE_ALL . equals ( operation ) ) { deleteAll ( ( List < String > ) params [ 0 ] ) ; } else { throw logUnsupportedOperationError ( "handleOperation" , operation ) ; } return null ; }
|
Handle MBean invocation requests
|
36,385
|
public long read ( long numBytes , int timeout ) throws IOException { long readCount = 0 ; H2StreamProcessor p = muxLink . getStreamProcessor ( streamID ) ; try { p . getReadLatch ( ) . await ( timeout , TimeUnit . MILLISECONDS ) ; readCount = p . readCount ( numBytes , this . getBuffers ( ) ) ; } catch ( InterruptedException e ) { throw new IOException ( "read was stopped by an InterruptedException: " + e ) ; } return readCount ; }
|
Get bytes from the stream processor associated with this read context
|
36,386
|
@ FFDCIgnore ( PrivilegedActionException . class ) private String getConfigNameForRef ( final String ref ) { String name = null ; if ( ref != null ) { final ConfigurationAdmin configAdmin = configAdminRef . getService ( ) ; Configuration config ; try { config = AccessController . doPrivileged ( new PrivilegedExceptionAction < Configuration > ( ) { public Configuration run ( ) throws IOException { return configAdmin . getConfiguration ( ref , configAdminRef . getReference ( ) . getBundle ( ) . getLocation ( ) ) ; } } ) ; } catch ( PrivilegedActionException paex ) { return null ; } Dictionary < String , Object > props = config . getProperties ( ) ; name = ( String ) props . get ( KEY_NAME ) ; } return name ; }
|
Use the config admin service to get the name for a given service reference
|
36,387
|
public static synchronized void addConfig ( String id , String uri , Map < String , String > params ) { uriMap . put ( id , uri ) ; configInfo . put ( uri , params ) ; resolvedConfigInfo . clear ( ) ; if ( uri . endsWith ( "*" ) ) { wildcardsPresentInConfigInfo = true ; } }
|
add a configuration for a URL We d like a set of hashmaps keyed by URL however when osgi calls deactivate we have no arguments so we have to associate a url with the object id of the service . That allows us to remove the right one .
|
36,388
|
public String generateSessionId ( ) { byte random [ ] = new byte [ 16 ] ; StringBuilder buffer = new StringBuilder ( ) ; int resultLenBytes = 0 ; while ( resultLenBytes < sessionIdLength ) { getRandomBytes ( random ) ; for ( int j = 0 ; j < random . length && resultLenBytes < sessionIdLength ; j ++ ) { byte b1 = ( byte ) ( ( random [ j ] & 0xf0 ) >> 4 ) ; byte b2 = ( byte ) ( random [ j ] & 0x0f ) ; if ( b1 < 10 ) { buffer . append ( ( char ) ( '0' + b1 ) ) ; } else { buffer . append ( ( char ) ( 'A' + ( b1 - 10 ) ) ) ; } if ( b2 < 10 ) { buffer . append ( ( char ) ( '0' + b2 ) ) ; } else { buffer . append ( ( char ) ( 'A' + ( b2 - 10 ) ) ) ; } resultLenBytes ++ ; } } if ( jvmRoute != null && jvmRoute . length ( ) > 0 ) { buffer . append ( '.' ) . append ( jvmRoute ) ; } return buffer . toString ( ) ; }
|
Generate and return a new session identifier .
|
36,389
|
public boolean containsKey ( Object key ) { FastHashtableEntry tab [ ] = table ; int hash = key . hashCode ( ) ; int index = ( hash & 0x7FFFFFFF ) % tab . length ; for ( FastHashtableEntry e = tab [ index ] ; e != null ; e = e . next ) { if ( ( e . hash == hash ) && e . key . equals ( key ) ) { return true ; } } return false ; }
|
Tests if the specified object is a key in this hashtable .
|
36,390
|
private boolean ableToFilter ( ) { if ( filter == null ) return false ; for ( int i = table . length ; i -- > 0 ; ) { FastHashtableEntry newContents = null , next = null ; for ( FastHashtableEntry e = table [ i ] ; e != null ; e = next ) { next = e . next ; if ( filter . shouldRetain ( e . key , e . value ) ) { e . next = newContents ; newContents = e ; } else count -- ; } table [ i ] = newContents ; } return count < threshold ; }
|
Avoids the need to rehash when some entries can be filtered out of the Hashtable by an upcall to a separate decision routine .
|
36,391
|
private void readObject ( java . io . ObjectInputStream s ) throws IOException , ClassNotFoundException { s . defaultReadObject ( ) ; int origlength = s . readInt ( ) ; int elements = s . readInt ( ) ; int length = ( int ) ( elements * loadFactor ) + ( elements / 20 ) + 3 ; if ( length > elements && ( length & 1 ) == 0 ) length -- ; if ( origlength > 0 && length > origlength ) length = origlength ; table = new FastHashtableEntry [ length ] ; count = 0 ; for ( ; elements > 0 ; elements -- ) { Object key = s . readObject ( ) ; Object value = s . readObject ( ) ; put ( key , value ) ; } }
|
readObject is called to restore the state of the hashtable from a stream . Only the keys and values are serialized since the hash values may be different when the contents are restored . Read count elements and insert into the hashtable .
|
36,392
|
public boolean getBooleanProperty ( String propertyName ) { boolean booleanValue = false ; Object objectValue = this . properties . get ( propertyName ) ; if ( objectValue != null ) { if ( objectValue instanceof Boolean ) { booleanValue = ( ( Boolean ) objectValue ) . booleanValue ( ) ; } else if ( objectValue instanceof String ) { booleanValue = Boolean . parseBoolean ( ( String ) objectValue ) ; } } return booleanValue ; }
|
Query the boolean property value of the input name .
|
36,393
|
public String getStringProperty ( String propertyName ) { Object value = this . properties . get ( propertyName ) ; if ( null != value && value instanceof String ) { return ( String ) value ; } return null ; }
|
Query the properties for the input name the value will be null if not found or was not a String object .
|
36,394
|
private boolean getBooleanProperty ( String key , String defaultValue , StringBuilder errors ) { boolean booleanValue = false ; String stringValue = null ; boolean valueCorrect = false ; Object objectValue = this . properties . get ( key ) ; if ( objectValue != null ) { if ( objectValue instanceof Boolean ) { booleanValue = ( ( Boolean ) objectValue ) . booleanValue ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Property " + key + " set to " + booleanValue ) ; } return booleanValue ; } else if ( objectValue instanceof String ) { stringValue = ( String ) objectValue ; } } else { if ( defaultValue != null ) { stringValue = defaultValue ; } else { errors . append ( key ) ; errors . append ( ':' ) ; errors . append ( stringValue ) ; errors . append ( '\n' ) ; return false ; } } if ( stringValue != null ) { if ( stringValue . equals ( "true" ) ) { booleanValue = true ; valueCorrect = true ; } else if ( stringValue . equals ( "false" ) ) { booleanValue = false ; valueCorrect = true ; } } if ( valueCorrect ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Property " + key + " set to " + booleanValue ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Property " + key + " has invalid value " + stringValue ) ; } errors . append ( key ) ; errors . append ( ':' ) ; errors . append ( stringValue ) ; errors . append ( '\n' ) ; } return booleanValue ; }
|
Extract String value from property list and convert to boolean .
|
36,395
|
private int getIntProperty ( String key , boolean defaultProvided , int defaultValue , StringBuilder errors ) { String value = getStringProperty ( key ) ; if ( null != value ) { try { int realValue = Integer . parseInt ( value ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Property " + key + " set to " + realValue ) ; } return realValue ; } catch ( NumberFormatException nfe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Property " + key + ", format error in [" + value + "]" ) ; } } } if ( ! defaultProvided ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Property " + key + " not found. Error being tallied." ) ; } errors . append ( key ) ; errors . append ( ":null \n" ) ; return - 1 ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Property " + key + " using default " + defaultValue ) ; } return defaultValue ; }
|
Extract an integer property from the stored values . This might use a default value if provided and the property was not found .
|
36,396
|
public synchronized void lockExclusive ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "lockExclusive" , this ) ; boolean interrupted = false ; while ( ! tryLockExclusive ( ) ) { try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Waiting to get exclusive lock" ) ; wait ( 1000 ) ; } catch ( InterruptedException e ) { interrupted = true ; } } while ( iLockCount > 0 ) { try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Waiting for lock count to reach 0 " + iLockCount ) ; wait ( 1000 ) ; } catch ( InterruptedException e ) { interrupted = true ; } } if ( interrupted ) { Thread . currentThread ( ) . interrupt ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "lockExclusive" ) ; }
|
This method locks the mutex so no other lockers can get the lock .
|
36,397
|
public int getLocalBusinessInterfaceIndex ( String interfaceName ) { if ( ivBusinessLocalInterfaceClasses != null ) { for ( int i = 0 ; i < ivBusinessLocalInterfaceClasses . length ; i ++ ) { String bInterfaceName = ivBusinessLocalInterfaceClasses [ i ] . getName ( ) ; if ( bInterfaceName . equals ( interfaceName ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getLocalBusinessInterfaceIndex : " + bInterfaceName + " at index " + i ) ; return i ; } } } return - 1 ; }
|
Gets the index of the local business interface .
|
36,398
|
public int getRequiredLocalBusinessInterfaceIndex ( String interfaceName ) throws IllegalStateException { int interfaceIndex = getLocalBusinessInterfaceIndex ( interfaceName ) ; if ( interfaceIndex == - 1 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getRequiredLocalBusinessInterfaceIndex : IllegalStateException : " + "Requested business interface not found : " + interfaceName ) ; throw new IllegalStateException ( "Requested business interface not found : " + interfaceName ) ; } return interfaceIndex ; }
|
Gets the index of the local busines interface . This method will throw an IllegalStateException if a local interface could not be matched . If it is known that a match must occur on a local business interface then this method should be used .
|
36,399
|
public int getRemoteBusinessInterfaceIndex ( String interfaceName ) { if ( ivBusinessRemoteInterfaceClasses != null ) { for ( int i = 0 ; i < ivBusinessRemoteInterfaceClasses . length ; i ++ ) { String bInterface = ivBusinessRemoteInterfaceClasses [ i ] . getName ( ) ; if ( bInterface . equals ( interfaceName ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getRemoteBusinessInterfaceIndex : " + bInterface + " at index " + i ) ; return i ; } } } return - 1 ; }
|
Gets the index of the remote business interface .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.