idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
22,200 | public boolean replaceInterceptor ( CommandInterceptor replacingInterceptor , Class < ? extends CommandInterceptor > toBeReplacedInterceptorType ) { return asyncInterceptorChain . replaceInterceptor ( replacingInterceptor , toBeReplacedInterceptorType ) ; } | Replaces an existing interceptor of the given type in the interceptor chain with a new interceptor instance passed as parameter . |
22,201 | public Object invoke ( InvocationContext ctx , VisitableCommand command ) { return asyncInterceptorChain . invoke ( ctx , command ) ; } | Walks the command through the interceptor chain . The received ctx is being passed in . |
22,202 | public List < CommandInterceptor > getInterceptorsWhichExtend ( Class < ? extends CommandInterceptor > interceptorClass ) { ArrayList < CommandInterceptor > list = new ArrayList < > ( asyncInterceptorChain . getInterceptors ( ) . size ( ) ) ; asyncInterceptorChain . getInterceptors ( ) . forEach ( ci -> { if ( intercep... | Returns all interceptors which extend the given command interceptor . |
22,203 | public List < CommandInterceptor > getInterceptorsWithClass ( Class clazz ) { ArrayList < CommandInterceptor > list = new ArrayList < > ( asyncInterceptorChain . getInterceptors ( ) . size ( ) ) ; asyncInterceptorChain . getInterceptors ( ) . forEach ( ci -> { if ( clazz == ci . getClass ( ) ) { list . add ( ( CommandI... | Returns all the interceptors that have the fully qualified name of their class equal with the supplied class name . |
22,204 | void store ( Index . IndexSpace indexSpace ) throws IOException { this . offset = indexSpace . offset ; this . occupiedSpace = indexSpace . length ; ByteBuffer buffer = ByteBuffer . allocate ( length ( ) ) ; buffer . putShort ( ( short ) prefix . length ) ; buffer . put ( prefix ) ; byte flags = 0 ; if ( innerNodes != ... | called only internally or for root |
22,205 | public EntryRecord getRecord ( Object key , byte [ ] serializedKey ) throws IOException { int segment = ( key . hashCode ( ) & Integer . MAX_VALUE ) % segments . length ; lock . readLock ( ) . lock ( ) ; try { return IndexNode . applyOnLeaf ( segments [ segment ] , serializedKey , segments [ segment ] . rootReadLock ( ... | Get record or null if expired |
22,206 | public EntryPosition getPosition ( Object key , byte [ ] serializedKey ) throws IOException { int segment = ( key . hashCode ( ) & Integer . MAX_VALUE ) % segments . length ; lock . readLock ( ) . lock ( ) ; try { return IndexNode . applyOnLeaf ( segments [ segment ] , serializedKey , segments [ segment ] . rootReadLoc... | Get position or null if expired |
22,207 | public EntryInfo getInfo ( Object key , byte [ ] serializedKey ) throws IOException { int segment = ( key . hashCode ( ) & Integer . MAX_VALUE ) % segments . length ; lock . readLock ( ) . lock ( ) ; try { return IndexNode . applyOnLeaf ( segments [ segment ] , serializedKey , segments [ segment ] . rootReadLock ( ) , ... | Get position + numRecords without expiration |
22,208 | public static < MK , K , V > AtomicMap < K , V > getAtomicMap ( Cache < MK , ? > cache , MK key ) { return getAtomicMap ( cache , key , true ) ; } | Retrieves an atomic map from a given cache stored under a given key . If an atomic map did not exist one is created and registered in an atomic fashion . |
22,209 | public static < MK , K , V > FineGrainedAtomicMap < K , V > getFineGrainedAtomicMap ( Cache < MK , ? > cache , MK key ) { return getFineGrainedAtomicMap ( cache , key , true ) ; } | Retrieves a fine grained atomic map from a given cache stored under a given key . If a fine grained atomic map did not exist one is created and registered in an atomic fashion . |
22,210 | public static < MK , K , V > Map < K , V > getReadOnlyAtomicMap ( Cache < MK , ? > cache , MK key ) { AtomicMap < K , V > am = getAtomicMap ( cache , key , false ) ; if ( am == null ) return Collections . emptyMap ( ) ; else return immutableMapWrap ( am ) ; } | Retrieves an atomic map from a given cache stored under a given key for reading only . The atomic map returned will not support updates and if the map did not in fact exist an empty map is returned . |
22,211 | public static < MK > void removeAtomicMap ( Cache < MK , ? > cache , MK key ) { FineGrainedAtomicMapProxyImpl . removeMap ( ( Cache < Object , Object > ) cache , key ) ; } | Removes the atomic map associated with the given key from the underlying cache . |
22,212 | public < T > T invoke ( Object receiver , CreationalContext < T > creationalContext ) { return invoke ( receiver , creationalContext , null ) ; } | Invoke the method causing all parameters to be injected according to the CDI type safe resolution rules . |
22,213 | public < T > T invoke ( Object receiver , CreationalContext < T > creationalContext , ParameterValueRedefiner redefinition ) { List < Object > parameterValues = new ArrayList < Object > ( ) ; for ( int i = 0 ; i < getParameters ( ) . size ( ) ; i ++ ) { if ( redefinition != null ) { ParameterValueRedefiner . ParameterV... | Invoke the method calling the parameter redefiner for each parameter allowing the caller to override the default value obtained via the CDI type safe resolver . |
22,214 | public static Duration getExpiry ( ExpiryPolicy policy , Operation op ) { if ( policy == null ) { return getDefaultDuration ( ) ; } switch ( op ) { case CREATION : try { return policy . getExpiryForCreation ( ) ; } catch ( Throwable t ) { log . getExpiryHasThrown ( t ) ; return getDefaultDuration ( ) ; } case ACCESS : ... | Return expiry for a given cache operation . It returns null when the expiry time cannot be determined in which case clients should not update expiry settings for the cached entry . |
22,215 | public static < K , V > KeyAffinityService < K > newLocalKeyAffinityService ( Cache < K , V > cache , KeyGenerator < K > keyGenerator , Executor ex , int keyBufferSize , boolean start ) { Address localAddress = cache . getAdvancedCache ( ) . getRpcManager ( ) . getTransport ( ) . getAddress ( ) ; Collection < Address >... | Created an service that only generates keys for the local address . |
22,216 | public static Optional < byte [ ] > readOptRangedBytes ( ByteBuf bf ) { int length = SignedNumeric . decode ( readUnsignedInt ( bf ) ) ; return length < 0 ? Optional . empty ( ) : Optional . of ( readRangedBytes ( bf , length ) ) ; } | Reads optional range of bytes . Negative lengths are translated to None 0 length represents empty Array |
22,217 | public static Optional < String > readOptString ( ByteBuf bf ) { Optional < byte [ ] > bytes = readOptRangedBytes ( bf ) ; return bytes . map ( b -> new String ( b , CharsetUtil . UTF_8 ) ) ; } | Reads an optional String . 0 length is an empty string negative length is translated to None . |
22,218 | public static Optional < Byte > readMaybeByte ( ByteBuf bf ) { if ( bf . readableBytes ( ) >= 1 ) { return Optional . of ( bf . readByte ( ) ) ; } else { bf . resetReaderIndex ( ) ; return Optional . empty ( ) ; } } | Reads a byte if possible . If not present the reader index is reset to the last mark . |
22,219 | public static Optional < Long > readMaybeVLong ( ByteBuf bf ) { if ( bf . readableBytes ( ) >= 1 ) { byte b = bf . readByte ( ) ; return read ( bf , b , 7 , ( long ) b & 0x7F , 1 ) ; } else { bf . resetReaderIndex ( ) ; return Optional . empty ( ) ; } } | Reads a variable long if possible . If not present the reader index is reset to the last mark . |
22,220 | public static Optional < Integer > readMaybeVInt ( ByteBuf bf ) { if ( bf . readableBytes ( ) >= 1 ) { byte b = bf . readByte ( ) ; return read ( bf , b , 7 , b & 0x7F , 1 ) ; } else { bf . resetReaderIndex ( ) ; return Optional . empty ( ) ; } } | Reads a variable size int if possible . If not present the reader index is reset to the last mark . |
22,221 | public static Optional < byte [ ] > readMaybeRangedBytes ( ByteBuf bf ) { Optional < Integer > length = readMaybeVInt ( bf ) ; if ( length . isPresent ( ) ) { int l = length . get ( ) ; if ( bf . readableBytes ( ) >= l ) { if ( l > 0 ) { byte [ ] array = new byte [ l ] ; bf . readBytes ( array ) ; return Optional . of ... | Reads a range of bytes if possible . If not present the reader index is reset to the last mark . |
22,222 | public static Optional < String > readMaybeString ( ByteBuf bf ) { Optional < byte [ ] > bytes = readMaybeRangedBytes ( bf ) ; return bytes . map ( b -> { if ( b . length == 0 ) return "" ; else return new String ( b , CharsetUtil . UTF_8 ) ; } ) ; } | Reads a string if possible . If not present the reader index is reset to the last mark . |
22,223 | public void deadlockCheck ( DeadlockChecker deadlockChecker ) { if ( deadlockChecker == null ) { return ; } LockPlaceHolder holder = current ; if ( holder != null ) { for ( LockPlaceHolder pending : pendingRequest ) { pending . checkDeadlock ( deadlockChecker , holder . owner ) ; } } } | It forces a deadlock checking . |
22,224 | private void indexMissingFields ( ) { for ( FieldDescriptor fieldDescriptor : messageContext . getMessageDescriptor ( ) . getFields ( ) ) { if ( ! messageContext . isFieldMarked ( fieldDescriptor . getNumber ( ) ) ) { Object defaultValue = fieldDescriptor . getJavaType ( ) == JavaType . MESSAGE || fieldDescriptor . has... | All fields that were not seen until the end of this message are missing and will be indexed with their default value or null if none was declared . The null value is replaced with a special null token placeholder because Lucene cannot index nulls . |
22,225 | public void addRegion ( InfinispanBaseRegion region ) { allRegions . put ( ByteString . fromString ( region . getCache ( ) . getName ( ) ) , region ) ; } | Add region so that commands can be cleared on shutdown . |
22,226 | public void clearRegions ( Collection < ? extends InfinispanBaseRegion > regions ) { regions . forEach ( region -> allRegions . remove ( ByteString . fromString ( region . getCache ( ) . getName ( ) ) ) ) ; } | Clear all regions from this command factory . |
22,227 | public SitesConfigurationBuilder addInUseBackupSite ( String site ) { Set < String > sites = attributes . attribute ( IN_USE_BACKUP_SITES ) . get ( ) ; sites . add ( site ) ; attributes . attribute ( IN_USE_BACKUP_SITES ) . set ( sites ) ; return this ; } | Defines the site names from the list of sites names defined within backups element to which this cache backups its data . |
22,228 | public void registerMBeans ( Collection < ResourceDMBean > resourceDMBeans ) throws CacheException { try { for ( ResourceDMBean resource : resourceDMBeans ) JmxUtil . registerMBean ( resource , getObjectName ( resource ) , mBeanServer ) ; } catch ( Exception e ) { throw new CacheException ( "Failure while registering m... | Performs the MBean registration . |
22,229 | protected RocksDB openDatabase ( String location , Options options ) throws IOException , RocksDBException { File dir = new File ( location ) ; dir . mkdirs ( ) ; return RocksDB . open ( options , location ) ; } | Creates database if it doesn t exist . |
22,230 | public static String decodeVersionForSerialization ( short version ) { int major = ( version & MAJOR_MASK ) >> MAJOR_SHIFT ; int minor = ( version & MINOR_MASK ) >> MINOR_SHIFT ; return major + "." + minor ; } | Serialization only looks at major and minor not micro or below . |
22,231 | public static void printFullVersionInformation ( ) { System . out . println ( INSTANCE . brandname ) ; System . out . println ( ) ; System . out . printf ( "Version: \t%s%n" , INSTANCE . version ) ; System . out . printf ( "Codename: \t%s%n" , INSTANCE . codename ) ; System . out . println ( ) ; } | Prints full version information to the standard output . |
22,232 | public static Set < Annotation > buildQualifiers ( Set < Annotation > annotations ) { Set < Annotation > qualifiers = new HashSet < Annotation > ( annotations ) ; if ( annotations . isEmpty ( ) ) { qualifiers . add ( DefaultLiteral . INSTANCE ) ; } qualifiers . add ( AnyLiteral . INSTANCE ) ; return qualifiers ; } | Returns a new set with |
22,233 | public static < X > List < InjectionPoint > createInjectionPoints ( AnnotatedMethod < X > method , Bean < ? > declaringBean , BeanManager beanManager ) { List < InjectionPoint > injectionPoints = new ArrayList < InjectionPoint > ( ) ; for ( AnnotatedParameter < X > parameter : method . getParameters ( ) ) { InjectionPo... | Given a method and the bean on which the method is declared create a collection of injection points representing the parameters of the method . |
22,234 | public boolean containsAll ( Param < ? > ... ps ) { List < Param < ? > > paramsToCheck = Arrays . asList ( ps ) ; List < Param < ? > > paramsCurrent = Arrays . asList ( params ) ; return paramsCurrent . containsAll ( paramsToCheck ) ; } | Checks whether all the parameters passed in are already present in the current parameters . This method can be used to optimise the decision on whether the parameters collection needs updating at all . |
22,235 | public Params addAll ( Param < ? > ... ps ) { List < Param < ? > > paramsToAdd = Arrays . asList ( ps ) ; Param < ? > [ ] paramsAll = Arrays . copyOf ( params , params . length ) ; paramsToAdd . forEach ( p -> paramsAll [ p . id ( ) ] = p ) ; return new Params ( paramsAll ) ; } | Adds all parameters and returns a new parameter collection . |
22,236 | public long toFlagsBitSet ( ) { PersistenceMode persistenceMode = ( PersistenceMode ) params [ PersistenceMode . ID ] . get ( ) ; LockingMode lockingMode = ( LockingMode ) params [ LockingMode . ID ] . get ( ) ; ExecutionMode executionMode = ( ExecutionMode ) params [ ExecutionMode . ID ] . get ( ) ; StatisticsMode sta... | Bridging method between flags and params provided for efficient checks . |
22,237 | public ContextualReference < T > create ( CreationalContext < T > ctx ) { if ( this . instance != null ) { throw new IllegalStateException ( "Trying to call create() on already constructed instance" ) ; } if ( disposed ) { throw new IllegalStateException ( "Trying to call create() on an already disposed instance" ) ; }... | Create the instance |
22,238 | public ContextualReference < T > destroy ( CreationalContext < T > ctx ) { if ( this . instance == null ) { throw new IllegalStateException ( "Trying to call destroy() before create() was called" ) ; } if ( disposed ) { throw new IllegalStateException ( "Trying to call destroy() on already disposed instance" ) ; } this... | destroy the bean |
22,239 | protected static Consumer < Supplier < PrimitiveIterator . OfInt > > composeWithExceptions ( Consumer < Supplier < PrimitiveIterator . OfInt > > a , Consumer < Supplier < PrimitiveIterator . OfInt > > b ) { return ( segments ) -> { try { a . accept ( segments ) ; } catch ( Throwable e1 ) { try { b . accept ( segments )... | Given two SegmentCompletionListener return a SegmentCompletionListener that executes both in sequence even if the first throws an exception and if both throw exceptions add any exceptions thrown by the second as suppressed exceptions of the first . |
22,240 | public void acquireLock ( Object key , boolean exclusive ) { ReentrantReadWriteLock lock = getLock ( key ) ; if ( exclusive ) { lock . writeLock ( ) . lock ( ) ; if ( trace ) log . tracef ( "WL acquired for '%s'" , key ) ; } else { lock . readLock ( ) . lock ( ) ; if ( trace ) log . tracef ( "RL acquired for '%s'" , ke... | Blocks until a lock is acquired . |
22,241 | public void releaseLock ( Object key ) { ReentrantReadWriteLock lock = getLock ( key ) ; if ( lock . isWriteLockedByCurrentThread ( ) ) { lock . writeLock ( ) . unlock ( ) ; if ( trace ) log . tracef ( "WL released for '%s'" , key ) ; } else { lock . readLock ( ) . unlock ( ) ; if ( trace ) log . tracef ( "RL released ... | Releases a lock the caller may be holding . This method is idempotent . |
22,242 | public int getTotalLockCount ( ) { int count = 0 ; for ( ReentrantReadWriteLock lock : sharedLocks ) { count += lock . getReadLockCount ( ) ; count += lock . isWriteLocked ( ) ? 1 : 0 ; } return count ; } | Returns the total number of locks held by this class . |
22,243 | public boolean acquireGlobalLock ( boolean exclusive , long timeout ) { log . tracef ( "About to acquire global lock. Exclusive? %s" , exclusive ) ; boolean success = true ; for ( int i = 0 ; i < sharedLocks . length ; i ++ ) { Lock toAcquire = exclusive ? sharedLocks [ i ] . writeLock ( ) : sharedLocks [ i ] . readLoc... | Acquires RL on all locks aggregated by this StripedLock in the given timeout . |
22,244 | public static < T > Set < T > asSet ( T ... array ) { Set < T > result = new HashSet < T > ( ) ; for ( T a : array ) { result . add ( a ) ; } return result ; } | Create a set from an array . If the array contains duplicate objects the last object in the array will be placed in resultant set . |
22,245 | protected CompletionStage < ValidResponse > singleWriteOnRemotePrimary ( Address target , DataWriteCommand command ) { return rpcManager . invokeCommand ( target , command , SingleResponseCollector . validOnly ( ) , rpcManager . getSyncRpcOptions ( ) ) ; } | This method is called by a non - owner sending write request to the primary owner |
22,246 | public static Object convertTextToText ( Object source , MediaType sourceType , MediaType destinationType ) { if ( source == null ) return null ; if ( sourceType == null ) throw new NullPointerException ( "MediaType cannot be null!" ) ; if ( ! sourceType . match ( MediaType . TEXT_PLAIN ) ) throw log . invalidMediaType... | Convert text content to a different encoding . |
22,247 | public static byte [ ] convertTextToOctetStream ( Object source , MediaType sourceType ) { if ( source == null ) return null ; if ( sourceType == null ) { throw new NullPointerException ( "MediaType cannot be null!" ) ; } if ( source instanceof byte [ ] ) return ( byte [ ] ) source ; return source . toString ( ) . getB... | Converts text content to binary . |
22,248 | public static byte [ ] convertJavaToOctetStream ( Object source , MediaType sourceMediaType , Marshaller marshaller ) throws IOException , InterruptedException { if ( source == null ) return null ; if ( ! sourceMediaType . match ( MediaType . APPLICATION_OBJECT ) ) { throw new EncodingException ( "destination MediaType... | Converts a java object to a sequence of bytes applying standard java serialization . |
22,249 | public final void rollbackRemoteTransaction ( GlobalTransaction gtx ) { RpcManager rpcManager = cache . getRpcManager ( ) ; CommandsFactory factory = cache . getComponentRegistry ( ) . getCommandsFactory ( ) ; try { RollbackCommand rollbackCommand = factory . buildRollbackCommand ( gtx ) ; rollbackCommand . setTopology... | Rollbacks a transaction that is remove in all the cluster members . |
22,250 | public boolean startTransaction ( ) { EmbeddedTransaction tx = new EmbeddedTransaction ( EmbeddedTransactionManager . getInstance ( ) ) ; tx . setXid ( xid ) ; LocalTransaction localTransaction = transactionTable . getOrCreateLocalTransaction ( tx , false , this :: newGlobalTransaction ) ; if ( createGlobalState ( loca... | Starts a transaction . |
22,251 | public int rollback ( ) { loggingDecision ( false ) ; try { tx . rollback ( ) ; } catch ( SystemException e ) { } finally { perCacheTxTable . removeLocalTx ( xid ) ; } loggingCompleted ( false ) ; return XAException . XA_RBROLLBACK ; } | Rollbacks the transaction if an exception happens during the transaction execution . |
22,252 | public int prepare ( boolean onePhaseCommit ) { Status status = loggingPreparing ( ) ; if ( status != Status . OK ) { return XAException . XA_RBROLLBACK ; } boolean prepared = tx . runPrepare ( ) ; if ( prepared ) { if ( onePhaseCommit ) { return onePhaseCommitTransaction ( ) ; } else { status = loggingPrepared ( ) ; r... | Prepares the transaction . |
22,253 | public < K , V > AdvancedCache < K , V > decorateCache ( AdvancedCache < K , V > cache ) { return cache . transform ( this :: transform ) ; } | Decorates the cache with the transaction created . |
22,254 | public int onePhaseCommitRemoteTransaction ( GlobalTransaction gtx , List < WriteCommand > modifications ) { RpcManager rpcManager = cache . getRpcManager ( ) ; CommandsFactory factory = cache . getComponentRegistry ( ) . getCommandsFactory ( ) ; try { PrepareCommand command = factory . buildPrepareCommand ( gtx , modi... | Commits a remote 1PC transaction that is already in MARK_COMMIT state |
22,255 | private void forgetTransaction ( GlobalTransaction gtx , RpcManager rpcManager , CommandsFactory factory ) { TxCompletionNotificationCommand cmd = factory . buildTxCompletionNotificationCommand ( xid , gtx ) ; rpcManager . sendToAll ( cmd , DeliverOrder . NONE ) ; perCacheTxTable . removeLocalTx ( xid ) ; globalTxTable... | Forgets the transaction cluster - wise and from global and local transaction tables . |
22,256 | public static void addToCache ( AdvancedCache cache , PutFromLoadValidator validator ) { AsyncInterceptorChain chain = cache . getAsyncInterceptorChain ( ) ; List < AsyncInterceptor > interceptors = chain . getInterceptors ( ) ; log . debugf ( "Interceptor chain was: " , interceptors ) ; int position = 0 ; int entryWra... | Besides the call from constructor this should be called only from tests when mocking the validator . |
22,257 | public static PutFromLoadValidator removeFromCache ( AdvancedCache cache ) { AsyncInterceptorChain chain = cache . getAsyncInterceptorChain ( ) ; BasicComponentRegistry cr = cache . getComponentRegistry ( ) . getComponent ( BasicComponentRegistry . class ) ; chain . removeInterceptor ( TxPutFromLoadInterceptor . class ... | This methods should be called only from tests ; it removes existing validator from the cache structures in order to replace it with new one . |
22,258 | public void endInvalidatingRegion ( ) { synchronized ( this ) { if ( -- regionInvalidations == 0 ) { regionInvalidationTimestamp = timeSource . nextTimestamp ( ) ; if ( trace ) { log . tracef ( "Finished invalidating region %s at %d" , cache . getName ( ) , regionInvalidationTimestamp ) ; } } else { if ( trace ) { log ... | Called when the region invalidation is finished . |
22,259 | public HotRodServerConfigurationBuilder proxyHost ( String proxyHost ) { attributes . attribute ( PROXY_HOST ) . set ( proxyHost ) ; return this ; } | Sets the external address of this node i . e . the address which clients will connect to |
22,260 | public void match ( Object userContext , Object eventType , Object instance ) { if ( instance == null ) { throw new IllegalArgumentException ( "instance cannot be null" ) ; } read . lock ( ) ; try { MatcherEvalContext < TypeMetadata , AttributeMetadata , AttributeId > ctx = startMultiTypeContext ( false , userContext ,... | Executes the registered filters and notifies each one of them whether it was satisfied or not by the given instance . |
22,261 | private Type resolveType ( Type beanType , Type beanType2 , Type type ) { if ( type instanceof ParameterizedType ) { if ( beanType instanceof ParameterizedType ) { return resolveParameterizedType ( ( ParameterizedType ) beanType , ( ParameterizedType ) type ) ; } if ( beanType instanceof Class < ? > ) { return resolveT... | Gets the actual types by resolving TypeParameters . |
22,262 | public static long readUnsignedLong ( ObjectInput in ) throws IOException { byte b = in . readByte ( ) ; long i = b & 0x7F ; for ( int shift = 7 ; ( b & 0x80 ) != 0 ; shift += 7 ) { b = in . readByte ( ) ; i |= ( b & 0x7FL ) << shift ; } return i ; } | Reads a long stored in variable - length format . Reads between one and nine bytes . Smaller values take fewer bytes . Negative numbers are not supported . |
22,263 | public static void writeUnsignedLong ( ObjectOutput out , long i ) throws IOException { while ( ( i & ~ 0x7F ) != 0 ) { out . writeByte ( ( byte ) ( ( i & 0x7f ) | 0x80 ) ) ; i >>>= 7 ; } out . writeByte ( ( byte ) i ) ; } | Writes a long in a variable - length format . Writes between one and nine bytes . Smaller values take fewer bytes . Negative numbers are not supported . |
22,264 | public static int readUnsignedInt ( byte [ ] bytes , int offset ) { byte b = bytes [ offset ++ ] ; int i = b & 0x7F ; for ( int shift = 7 ; ( b & 0x80 ) != 0 ; shift += 7 ) { b = bytes [ offset ++ ] ; i |= ( b & 0x7FL ) << shift ; } return i ; } | Reads an int stored in variable - length format . Reads between one and five bytes . Smaller values take fewer bytes . Negative numbers are not supported . |
22,265 | public static long readUnsignedLong ( byte [ ] bytes , int offset ) { byte b = bytes [ offset ++ ] ; long i = b & 0x7F ; for ( int shift = 7 ; ( b & 0x80 ) != 0 ; shift += 7 ) { b = bytes [ offset ++ ] ; i |= ( b & 0x7FL ) << shift ; } return i ; } | Reads an int stored in variable - length format . Reads between one and nine bytes . Smaller values take fewer bytes . Negative numbers are not supported . |
22,266 | public static void writeUnsignedLong ( byte [ ] bytes , int offset , long i ) { while ( ( i & ~ 0x7F ) != 0 ) { bytes [ offset ++ ] = ( byte ) ( ( i & 0x7f ) | 0x80 ) ; i >>>= 7 ; } bytes [ offset ] = ( byte ) i ; } | Writes an int in a variable - length format . Writes between one and nine bytes . Smaller values take fewer bytes . Negative numbers are not supported . |
22,267 | public Object createInstance ( StoreConfiguration storeConfiguration ) { for ( CacheStoreFactory factory : factories ) { Object instance = factory . createInstance ( storeConfiguration ) ; if ( instance != null ) { return instance ; } } throw log . unableToInstantiateClass ( storeConfiguration . getClass ( ) ) ; } | Creates new Object based on configuration . |
22,268 | public void addCacheStoreFactory ( CacheStoreFactory cacheStoreFactory ) { if ( cacheStoreFactory == null ) { throw log . unableToAddNullCustomStore ( ) ; } factories . add ( 0 , cacheStoreFactory ) ; } | Adds a new factory for processing . |
22,269 | public final boolean append ( String commandString , int nesting ) { this . nesting += nesting ; buffer . append ( commandString ) ; return this . nesting == 0 ; } | Appends the new command . |
22,270 | @ Stop ( priority = 110 ) public void stop ( ) { if ( trace ) { log . tracef ( "Stopping LocalTopologyManager on %s" , transport . getAddress ( ) ) ; } running = false ; for ( LocalCacheStatus cache : runningCaches . values ( ) ) { cache . getTopologyUpdatesExecutor ( ) . shutdownNow ( ) ; } withinThreadExecutor . shut... | Need to stop after ClusterTopologyManagerImpl and before the JGroupsTransport |
22,271 | public ManagerStatusResponse handleStatusRequest ( int viewId ) { try { waitForView ( viewId , getGlobalTimeout ( ) , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; return new ManagerStatusResponse ( Collections . emptyMap ( ) , true ) ; } Map < String , Ca... | called by the coordinator |
22,272 | private boolean doHandleTopologyUpdate ( String cacheName , CacheTopology cacheTopology , AvailabilityMode availabilityMode , int viewId , Address sender , LocalCacheStatus cacheStatus ) { try { waitForView ( viewId , cacheStatus . getJoinInfo ( ) . getTimeout ( ) , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedExce... | Update the cache topology in the LocalCacheStatus and pass it to the CacheTopologyHandler . |
22,273 | @ GuardedBy ( "runningCaches" ) private boolean validateCommandViewId ( CacheTopology cacheTopology , int viewId , Address sender , String cacheName ) { if ( ! sender . equals ( transport . getCoordinator ( ) ) ) { log . debugf ( "Ignoring topology %d for cache %s from old coordinator %s" , cacheTopology . getTopologyI... | Synchronization is required to prevent topology updates while preparing the status response . |
22,274 | public AuthenticationConfigurationBuilder saslProperties ( Map < String , String > saslProperties ) { this . attributes . attribute ( SASL_PROPERTIES ) . set ( saslProperties ) ; return this ; } | Sets the SASL properties |
22,275 | public static < T , R > Collector < T , ? , R > serializableCollector ( SerializableSupplier < Collector < T , ? , R > > supplier ) { return new CollectorSupplier < > ( supplier ) ; } | Creates a collector that is serializable and will upon usage create a collector using the serializable supplier provided by the user . |
22,276 | public RouterConfiguration build ( ) { return new RouterConfiguration ( routingBuilder . build ( ) , hotRodRouterBuilder . build ( ) , restRouterBuilder . build ( ) , singlePortRouterBuilder . build ( ) ) ; } | Returns assembled configuration . |
22,277 | void initialize ( ScheduledExecutorService executor , String cacheName , Configuration cfg ) { this . executor = executor ; this . configuration = cfg ; this . cacheName = cacheName ; } | used only for testing |
22,278 | public static int comparePrimaryPredicates ( boolean isFirstNegated , PrimaryPredicateExpr first , boolean isSecondNegated , PrimaryPredicateExpr second ) { if ( first . getClass ( ) == second . getClass ( ) ) { if ( first instanceof ComparisonExpr ) { ComparisonExpr comparison1 = ( ComparisonExpr ) first ; ComparisonE... | Checks if two predicates are identical or opposite . |
22,279 | public InterceptorConfigurationBuilder interceptorClass ( Class < ? extends AsyncInterceptor > interceptorClass ) { attributes . attribute ( INTERCEPTOR_CLASS ) . set ( interceptorClass ) ; return this ; } | Class of the new custom interceptor to add to the configuration . |
22,280 | public InterceptorConfigurationBuilder withProperties ( Properties properties ) { attributes . attribute ( PROPERTIES ) . set ( TypedProperties . toTypedProperties ( properties ) ) ; return this ; } | Sets interceptor properties |
22,281 | public InterceptorConfigurationBuilder clearProperties ( ) { TypedProperties properties = attributes . attribute ( PROPERTIES ) . get ( ) ; properties . clear ( ) ; attributes . attribute ( PROPERTIES ) . set ( TypedProperties . toTypedProperties ( properties ) ) ; return this ; } | Clears the interceptor properties |
22,282 | private DirectoryLoaderAdaptor getDirectory ( final String indexName ) { DirectoryLoaderAdaptor adapter = openDirectories . get ( indexName ) ; if ( adapter == null ) { synchronized ( openDirectories ) { adapter = openDirectories . get ( indexName ) ; if ( adapter == null ) { final File path = new File ( this . rootDir... | Looks up the Directory adapter if it s already known or attempts to initialize indexes . |
22,283 | private FSDirectory openLuceneDirectory ( final File path ) { try { return FSDirectory . open ( path . toPath ( ) ) ; } catch ( IOException e ) { throw log . exceptionInCacheLoader ( e ) ; } } | Attempts to open a Lucene FSDirectory on the specified path |
22,284 | public static long copyb ( InputStream input , OutputStream output ) throws IOException { if ( ! ( input instanceof BufferedInputStream ) ) { input = new BufferedInputStream ( input ) ; } if ( ! ( output instanceof BufferedOutputStream ) ) { output = new BufferedOutputStream ( output ) ; } long bytes = copy ( input , o... | Copy all of the bytes from the input stream to the output stream wrapping streams in buffers as needed . |
22,285 | public BeanBuilder < T > addQualifiers ( Annotation ... qualifiers ) { this . qualifiers . addAll ( Arrays2 . asSet ( qualifiers ) ) ; return this ; } | Add to the qualifiers used for bean creation . |
22,286 | public BeanBuilder < T > addTypes ( Type ... types ) { this . types . addAll ( Arrays2 . asSet ( types ) ) ; return this ; } | Add to the type closure used for bean creation . |
22,287 | public List < EventLog > getEvents ( Instant start , int count , Optional < EventLogCategory > category , Optional < EventLogLevel > level ) { return Collections . emptyList ( ) ; } | The basic event logger doesn t collect anything . |
22,288 | public IndexingConfigurationBuilder enable ( ) { Attribute < Index > index = attributes . attribute ( INDEX ) ; if ( index . get ( ) == Index . NONE ) index . set ( Index . ALL ) ; return this ; } | Enable indexing . |
22,289 | public IndexingConfigurationBuilder enabled ( boolean enabled ) { Attribute < Index > index = attributes . attribute ( INDEX ) ; if ( index . get ( ) == Index . NONE & enabled ) index . set ( Index . ALL ) ; else if ( ! enabled ) index . set ( Index . NONE ) ; return this ; } | Enable or disable indexing . |
22,290 | public IndexingConfigurationBuilder indexLocalOnly ( boolean b ) { if ( b ) attributes . attribute ( INDEX ) . set ( Index . LOCAL ) ; return this ; } | If true only index changes made locally ignoring remote changes . This is useful if indexes are shared across a cluster to prevent redundant indexing of updates . |
22,291 | public IndexingConfigurationBuilder addKeyTransformer ( Class < ? > keyClass , Class < ? > keyTransformerClass ) { Map < Class < ? > , Class < ? > > indexedEntities = keyTransformers ( ) ; indexedEntities . put ( keyClass , keyTransformerClass ) ; attributes . attribute ( KEY_TRANSFORMERS ) . set ( indexedEntities ) ; ... | Registers a transformer for a key class . |
22,292 | @ SuppressWarnings ( "rawtypes" ) protected Class < ? > findClass ( String name ) throws ClassNotFoundException { if ( classCache . containsKey ( name ) ) { return classCache . get ( name ) ; } for ( WeakReference < Bundle > ref : bundles ) { final Bundle bundle = ref . get ( ) ; if ( bundle == null ) continue ; if ( b... | Load the class and break on first found match . |
22,293 | protected URL findResource ( String name ) { if ( resourceCache . containsKey ( name ) ) { return resourceCache . get ( name ) ; } for ( WeakReference < Bundle > ref : bundles ) { final Bundle bundle = ref . get ( ) ; if ( bundle != null && bundle . getState ( ) == Bundle . ACTIVE ) { try { final URL resource = bundle ... | Load the resource and break on first found match . |
22,294 | @ SuppressWarnings ( "unchecked" ) protected Enumeration < URL > findResources ( String name ) { final List < Enumeration < URL > > enumerations = new ArrayList < > ( ) ; for ( WeakReference < Bundle > ref : bundles ) { final Bundle bundle = ref . get ( ) ; if ( bundle != null && bundle . getState ( ) == Bundle . ACTIV... | Load the resources and return an Enumeration |
22,295 | public void stopApplyingState ( int topologyId ) { if ( trace ) log . tracef ( "Stop keeping track of changed keys for state transfer in topology %d" , topologyId ) ; commitManager . stopTrack ( PUT_FOR_STATE_TRANSFER ) ; } | Stops applying incoming state . Also stops tracking updated keys . Should be called at the end of state transfer or when a ClearCommand is committed during state transfer . |
22,296 | @ Start ( priority = 20 ) public void start ( ) { cacheName = cache . wired ( ) . getName ( ) ; isInvalidationMode = configuration . clustering ( ) . cacheMode ( ) . isInvalidation ( ) ; isTransactional = configuration . transaction ( ) . transactionMode ( ) . isTransactional ( ) ; isTotalOrder = configuration . transa... | Must run after the PersistenceManager |
22,297 | protected void cancelTransfers ( IntSet removedSegments ) { synchronized ( transferMapsLock ) { List < Integer > segmentsToCancel = new ArrayList < > ( removedSegments ) ; while ( ! segmentsToCancel . isEmpty ( ) ) { int segmentId = segmentsToCancel . remove ( 0 ) ; List < InboundTransferTask > inboundTransfers = trans... | Cancel transfers for segments we no longer own . |
22,298 | private void restartBrokenTransfers ( CacheTopology cacheTopology , IntSet addedSegments ) { Set < Address > members = new HashSet < > ( cacheTopology . getReadConsistentHash ( ) . getMembers ( ) ) ; synchronized ( transferMapsLock ) { for ( Iterator < Map . Entry < Address , List < InboundTransferTask > > > it = trans... | Check if any of the existing transfers should be restarted from a different source because the initial source is no longer a member . |
22,299 | final Object visitNonTxDataWriteCommand ( InvocationContext ctx , DataWriteCommand command ) { if ( hasSkipLocking ( command ) || ! shouldLockKey ( command ) ) { return invokeNext ( ctx , command ) ; } LockPromise lockPromise = lockAndRecord ( ctx , command . getKey ( ) , getLockTimeoutMillis ( command ) ) ; return non... | We need this method in here because of putForExternalRead |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.