idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
140,100
public static < T > Key < T > of ( Class < T > type , Annotation ann ) { Objects . requireNonNull ( type ) ; Objects . requireNonNull ( ann ) ; return new Key <> ( type , new Annotation [ ] { ann } ) ; }
Builds Key from a Class and annotation
59
8
140,101
public Class < T > rawClass ( ) { Type type = type ( ) ; if ( type instanceof Class ) { return ( Class ) type ; } else if ( type instanceof ParameterizedType ) { ParameterizedType pType = ( ParameterizedType ) type ; return ( Class ) pType . getRawType ( ) ; } else { throw new UnsupportedOperationException ( type + " " + type . getClass ( ) . getName ( ) ) ; } }
Returns raw class of associated type
102
6
140,102
public boolean isAnnotationPresent ( Class < ? extends Annotation > annTypeTest ) { for ( Class < ? > annType : _annTypes ) { if ( annType . equals ( annTypeTest ) ) { return true ; } } return false ; }
Tests if annotation type is present in Key s annotations
55
11
140,103
public boolean isAssignableFrom ( Key < ? super T > key ) { Objects . requireNonNull ( key ) ; for ( Class < ? extends Annotation > annType : _annTypes ) { if ( ! containsType ( annType , key . _annTypes ) ) { return false ; } } if ( _type instanceof ParameterizedType ) { if ( ! ( key . _type instanceof ParameterizedType ) ) { return false ; } if ( ! isAssignableFrom ( ( ParameterizedType ) _type , ( ParameterizedType ) key . _type ) ) { return false ; } } if ( _anns . length > 0 && key . _anns . length > 0 ) { return isAssignableFrom ( _anns , key . _anns ) ; } return true ; }
Tests if key is assignable . Key is considered assignable if annotation types match Type matches and annotation instances match .
178
24
140,104
public static void syslog ( int facility , int severity , String text ) { _jniTroubleshoot . checkIsValid ( ) ; if ( ! _isOpen ) { _isOpen = true ; nativeOpenSyslog ( ) ; } int priority = facility * 8 + severity ; nativeSyslog ( priority , text ) ; }
Writes data .
72
4
140,105
public Object removeAttribute ( String name ) { if ( _attributes == null ) return null ; else return _attributes . remove ( name ) ; }
Removes the named attributes
32
5
140,106
@ Override public InputStream getResourceAsStream ( String name ) { ResourceEntry entry = _resourceCacheMap . get ( name ) ; if ( entry == null || entry . isModified ( ) ) { URL resource = super . getResource ( name ) ; entry = new ResourceEntry ( resource ) ; _resourceCacheMap . put ( name , entry ) ; } return entry . getResourceAsStream ( ) ; }
Overrides getResource to implement caching .
88
9
140,107
private void initListeners ( ) { ClassLoader parent = getParent ( ) ; for ( ; parent != null ; parent = parent . getParent ( ) ) { if ( parent instanceof EnvironmentClassLoader ) { EnvironmentClassLoader loader = ( EnvironmentClassLoader ) parent ; if ( _stopListener == null ) _stopListener = new WeakStopListener ( this ) ; loader . addListener ( _stopListener ) ; return ; } } }
Adds self as a listener .
91
6
140,108
@ Override public void addURL ( URL url , boolean isScanned ) { if ( containsURL ( url ) ) { return ; } super . addURL ( url , isScanned ) ; if ( isScanned ) _pendingScanRoots . add ( new ScanRoot ( url , null ) ) ; }
Adds the URL to the URLClassLoader .
67
9
140,109
@ Override public String getHash ( ) { String superHash = super . getHash ( ) ; // ioc/0p61 - package needed for hash to enable scan long crc = Crc64 . generate ( superHash ) ; for ( String pkg : _packageList ) { crc = Crc64 . generate ( crc , pkg ) ; } return Long . toHexString ( Math . abs ( crc ) ) ; }
Add the custom packages to the classloader hash .
96
10
140,110
public void start ( ) { if ( ! getLifecycle ( ) . toStarting ( ) ) { startListeners ( ) ; return ; } //sendAddLoaderEvent(); //bind(); try { make ( ) ; } catch ( Exception e ) { log ( ) . log ( Level . WARNING , e . toString ( ) , e ) ; e . printStackTrace ( ) ; } startListeners ( ) ; getLifecycle ( ) . toActive ( ) ; if ( isAdminEnable ( ) ) { Thread thread = Thread . currentThread ( ) ; ClassLoader loader = thread . getContextClassLoader ( ) ; try { thread . setContextClassLoader ( this ) ; //_admin = new EnvironmentAdmin(this); //_admin.register(); } finally { thread . setContextClassLoader ( loader ) ; } } }
Marks the environment of the class loader as started . The class loader itself doesn t use this but a callback might .
177
24
140,111
@ Override public void stop ( ) { if ( ! getLifecycle ( ) . toStop ( ) ) { return ; } ArrayList < EnvLoaderListener > listeners = getEnvironmentListeners ( ) ; Thread thread = Thread . currentThread ( ) ; ClassLoader oldLoader = thread . getContextClassLoader ( ) ; thread . setContextClassLoader ( this ) ; try { // closing down in reverse if ( listeners != null ) { for ( int i = listeners . size ( ) - 1 ; i >= 0 ; i -- ) { EnvLoaderListener listener = listeners . get ( i ) ; try { listener . environmentStop ( this ) ; } catch ( Throwable e ) { log ( ) . log ( Level . WARNING , e . toString ( ) , e ) ; } } } super . stop ( ) ; } finally { thread . setContextClassLoader ( oldLoader ) ; // drain the thread pool for GC // XXX: ExecutorThreadPoolBaratine.getThreadPool().stopEnvironment(this); } }
Stops the environment closing down any resources .
217
9
140,112
@ Override public void destroy ( ) { Thread thread = Thread . currentThread ( ) ; ClassLoader oldLoader = thread . getContextClassLoader ( ) ; try { thread . setContextClassLoader ( this ) ; WeakStopListener stopListener = _stopListener ; _stopListener = null ; super . destroy ( ) ; thread . setContextClassLoader ( oldLoader ) ; ClassLoader parent = getParent ( ) ; for ( ; parent != null ; parent = parent . getParent ( ) ) { if ( parent instanceof EnvironmentClassLoader ) { EnvironmentClassLoader loader = ( EnvironmentClassLoader ) parent ; loader . removeListener ( stopListener ) ; } } } finally { thread . setContextClassLoader ( oldLoader ) ; //_owner = null; _attributes = null ; _listeners = null ; //_scanListeners = null; //_stopListener = null; /* EnvironmentAdmin admin = _admin; _admin = null; if (admin != null) admin.unregister(); */ } }
Destroys the class loader .
211
7
140,113
@ Override public void update ( Result < Integer > result , int nodeIndex , String sql , Object [ ] args ) { NodePodAmp node = _podKraken . getNode ( nodeIndex ) ; for ( int i = 0 ; i < node . serverCount ( ) ; i ++ ) { ServerBartender server = node . server ( i ) ; if ( server != null && server . isUp ( ) ) { ClusterServiceKraken proxy = _podKraken . getProxy ( server ) ; // XXX: failover proxy . update ( result , nodeIndex , sql , args ) ; return ; } } RuntimeException exn = new ServiceException ( L . l ( "update failed with no live servers" ) ) ; exn . fillInStackTrace ( ) ; // XXX: fail result . fail ( exn ) ; }
Distributed update table . All owning nodes will get a request .
182
13
140,114
@ Override protected void doAttach ( ) throws Exception { if ( file == null ) { // Remove the "file:///" // LocalFileName localFileName = (LocalFileName) getName(); String fileName = rootFile + getName ( ) . getPathDecoded ( ) ; // fileName = UriParser.decode(fileName); file = new File ( fileName ) ; // NOSONAR } }
Attaches this file object to its file resource .
90
10
140,115
@ Override protected FileType doGetType ( ) throws Exception { // JDK BUG: 6192331 // if (!file.exists()) if ( ! file . exists ( ) && file . length ( ) < 1 ) { return FileType . IMAGINARY ; } if ( file . isDirectory ( ) ) { return FileType . FOLDER ; } // In doubt, treat an existing file as file // if (file.isFile()) // { return FileType . FILE ; // } // throw new FileSystemException("vfs.provider.local/get-type.error", file); }
Returns the file s type .
131
6
140,116
@ Override protected void doRename ( final FileObject newfile ) throws Exception { AludraLocalFile newLocalFile = ( AludraLocalFile ) FileObjectUtils . getAbstractFileObject ( newfile ) ; if ( ! file . renameTo ( newLocalFile . getLocalFile ( ) ) ) { throw new FileSystemException ( "vfs.provider.local/rename-file.error" , new String [ ] { file . toString ( ) , newfile . toString ( ) } ) ; } }
rename this file
115
4
140,117
@ Override //@Direct public void openWrite ( Result < OutputStream > result , WriteOption ... options ) { result . ok ( _root . openWriteFile ( _path , options ) ) ; }
Open a file for writing .
43
6
140,118
@ Override @ Direct public void renameTo ( String relPath , Result < Boolean > result , WriteOption ... options ) { _root . renameTo ( _path , toAbsolute ( relPath ) , result , options ) ; }
Renames to a destination file
49
6
140,119
@ Override public void get ( byte [ ] tableKey , byte [ ] key , long version , Result < GetStreamResult > result ) { _tableManager . getKelpBacking ( ) . getLocal ( tableKey , key , version , result . then ( gs -> getImpl ( gs ) ) ) ; }
Get a row from a table .
70
7
140,120
@ Override public void put ( byte [ ] tableKey , StreamSource rowSource , Result < Boolean > result ) { putImpl ( tableKey , rowSource , PutType . PUT , result ) ; }
Puts the row for replication .
44
7
140,121
@ Override public void remove ( byte [ ] tableKey , byte [ ] rowKey , long version , Result < Boolean > result ) { _tableManager . getKelpBacking ( ) . remove ( tableKey , rowKey , version , result ) ; }
Removes a row identified by its key . If the current value has a later version than the request the request is ignored .
56
25
140,122
@ Override public void find ( byte [ ] tableKey , Object arg , Result < byte [ ] > result ) { TableKraken table = _tableManager . getTable ( tableKey ) ; if ( table == null ) { throw new QueryException ( L . l ( "'{0}' is an unknown table." , Hex . toShortHex ( tableKey ) ) ) ; } String sql = "select_local table_key from kraken_meta_table where table_name=?" ; QueryBuilderKraken builder = QueryParserKraken . parse ( _tableManager , sql ) ; QueryKraken query = builder . build ( ) ; query . findOne ( result . then ( cursor -> findKeyResult ( cursor ) ) , arg ) ; }
Find a table by its name .
165
7
140,123
@ Override public void requestStartupUpdates ( String from , byte [ ] tableKey , int podIndex , long deltaTime , Result < Boolean > cont ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "CacheRequestUpdates " + from + " shard=" + podIndex + " delta=" + deltaTime ) ; } // ChampCloudManager cloudManager = ChampCloudManager.create(); //ServiceManagerAmp rampManager = AmpSystem.getCurrentManager(); //String address = "champ://" + from + ClusterServiceKraken.UID; //ClusterServiceKraken peerService = rampManager.lookup(address).as(ClusterServiceKraken.class); // ArrayList<CacheData> entryList = null; long accessTime = CurrentTime . currentTime ( ) + deltaTime ; // int count = 0; TablePod tablePod = _clientKraken . getTable ( tableKey ) ; if ( tablePod == null ) { // This server does not have any information about the table. if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( L . l ( "{0} is an unknown table key ({1})" , Hex . toShortHex ( tableKey ) , BartenderSystem . getCurrentSelfServer ( ) ) ) ; } cont . ok ( true ) ; return ; } tablePod . getUpdatesFromLocal ( podIndex , accessTime , cont ) ; // new ResultUpdate(peerService, cont)); // start reciprocating update request // tablePod.startRequestUpdates(); }
Asks for updates from the message
345
7
140,124
public PathImpl fsWalk ( String userPath , Map < String , Object > attributes , String path ) { return new ClasspathPath ( _root , userPath , path ) ; }
Lookup the actual path relative to the filesystem root .
38
11
140,125
@ Override public boolean exists ( ) { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; return loader . getResource ( getTrimPath ( ) ) != null ; }
Returns true if the file exists .
44
7
140,126
public char setIndex ( int pos ) { if ( pos < 0 ) { _pos = 0 ; return DONE ; } else if ( _length <= pos ) { _pos = _length ; return DONE ; } else { _pos = pos ; return _string . charAt ( pos ) ; } }
sets the cursor to the position
65
6
140,127
public char skip ( int n ) { _pos += n ; if ( _length <= _pos ) { _pos = _string . length ( ) ; return DONE ; } else return _string . charAt ( _pos ) ; }
Skips the next n characters
50
6
140,128
public RowBuilder int16 ( String name ) { ColumnInt16 column = new ColumnInt16 ( _columns . size ( ) , name , _offset ) ; _offset += column . length ( ) ; _columns . add ( column ) ; return this ; }
Creates a 16 - bit integer valued column
56
9
140,129
public RowBuilder int32 ( String name ) { ColumnInt32 column = new ColumnInt32 ( _columns . size ( ) , name , _offset ) ; _offset += column . length ( ) ; _columns . add ( column ) ; return this ; }
Creates a 32 - bit integer valued column
56
9
140,130
public RowBuilder int64 ( String name ) { ColumnInt64 column = new ColumnInt64 ( _columns . size ( ) , name , _offset ) ; _offset += column . length ( ) ; _columns . add ( column ) ; return this ; }
Creates a 64 - bit long valued column
56
9
140,131
public RowBuilder floatCol ( String name ) { ColumnFloat column = new ColumnFloat ( _columns . size ( ) , name , _offset ) ; _offset += column . length ( ) ; _columns . add ( column ) ; return this ; }
Creates a float valued column .
54
7
140,132
public RowBuilder doubleCol ( String name ) { ColumnDouble column = new ColumnDouble ( _columns . size ( ) , name , _offset ) ; _offset += column . length ( ) ; _columns . add ( column ) ; return this ; }
Creates a double valued column .
54
7
140,133
public RowBuilder timestampCol ( String name ) { Column column = new ColumnTimestamp ( _columns . size ( ) , name , _offset ) ; _offset += column . length ( ) ; _columns . add ( column ) ; return this ; }
timestamp valued column .
54
5
140,134
public RowBuilder identityCol ( String name ) { Column column = new ColumnIdentity ( _columns . size ( ) , name , _offset ) ; _offset += column . length ( ) ; _columns . add ( column ) ; return this ; }
identity valued column .
54
5
140,135
public int getInt ( String name ) { Integer value = ( Integer ) get ( name ) ; if ( value != null ) return value . intValue ( ) ; else return 0 ; }
Returns the annotation value .
39
5
140,136
public < T > void publisher ( Class < T > api , Result < T > result ) { String path = api . getName ( ) ; String address = address ( path ) ; ServicesAmp manager = ServicesAmp . current ( ) ; ServiceRefAmp pubRef = manager . service ( address ) ; result . ok ( pubRef . as ( api ) ) ; }
Publish to a location .
79
6
140,137
public InputStream getResourceAsStream ( String name ) { Source path ; path = getPath ( name ) ; if ( path != null && path . canRead ( ) ) { try { return path . inputStream ( ) ; } catch ( Exception e ) { } } return null ; }
Opens the stream to the resource .
60
8
140,138
public static JarPath create ( PathImpl backing ) { backing = backing . unwrap ( ) ; if ( backing instanceof JarPath ) { return ( JarPath ) backing ; } JarPath path = _jarCache . get ( backing ) ; if ( path == null ) { path = new JarPath ( null , "/" , "/" , backing ) ; _jarCache . put ( backing , path ) ; } return path ; }
Creates a new root Jar path .
90
8
140,139
public void write ( LineMap lineMap ) throws IOException { _os . println ( "SMAP" ) ; _os . println ( lineMap . getDestFilename ( ) ) ; _os . println ( _sourceType ) ; _os . println ( "*S " + _sourceType ) ; IntMap fileMap = new IntMap ( ) ; _os . println ( "*F" ) ; Iterator < LineMap . Line > iter = lineMap . iterator ( ) ; while ( iter . hasNext ( ) ) { LineMap . Line line = iter . next ( ) ; String filename = line . getSourceFilename ( ) ; int index = fileMap . get ( filename ) ; if ( index < 0 ) { index = fileMap . size ( ) + 1 ; fileMap . put ( filename , index ) ; if ( filename . indexOf ( ' ' ) >= 0 ) { int p = filename . lastIndexOf ( ' ' ) ; _os . println ( "+ " + index + " " + filename . substring ( p + 1 ) ) ; // XXX: _os.println(filename); if ( filename . startsWith ( "/" ) ) _os . println ( filename . substring ( 1 ) ) ; else _os . println ( filename ) ; } else _os . println ( index + " " + filename ) ; } } _os . println ( "*L" ) ; int size = lineMap . size ( ) ; int lastIndex = 0 ; for ( int i = 0 ; i < size ; i ++ ) { LineMap . Line line = lineMap . get ( i ) ; String filename = line . getSourceFilename ( ) ; int index = fileMap . get ( filename ) ; String fileMarker = "" ; _os . print ( line . getSourceLine ( ) ) ; _os . print ( "#" + index ) ; if ( line . getRepeatCount ( ) > 1 ) _os . print ( "," + line . getRepeatCount ( ) ) ; _os . print ( ":" ) ; _os . print ( line . getDestinationLine ( ) ) ; if ( line . getDestinationIncrement ( ) > 1 ) _os . print ( "," + line . getDestinationIncrement ( ) ) ; _os . println ( ) ; } _os . println ( "*E" ) ; }
Writes the line map
503
5
140,140
@ Override public boolean isIdleAlmostExpired ( long delta ) { long now = CurrentTime . currentTime ( ) ; return ( _pool . getLoadBalanceIdleTime ( ) < now - _idleStartTime + delta ) ; }
Returns true if nearing end of free time .
53
9
140,141
@ Override public void free ( long idleStartTime ) { if ( _is == null ) { IllegalStateException exn = new IllegalStateException ( L . l ( "{0} unexpected free of closed stream" , this ) ) ; exn . fillInStackTrace ( ) ; log . log ( Level . FINE , exn . toString ( ) , exn ) ; return ; } long requestStartTime = _requestStartTime ; _requestStartTime = 0 ; if ( requestStartTime > 0 ) _requestTimeProbe . end ( requestStartTime ) ; // #2369 - the load balancer might set its own view of the free // time if ( idleStartTime <= 0 ) { idleStartTime = _is . getReadTime ( ) ; if ( idleStartTime <= 0 ) { // for write-only, the read time is zero idleStartTime = CurrentTime . currentTime ( ) ; } } _idleStartTime = idleStartTime ; _idleProbe . start ( ) ; _isIdle = true ; _pool . free ( this ) ; }
Adds the stream to the free pool .
234
8
140,142
public void write ( byte [ ] buf , int offset , int length , boolean isEnd ) throws IOException { int end = offset + length ; while ( offset < end ) { int ch1 = buf [ offset ++ ] & 0xff ; if ( ch1 < 0x80 ) os . write ( ch1 ) ; else if ( ( ch1 & 0xe0 ) == 0xc0 ) { if ( offset >= end ) throw new EOFException ( "unexpected end of file in utf8 character" ) ; int ch2 = buf [ offset ++ ] & 0xff ; if ( ( ch2 & 0xc0 ) != 0x80 ) throw new CharConversionException ( "illegal utf8 encoding" ) ; os . write ( ( ( ch1 & 0x1f ) << 6 ) + ( ch2 & 0x3f ) ) ; } else if ( ( ch1 & 0xf0 ) == 0xe0 ) { if ( offset + 1 >= end ) throw new EOFException ( "unexpected end of file in utf8 character" ) ; int ch2 = buf [ offset ++ ] & 0xff ; int ch3 = buf [ offset ++ ] & 0xff ; if ( ( ch2 & 0xc0 ) != 0x80 ) throw new CharConversionException ( "illegal utf8 encoding" ) ; if ( ( ch3 & 0xc0 ) != 0x80 ) throw new CharConversionException ( "illegal utf8 encoding" ) ; os . write ( ( ( ch1 & 0x1f ) << 12 ) + ( ( ch2 & 0x3f ) << 6 ) + ( ch3 & 0x3f ) ) ; } else throw new CharConversionException ( "illegal utf8 encoding at (" + ( int ) ch1 + ")" ) ; } }
Implementation of the writer write .
390
7
140,143
public static String getMimeName ( String encoding ) { if ( encoding == null ) return null ; String value = _mimeName . get ( encoding ) ; if ( value != null ) return value ; String upper = normalize ( encoding ) ; String lookup = _mimeName . get ( upper ) ; value = lookup == null ? upper : lookup ; _mimeName . put ( encoding , value ) ; return value ; }
Returns the canonical mime name for the given character encoding .
91
12
140,144
public static String getMimeName ( Locale locale ) { if ( locale == null ) return "utf-8" ; String mimeName = _localeName . get ( locale . toString ( ) ) ; if ( mimeName == null ) mimeName = _localeName . get ( locale . getLanguage ( ) ) ; if ( mimeName == null ) return "utf-8" ; else return mimeName ; }
Returns the canonical mime name for the given locale .
95
11
140,145
public static EncodingWriter getWriteEncoding ( String encoding ) { if ( encoding == null ) encoding = "iso-8859-1" ; EncodingWriter factory = _writeEncodingFactories . get ( encoding ) ; if ( factory != null ) return factory . create ( ) ; factory = _writeEncodingFactories . get ( encoding ) ; if ( factory == null ) { try { String javaEncoding = Encoding . getJavaName ( encoding ) ; if ( javaEncoding == null ) javaEncoding = "ISO8859_1" ; String className = "com.caucho.v5.vfs.i18n." + javaEncoding + "Writer" ; Class < ? > cl = Class . forName ( className ) ; factory = ( EncodingWriter ) cl . newInstance ( ) ; factory . setJavaEncoding ( javaEncoding ) ; } catch ( Throwable e ) { } if ( factory == null ) { factory = new JDKWriter ( ) ; String javaEncoding = Encoding . getJavaName ( encoding ) ; if ( javaEncoding == null ) javaEncoding = "ISO8859_1" ; factory . setJavaEncoding ( javaEncoding ) ; } _writeEncodingFactories . put ( encoding , factory ) ; } // return factory.create(factory.getJavaEncoding()); // charset uses the original encoding, not the java encoding return factory . create ( encoding ) ; }
Returns an EncodingWriter to translate characters to bytes .
313
11
140,146
public static String getJavaName ( String encoding ) { if ( encoding == null ) return null ; String javaName = _javaName . get ( encoding ) ; if ( javaName != null ) return javaName ; String upper = normalize ( encoding ) ; javaName = _javaName . get ( upper ) ; if ( javaName == null ) { String lookup = _mimeName . get ( upper ) ; if ( lookup != null ) javaName = _javaName . get ( lookup ) ; } if ( javaName == null ) javaName = upper ; _javaName . put ( encoding , javaName ) ; return javaName ; }
Returns the Java name for the given encoding .
134
9
140,147
public static String getJavaName ( Locale locale ) { if ( locale == null ) return null ; return getJavaName ( getMimeName ( locale ) ) ; }
Returns the Java name for the given locale .
36
9
140,148
private static String normalize ( String name ) { CharBuffer cb = new CharBuffer ( ) ; int len = name . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char ch = name . charAt ( i ) ; if ( Character . isLowerCase ( ch ) ) cb . append ( Character . toUpperCase ( ch ) ) ; else if ( ch == ' ' ) cb . append ( ' ' ) ; else cb . append ( ch ) ; } return cb . close ( ) ; }
Normalize the user s encoding name to avoid case issues .
119
12
140,149
public void fsync ( long sequence , K key , Result < Boolean > result ) { scheduleFsync ( sequence , key , result ) ; flush ( ) ; }
Request an fsync for the allocated sequence and request a flush to occur at the next service batch .
34
20
140,150
public void scheduleFsync ( long sequence , K key , Result < Boolean > result ) { _requestSequence = Math . max ( _requestSequence , sequence ) ; if ( sequence <= _tailSequence ) { result . ok ( Boolean . TRUE ) ; } else { _storeFsync . addResult ( key , result ) ; } }
Schedule an fsync for the given sequence but do not request a flush . The fsync can occur before the flush depending on other clients .
73
29
140,151
@ AfterBatch public void afterBatch ( ) { long requestSequence = _requestSequence ; if ( ! _isFsync ) { return ; } _isFsync = false ; try { _storeFsync . fsync ( ) ; /* if (_tailSequence < requestSequence) { _storeFsync.fsync(); } */ } catch ( Throwable e ) { e . printStackTrace ( ) ; } finally { _tailSequence = requestSequence ; } }
Completes any fsyncs in a batch .
106
11
140,152
public void stream ( OutputStream os , HeadersAmp headers , String from , long qId , String address , String methodName , PodRef podCaller , ResultStream < ? > result , Object [ ] args ) throws IOException { init ( os ) ; OutH3 out = _out ; if ( out == null ) { return ; } if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "hamp-stream-w " + methodName + ( args != null ? Arrays . asList ( args ) : "[]" ) + " {to:" + address + ", from:" + from + "}" ) ; } out . writeLong ( MessageTypeHamp . STREAM . ordinal ( ) ) ; writeHeaders ( out , headers ) ; writeFromAddress ( out , from ) ; out . writeLong ( qId ) ; writeMethod ( out , address , methodName , podCaller ) ; out . writeObject ( result ) ; writeArgs ( out , args ) ; //out.flushBuffer(); out . flush ( ) ; }
Sends a stream message to a given address
231
9
140,153
int insert ( Row row , byte [ ] sourceBuffer , int sourceOffset , BlobOutputStream [ ] blobs ) { int rowHead = _rowHead ; int blobTail = _blobTail ; int rowLength = row . length ( ) ; rowHead -= rowLength ; // return false if the block is full if ( rowHead < blobTail ) { return - 1 ; } byte [ ] buffer = _buffer ; System . arraycopy ( sourceBuffer , sourceOffset , buffer , rowHead , rowLength ) ; // XXX: timestamp buffer [ rowHead ] = ( byte ) ( ( buffer [ rowHead ] & ~ CODE_MASK ) | INSERT ) ; blobTail = row . insertBlobs ( buffer , rowHead , blobTail , blobs ) ; // System.out.println("HEXL: " + Hex.toHex(buffer, rowFirst, rowLength)); // if inline blobs can't fit, return false if ( blobTail < 0 ) { return - 1 ; } setBlobTail ( blobTail ) ; rowHead ( rowHead ) ; validateBlock ( row ) ; return rowHead ; }
Inserts a new row into the block .
248
9
140,154
boolean remove ( RowCursor cursor ) { int rowHead = _rowHead ; int blobTail = _blobTail ; rowHead -= cursor . removeLength ( ) ; if ( rowHead < blobTail ) { return false ; } byte [ ] buffer = _buffer ; // buffer[rowHead] = REMOVE; cursor . getRemove ( buffer , rowHead ) ; // cursor.getKey(buffer, rowHead + ColumnState.LENGTH); rowHead ( rowHead ) ; validateBlock ( cursor . row ( ) ) ; return true ; }
Removes a key by adding a remove entry to the row .
121
13
140,155
int findAndFill ( RowCursor cursor ) { int ptr = find ( cursor ) ; if ( ptr >= 0 ) { cursor . setRow ( _buffer , ptr ) ; cursor . setLeafBlock ( this , ptr ) ; } return ptr ; }
Searches for a row matching the cursor s key in the block . If the key is found fill the cursor with the row .
54
27
140,156
int find ( RowCursor cursor ) { int rowOffset = _rowHead ; int sortOffset = _rowSortHead ; int rowLength = cursor . length ( ) ; int removeLength = cursor . removeLength ( ) ; byte [ ] buffer = _buffer ; while ( rowOffset < sortOffset ) { int code = buffer [ rowOffset ] & CODE_MASK ; switch ( code ) { case INSERT : if ( cursor . compareKeyRow ( buffer , rowOffset ) == 0 ) { return rowOffset ; } else { rowOffset += rowLength ; break ; } case INSERT_DEAD : rowOffset += rowLength ; break ; case REMOVE : if ( cursor . compareKeyRemove ( buffer , rowOffset ) == 0 ) { // return PageLeafImpl.INDEX_REMOVED; return rowOffset ; } else { rowOffset += removeLength ; break ; } default : throw new IllegalStateException ( L . l ( "Corrupted block {0} offset {1} code {2}\n" , this , rowOffset , code ) ) ; } } if ( sortOffset < BLOCK_SIZE ) { return findSorted ( cursor ) ; } return PageLeafImpl . INDEX_UNMATCH ; }
Searches for a row matching the cursor s key .
262
12
140,157
boolean first ( RowCursor minCursor , RowCursor resultCursor , boolean isMatch ) { int ptr = _rowHead ; int rowLength = resultCursor . length ( ) ; int removeLength = resultCursor . removeLength ( ) ; int sortOffset = _rowSortHead ; byte [ ] buffer = _buffer ; while ( ptr < sortOffset ) { int code = buffer [ ptr ] & CODE_MASK ; int minCmp ; int cmp ; switch ( code ) { case INSERT : if ( ( minCmp = minCursor . compareKeyRow ( buffer , ptr ) ) <= 0 && ( ( cmp = resultCursor . compareKeyRow ( buffer , ptr ) ) > 0 || cmp == 0 && ! isMatch ) ) { fillMatch ( ptr , resultCursor ) ; if ( minCmp == 0 ) { return true ; } isMatch = true ; } ptr += rowLength ; break ; case INSERT_DEAD : ptr += rowLength ; break ; case REMOVE : if ( ( minCmp = minCursor . compareKeyRemove ( buffer , ptr ) ) <= 0 && ( ( cmp = resultCursor . compareKeyRemove ( buffer , ptr ) ) > 0 || cmp == 0 && ! isMatch ) ) { resultCursor . setRemove ( buffer , ptr ) ; //resultCursor.setKey(buffer, ptr + 1); if ( minCmp == 0 ) { return true ; } isMatch = true ; } ptr += removeLength ; break ; default : System . out . println ( "BROKEN_ENTRY:" ) ; return false ; } } if ( sortOffset < BLOCK_SIZE ) { return findFirstSorted ( minCursor , resultCursor , isMatch ) ; } else { return isMatch ; } }
Finds the row with the smallest key larger than minCursor and fills the cursor .
389
18
140,158
private boolean findFirstSorted ( RowCursor minCursor , RowCursor resultCursor , boolean isMatch ) { int rowOffset = _rowSortHead ; int rowLength = resultCursor . length ( ) ; int cmp = resultCursor . compareKey ( _keyMinSort , 0 ) ; if ( cmp < 0 || cmp == 0 && isMatch ) { return isMatch ; } int minCmp = minCursor . compareKey ( _keyMaxSort , 0 ) ; if ( minCmp > 0 ) { return isMatch ; } minCmp = minCursor . compareKey ( _keyMinSort , 0 ) ; if ( minCmp <= 0 ) { fillMatch ( BLOCK_SIZE - rowLength , resultCursor ) ; return true ; } int length = ( BLOCK_SIZE - rowOffset ) / rowLength - 1 ; // rowOffset += rowLength; while ( length > 0 ) { int pivot = length / 2 ; int pivotOffset = rowOffset + pivot * rowLength ; // if minCursor is in this block, test if the row is greater minCmp = minCursor . compareKeyRow ( _buffer , pivotOffset ) ; if ( minCmp == 0 ) { return fillMatch ( pivotOffset , resultCursor ) ; } else if ( minCmp > 0 ) { length = pivot ; continue ; } // test row against current min cmp = resultCursor . compareKeyRow ( _buffer , pivotOffset ) ; if ( cmp > 0 ) { // it's a better result, copy and search for smaller isMatch = true ; fillMatch ( pivotOffset , resultCursor ) ; } // search for smaller rowOffset = pivotOffset + rowLength ; length = length - pivot - 1 ; } return isMatch ; }
In a sorted block find the minimum key less than the currentResult and greater than the min .
382
19
140,159
byte [ ] getFirstKey ( TableKelp table ) { int keyOffset = table . getKeyOffset ( ) ; int keyLength = table . getKeyLength ( ) ; int offset = _rowHead + keyOffset ; byte [ ] key = new byte [ keyLength ] ; byte [ ] buffer = getBuffer ( ) ; System . arraycopy ( buffer , offset , key , 0 , keyLength ) ; return key ; }
Returns the first key in the block .
91
8
140,160
void fillEntryTree ( Set < PageLeafEntry > entries , Row row ) { int ptr = _rowHead ; byte [ ] buffer = _buffer ; while ( ptr < BLOCK_SIZE ) { int code = buffer [ ptr ] & CODE_MASK ; int len = getLength ( code , row ) ; if ( code == INSERT || code == REMOVE ) { PageLeafEntry entry = new PageLeafEntry ( this , row , ptr , len , code ) ; entries . add ( entry ) ; } ptr += len ; } }
Fills the entry tree map with entries from the block .
118
12
140,161
void validateBlock ( Row row ) { if ( ! row . getDatabase ( ) . isValidate ( ) ) { return ; } int rowHead = _rowHead ; int blobTail = _blobTail ; if ( rowHead < blobTail ) { throw new IllegalStateException ( this + " rowHead:" + rowHead + " blobTail:" + blobTail ) ; } int rowOffset = _rowHead ; byte [ ] buffer = _buffer ; while ( rowOffset < BLOCK_SIZE ) { int code = buffer [ rowOffset ] & CODE_MASK ; switch ( code ) { case INSERT : row . validate ( buffer , rowOffset , rowHead , blobTail ) ; break ; case INSERT_DEAD : case REMOVE : break ; default : throw new IllegalStateException ( this + " " + rowOffset + " " + code + " unknown code" ) ; } int len = getLength ( code , row ) ; if ( len < 0 || len + rowOffset > BLOCK_SIZE ) { throw new IllegalStateException ( this + " " + rowOffset + " code:" + code + " len:" + len + " invalid len" ) ; } rowOffset += len ; } }
Validate the block checking that row lengths and values are sensible .
264
13
140,162
void fillDeltaEntries ( Set < PageLeafEntry > entries , Row row , int tail ) { int rowOffset = _rowHead ; byte [ ] buffer = _buffer ; while ( rowOffset < tail ) { int code = buffer [ rowOffset ] & CODE_MASK ; int len = getLength ( code , row ) ; if ( code == INSERT || code == REMOVE ) { PageLeafEntry entry = new PageLeafEntry ( this , row , rowOffset , len , code ) ; entries . add ( entry ) ; } rowOffset += len ; } }
Fill the entry set from the tree map .
124
9
140,163
void writeCheckpointFull ( OutputStream os , int rowHead ) throws IOException { BitsUtil . writeInt16 ( os , _blobTail ) ; os . write ( _buffer , 0 , _blobTail ) ; rowHead = Math . max ( rowHead , _rowHead ) ; int rowLength = _buffer . length - rowHead ; BitsUtil . writeInt16 ( os , rowLength ) ; os . write ( _buffer , rowHead , rowLength ) ; }
Writes the block to the checkpoint stream .
107
9
140,164
void readCheckpointFull ( InputStream is ) throws IOException { _blobTail = BitsUtil . readInt16 ( is ) ; if ( _blobTail < 0 || _buffer . length < _blobTail ) { throw new IllegalStateException ( "Invalid blob tail: " + _blobTail //+ " pos=" + (is.getPosition() - 2) + " " + this ) ; } byte [ ] buffer = _buffer ; IoUtil . readAll ( is , buffer , 0 , _blobTail ) ; int rowLength = BitsUtil . readInt16 ( is ) ; rowHead ( _buffer . length - rowLength ) ; int rowHead = rowHead ( ) ; if ( rowHead < getBlobTail ( ) || buffer . length < rowHead ) { throw new IllegalStateException ( L . l ( "Invalid row-head={0} blob-tail={1}" , rowHead ( ) , getBlobTail ( ) ) ) ; } IoUtil . readAll ( is , buffer , rowHead , buffer . length - rowHead ) ; // validateBlock(row); }
Reads a full block checkpoint .
249
7
140,165
@ Override public void shutdown ( ShutdownModeAmp mode ) { QueryMap queryMap = _queryMapRef . get ( ) ; if ( queryMap != null ) { queryMap . close ( ) ; } }
Closes the mailbox
45
4
140,166
public void add ( int i ) { if ( _data . length <= _size ) expand ( _size + 1 ) ; _data [ _size ++ ] = i ; }
Adds an integer to the array .
37
7
140,167
public void add ( IntArray array ) { if ( _data . length <= array . _size ) expand ( _size + array . _size ) ; for ( int i = 0 ; i < array . _size ; i ++ ) _data [ _size ++ ] = array . _data [ i ] ; }
Appends the integers in array to the end of this array .
66
13
140,168
public void add ( int i , int value ) { expand ( _size + 1 ) ; System . arraycopy ( _data , i , _data , i + 1 , _size - i ) ; _data [ i ] = value ; _size ++ ; }
Inserts an integer into the array .
55
8
140,169
public void setLength ( int size ) { expand ( size ) ; for ( int i = _size ; i < size ; i ++ ) _data [ i ] = 0 ; _size = size ; }
Sets the length of the array filling with zero if necessary .
43
13
140,170
public boolean contains ( int test ) { int [ ] data = _data ; for ( int i = _size - 1 ; i >= 0 ; i -- ) { if ( data [ i ] == test ) return true ; } return false ; }
Returns true if the array contains and integer equal to test .
51
12
140,171
public boolean isSubset ( IntArray subset ) { int [ ] subData = subset . _data ; for ( int i = subset . _size - 1 ; i >= 0 ; i -- ) { if ( ! contains ( subData [ i ] ) ) return false ; } return true ; }
True if all the integers in subset are contained in the array .
62
13
140,172
public void union ( IntArray newArray ) { for ( int i = 0 ; i < newArray . _size ; i ++ ) { if ( ! contains ( newArray . _data [ i ] ) ) add ( newArray . _data [ i ] ) ; } }
Adds the members of newArray to the list if they are not already members of the array .
58
19
140,173
@ GET @ Path ( "{id}" ) public IAgreement getAgreementById ( @ PathParam ( "id" ) String agreementId ) throws NotFoundException { logger . debug ( "StartOf getAgreementById REQUEST for /agreements/" + agreementId ) ; AgreementHelperE agreementRestHelper = getAgreementHelper ( ) ; IAgreement agreement = agreementRestHelper . getAgreementByID ( agreementId ) ; if ( agreement == null ) { logger . info ( "getAgreementById NotFoundException: There is no agreement with id " + agreementId + " in the SLA Repository Database" ) ; throw new NotFoundException ( "There is no agreement with id " + agreementId + " in the SLA Repository Database" ) ; } logger . debug ( "EndOf getAgreementById" ) ; return agreement ; }
Gets the information of an specific agreement . If the agreement it is not in the database it returns 404 with empty payload
181
24
140,174
@ GET @ Path ( "{id}/context" ) public eu . atos . sla . parser . data . wsag . Context getAgreementContextById ( @ PathParam ( "id" ) String agreementId ) throws NotFoundException , InternalException { logger . debug ( "StartOf getAgreementContextById REQUEST for /agreements/{}/context" , agreementId ) ; AgreementHelperE agreementRestHelper = getAgreementHelper ( ) ; eu . atos . sla . parser . data . wsag . Context context ; try { context = agreementRestHelper . getAgreementContextByID ( agreementId ) ; } catch ( InternalHelperException e ) { logger . error ( "getAgreementContextById InternalException" , e ) ; throw new InternalException ( e . getMessage ( ) ) ; } if ( context == null ) { logger . info ( "getAgreementContextById NotFoundException: There is no agreement with id " + agreementId + " in the SLA Repository Database" ) ; throw new NotFoundException ( "There is no agreement with id " + agreementId + " in the SLA Repository Database" ) ; } logger . debug ( "EndOf getAgreementContextById" ) ; return context ; }
Gets the context information of an specific agreement .
271
10
140,175
public static PollTcpManager createJni ( ) { try { /* Class<?> jniSelectManager = SelectManagerJni.class; Method method = jniSelectManager.getMethod("create"); */ return ( PollTcpManager ) SelectManagerJni . create ( ) ; } catch ( Throwable e ) { // catch Throwable because of possible linking errors log . finer ( e . toString ( ) ) ; } return null ; }
Sets the timeout .
94
5
140,176
public void onFail ( ) { _lastFailTime = CurrentTime . currentTime ( ) ; if ( _firstFailTime == 0 ) { _firstFailTime = _lastFailTime ; } _firstSuccessTime = 0 ; toState ( State . FAIL ) ; long recoverTimeout = _dynamicRecoverTimeout . get ( ) ; long nextRecoverTimeout = Math . min ( recoverTimeout + 1000L , _recoverTimeout ) ; _dynamicRecoverTimeout . compareAndSet ( recoverTimeout , nextRecoverTimeout ) ; }
Called when the connection fails .
115
7
140,177
public boolean startConnection ( ) { State state = _state . get ( ) ; if ( state . isActive ( ) ) { // when active, always start a connection _connectionCount . incrementAndGet ( ) ; return true ; } long now = CurrentTime . currentTime ( ) ; long lastFailTime = _lastFailTime ; long recoverTimeout = _dynamicRecoverTimeout . get ( ) ; if ( now < lastFailTime + recoverTimeout ) { // if the fail recover hasn't timed out, return false return false ; } // when fail, only start a single connection int count ; do { count = _connectionCount . get ( ) ; if ( count > 0 ) { return false ; } } while ( ! _connectionCount . compareAndSet ( count , count + 1 ) ) ; return true ; }
Start a new connection . Returns true if the connection can be started .
172
14
140,178
public void addShort ( int offset , int value ) { insertCode ( offset , 2 ) ; _code . set ( offset + 0 , value >> 8 ) ; _code . set ( offset + 1 , value ) ; }
Adds a short to the code .
47
7
140,179
public void add ( int offset , byte [ ] buffer , int bufOffset , int length ) { insertCode ( offset , length ) ; _code . set ( offset , buffer , bufOffset , length ) ; }
Adds a byte to the code .
44
7
140,180
public void update ( ) { byte [ ] code = new byte [ _code . size ( ) ] ; System . arraycopy ( _code . getBuffer ( ) , 0 , code , 0 , _code . size ( ) ) ; _codeAttr . setCode ( code ) ; if ( _changeLength ) { // XXX: really need more sophisticated solution ArrayList < Attribute > attrList = getCodeAttribute ( ) . getAttributes ( ) ; for ( int i = attrList . size ( ) - 1 ; i >= 0 ; i -- ) { Attribute attr = attrList . get ( i ) ; if ( attr . getName ( ) . equals ( "LineNumberTable" ) ) attrList . remove ( i ) ; } } }
Updates the code .
164
5
140,181
public ServiceRefAmp createLinkService ( String path , PodRef podCaller ) { StubLink actorLink ; String address = _scheme + "//" + _serviceRefOut . address ( ) + path ; ServiceRefAmp parentRef = _actorOut . getServiceRef ( ) ; if ( _queryMapRef != null ) { //String addressSelf = "/system"; //ServiceRefAmp systemRef = _manager.getSystemInbox().getServiceRef(); actorLink = new StubLinkUnidir ( _manager , path , parentRef , _queryMapRef , podCaller , _actorOut ) ; } else { actorLink = new StubLink ( _manager , path , parentRef , podCaller , _actorOut ) ; } ServiceRefAmp linkRef = _serviceRefOut . pin ( actorLink , address ) ; // ServiceRefClient needed to maintain workers, cloud/0420 ServiceRefAmp clientRef = new ServiceRefClient ( address , linkRef . stub ( ) , linkRef . inbox ( ) ) ; actorLink . initSelfRef ( clientRef ) ; return clientRef ; }
Return the serviceRef for a foreign path and calling pod .
239
12
140,182
public long get ( ) { long now = CurrentTime . currentTime ( ) / 1000 ; long oldSequence ; long newSequence ; do { oldSequence = _sequence . get ( ) ; long oldTime = oldSequence >>> _timeOffset ; if ( oldTime != now ) { newSequence = ( ( now << _timeOffset ) + ( randomLong ( ) & _sequenceRandomMask ) ) ; } else { // relatively prime increment will use the whole sequence space newSequence = oldSequence + _sequenceIncrement ; } } while ( ! _sequence . compareAndSet ( oldSequence , newSequence ) ) ; long id = ( ( now << _timeOffset ) | _node | ( newSequence & _sequenceMask ) ) ; return id ; }
Returns the next id .
166
5
140,183
public static KbServerSideException fromThrowable ( Throwable cause ) { return ( cause instanceof KbServerSideException ) ? ( KbServerSideException ) cause : new KbServerSideException ( cause ) ; }
Converts a Throwable to a KbServerSideException . If the Throwable is a KbServerSideException it will be passed through unmodified ; otherwise it will be wrapped in a new KbServerSideException .
48
46
140,184
public static KbServerSideException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof KbServerSideException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( KbServerSideException ) cause : new KbServerSideException ( message , cause ) ; }
Converts a Throwable to a KbServerSideException with the specified detail message . If the Throwable is a KbServerSideException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new KbServerSideException with the detail message .
67
70
140,185
public static KbTypeConflictException fromThrowable ( Throwable cause ) { return ( cause instanceof KbTypeConflictException ) ? ( KbTypeConflictException ) cause : new KbTypeConflictException ( cause ) ; }
Converts a Throwable to a KbTypeConflictException . If the Throwable is a KbTypeConflictException it will be passed through unmodified ; otherwise it will be wrapped in a new KbTypeConflictException .
52
49
140,186
public static KbTypeConflictException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof KbTypeConflictException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( KbTypeConflictException ) cause : new KbTypeConflictException ( message , cause ) ; }
Converts a Throwable to a KbTypeConflictException with the specified detail message . If the Throwable is a KbTypeConflictException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new KbTypeConflictException with the detail message .
71
73
140,187
protected static String intsToCommaDelimitedString ( int [ ] ints ) { if ( ints == null ) { return "" ; } StringBuilder result = new StringBuilder ( ) ; for ( int i = 0 ; i < ints . length ; i ++ ) { result . append ( ints [ i ] ) ; if ( i < ( ints . length - 1 ) ) { result . append ( ", " ) ; } } return result . toString ( ) ; }
Convert an array of ints into a comma delimited string
104
13
140,188
public void init ( FilterConfig filterConfig ) throws ServletException { String comaDelimitedSecuredRemoteAddresses = filterConfig . getInitParameter ( SECURED_REMOTE_ADDRESSES_PARAMETER ) ; if ( comaDelimitedSecuredRemoteAddresses != null ) { setSecuredRemoteAdresses ( comaDelimitedSecuredRemoteAddresses ) ; } }
Compile the secured remote addresses patterns .
85
8
140,189
public static QueryException fromThrowable ( Throwable cause ) { return ( cause instanceof QueryException ) ? ( QueryException ) cause : new QueryException ( cause ) ; }
Converts a Throwable to a QueryException . If the Throwable is a QueryException it will be passed through unmodified ; otherwise it will be wrapped in a new QueryException .
36
37
140,190
public static QueryException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof QueryException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( QueryException ) cause : new QueryException ( message , cause ) ; }
Converts a Throwable to a QueryException with the specified detail message . If the Throwable is a QueryException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new QueryException with the detail message .
55
61
140,191
public static SessionServiceException fromThrowable ( Class interfaceClass , Throwable cause ) { return ( cause instanceof SessionServiceException && Objects . equals ( interfaceClass , ( ( SessionServiceException ) cause ) . getInterfaceClass ( ) ) ) ? ( SessionServiceException ) cause : new SessionServiceException ( interfaceClass , cause ) ; }
Converts a Throwable to a SessionServiceException . If the Throwable is a SessionServiceException it will be passed through unmodified ; otherwise it will be wrapped in a new SessionServiceException .
70
40
140,192
public static SessionServiceException fromThrowable ( Class interfaceClass , String message , Throwable cause ) { return ( cause instanceof SessionServiceException && Objects . equals ( interfaceClass , ( ( SessionServiceException ) cause ) . getInterfaceClass ( ) ) && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( SessionServiceException ) cause : new SessionServiceException ( interfaceClass , message , cause ) ; }
Converts a Throwable to a SessionServiceException with the specified detail message . If the Throwable is a SessionServiceException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new SessionServiceException with the detail message .
89
64
140,193
public static KbTypeException fromThrowable ( Throwable cause ) { return ( cause instanceof KbTypeException ) ? ( KbTypeException ) cause : new KbTypeException ( cause ) ; }
Converts a Throwable to a KbTypeException . If the Throwable is a KbTypeException it will be passed through unmodified ; otherwise it will be wrapped in a new KbTypeException .
44
43
140,194
public static KbTypeException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof KbTypeException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( KbTypeException ) cause : new KbTypeException ( message , cause ) ; }
Converts a Throwable to a KbTypeException with the specified detail message . If the Throwable is a KbTypeException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new KbTypeException with the detail message .
63
67
140,195
public static SessionCommunicationException fromThrowable ( Throwable cause ) { return ( cause instanceof SessionCommunicationException ) ? ( SessionCommunicationException ) cause : new SessionCommunicationException ( cause ) ; }
Converts a Throwable to a SessionCommunicationException . If the Throwable is a SessionCommunicationException it will be passed through unmodified ; otherwise it will be wrapped in a new SessionCommunicationException .
44
43
140,196
public static SessionCommunicationException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof SessionCommunicationException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( SessionCommunicationException ) cause : new SessionCommunicationException ( message , cause ) ; }
Converts a Throwable to a SessionCommunicationException with the specified detail message . If the Throwable is a SessionCommunicationException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new SessionCommunicationException with the detail message .
63
67
140,197
public static QueryConstructionException fromThrowable ( Throwable cause ) { return ( cause instanceof QueryConstructionException ) ? ( QueryConstructionException ) cause : new QueryConstructionException ( cause ) ; }
Converts a Throwable to a QueryConstructionException . If the Throwable is a QueryConstructionException it will be passed through unmodified ; otherwise it will be wrapped in a new QueryConstructionException .
40
40
140,198
public static QueryConstructionException fromThrowable ( String message , Throwable cause ) { return ( cause instanceof QueryConstructionException && Objects . equals ( message , cause . getMessage ( ) ) ) ? ( QueryConstructionException ) cause : new QueryConstructionException ( message , cause ) ; }
Converts a Throwable to a QueryConstructionException with the specified detail message . If the Throwable is a QueryConstructionException and if the Throwable s message is identical to the one supplied the Throwable will be passed through unmodified ; otherwise it will be wrapped in a new QueryConstructionException with the detail message .
59
64
140,199
public static SessionManagerException fromThrowable ( Throwable cause ) { return ( cause instanceof SessionManagerException ) ? ( SessionManagerException ) cause : new SessionManagerException ( cause ) ; }
Converts a Throwable to a SessionManagerException . If the Throwable is a SessionManagerException it will be passed through unmodified ; otherwise it will be wrapped in a new SessionManagerException .
40
40