idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
22,000 | public GroupsConfigurationBuilder clearGroupers ( ) { List < Grouper < ? > > groupers = attributes . attribute ( GROUPERS ) . get ( ) ; groupers . clear ( ) ; attributes . attribute ( GROUPERS ) . set ( groupers ) ; return this ; } | Clear the groupers |
22,001 | public GroupsConfigurationBuilder addGrouper ( Grouper < ? > grouper ) { List < Grouper < ? > > groupers = attributes . attribute ( GROUPERS ) . get ( ) ; groupers . add ( grouper ) ; attributes . attribute ( GROUPERS ) . set ( groupers ) ; return this ; } | Add a grouper |
22,002 | private Cache < QueryCacheKey , Object > getCache ( ) { final Cache < QueryCacheKey , Object > cache = lazyCache ; if ( cache != null ) { return cache ; } synchronized ( this ) { if ( lazyCache == null ) { internalCacheRegistry . registerInternalCache ( QUERY_CACHE_NAME , getQueryCacheConfig ( ) . build ( ) , EnumSet .... | Obtain the cache . Start it lazily when needed . |
22,003 | private ConfigurationBuilder getQueryCacheConfig ( ) { ConfigurationBuilder cfgBuilder = new ConfigurationBuilder ( ) ; cfgBuilder . clustering ( ) . cacheMode ( CacheMode . LOCAL ) . transaction ( ) . transactionMode ( TransactionMode . NON_TRANSACTIONAL ) . expiration ( ) . maxIdle ( ENTRY_LIFESPAN , TimeUnit . SECON... | Create the configuration of the internal query cache . |
22,004 | public Class < ? > getClass ( int id ) throws IOException { if ( id < 0 || id > internalIdToClass . length ) { throw new IOException ( "Unknown class id " + id ) ; } Class < ? > clazz = internalIdToClass [ id ] ; if ( clazz == null ) { throw new IOException ( "Unknown class id " + id ) ; } return clazz ; } | This method throws IOException because it is assumed that we got the id from network . |
22,005 | private < R > boolean requiresFinalizer ( boolean parallelPublisher , Set < K > keysToInclude , DeliveryGuarantee deliveryGuarantee ) { return parallelPublisher || keysToInclude == null && deliveryGuarantee == DeliveryGuarantee . EXACTLY_ONCE ; } | This method is used to determine if a finalizer is required to be sent remotely . For cases we don t have to we don t want to serialize it for nothing |
22,006 | private long performGet ( long bucketHeadAddress , WrappedBytes k ) { long address = bucketHeadAddress ; while ( address != 0 ) { long nextAddress = offHeapEntryFactory . getNext ( address ) ; if ( offHeapEntryFactory . equalsKey ( address , k ) ) { break ; } else { address = nextAddress ; } } return address ; } | Gets the actual address for the given key in the given bucket or 0 if it isn t present or expired |
22,007 | public void dataRehashed ( DataRehashedEvent < K , V > event ) { ConsistentHash startHash = event . getConsistentHashAtStart ( ) ; ConsistentHash endHash = event . getConsistentHashAtEnd ( ) ; boolean trace = log . isTraceEnabled ( ) ; if ( startHash != null && endHash != null ) { if ( trace ) { log . tracef ( "Data re... | We need to listen to data rehash events in case if data moves while we are iterating over it . If a rehash occurs causing this node to lose a segment and there is something iterating over the stream looking for values of that segment we can t guarantee that the data has all been seen correctly so we must therefore susp... |
22,008 | private void handleSuspectSegmentsBeforeStream ( Object requestId , SegmentListener listener , IntSet segments ) { LocalizedCacheTopology topology = dm . getCacheTopology ( ) ; if ( trace ) { log . tracef ( "Topology for supplier is %s for id %s" , topology , requestId ) ; } ConsistentHash readCH = topology . getCurren... | that we allow backup owners to respond even though it was thought to be a primary owner . |
22,009 | public void addUser ( String userName , String userRealm , char [ ] password , String ... groups ) { if ( userName == null ) { throw new IllegalArgumentException ( "userName is null" ) ; } if ( userRealm == null ) { throw new IllegalArgumentException ( "userRealm is null" ) ; } if ( password == null ) { throw new Illeg... | Add a user to the authentication table . |
22,010 | protected < C extends FlagAffectedCommand & TopologyAffectedCommand > CompletionStage < Void > remoteGetSingleKey ( InvocationContext ctx , C command , Object key , boolean isWrite ) { LocalizedCacheTopology cacheTopology = checkTopologyId ( command ) ; int topologyId = cacheTopology . getTopologyId ( ) ; DistributionI... | Fetch a key from its remote owners and store it in the context . |
22,011 | public TransportConfigurationBuilder initialClusterTimeout ( long initialClusterTimeout , TimeUnit unit ) { attributes . attribute ( INITIAL_CLUSTER_TIMEOUT ) . set ( unit . toMillis ( initialClusterTimeout ) ) ; return this ; } | Sets the timeout for the initial cluster to form . Defaults to 1 minute |
22,012 | @ Start ( priority = 50 ) public void start ( ) { timeout = configuration . clustering ( ) . stateTransfer ( ) . timeout ( ) ; chunkSize = configuration . clustering ( ) . stateTransfer ( ) . chunkSize ( ) ; } | Must start before StateTransferManager sends the join request |
22,013 | public static < X > String createParameterId ( Type type , Set < Annotation > annotations ) { StringBuilder builder = new StringBuilder ( ) ; if ( type instanceof Class < ? > ) { Class < ? > c = ( Class < ? > ) type ; builder . append ( c . getName ( ) ) ; } else { builder . append ( type . toString ( ) ) ; } builder .... | Creates a string representation of a given type and set of annotations . |
22,014 | private < T > List < T > immutableAdd ( List < T > list , T element ) { List < T > result = new ArrayList < T > ( list ) ; result . add ( element ) ; return Collections . unmodifiableList ( result ) ; } | Helpers for working with immutable lists |
22,015 | public static String getCacheName ( Method method , String methodCacheName , CacheDefaults cacheDefaultsAnnotation , boolean generate ) { assertNotNull ( method , "method parameter must not be null" ) ; assertNotNull ( methodCacheName , "methodCacheName parameter must not be null" ) ; String cacheName = methodCacheName... | Resolves the cache name of a method annotated with a JCACHE annotation . |
22,016 | private static String getDefaultMethodCacheName ( Method method ) { int i = 0 ; int nbParameters = method . getParameterTypes ( ) . length ; StringBuilder cacheName = new StringBuilder ( ) . append ( method . getDeclaringClass ( ) . getName ( ) ) . append ( "." ) . append ( method . getName ( ) ) . append ( "(" ) ; for... | Returns the default cache name associated to the given method according to JSR - 107 . |
22,017 | public < K , V > RemoteCache < K , V > getRemoteCache ( InjectionPoint injectionPoint ) { final Set < Annotation > qualifiers = injectionPoint . getQualifiers ( ) ; final RemoteCacheManager cacheManager = getRemoteCacheManager ( qualifiers . toArray ( new Annotation [ 0 ] ) ) ; final Remote remote = getRemoteAnnotation... | Produces the remote cache . |
22,018 | protected Object convert ( Object instance ) { try { return ProtobufUtil . toWrappedByteArray ( serializationContext , instance ) ; } catch ( IOException e ) { throw new CacheException ( e ) ; } } | Marshals the instance using Protobuf . |
22,019 | public AnnotatedTypeBuilder < X > addToMethodParameter ( Method method , int position , Annotation annotation ) { if ( ! methods . containsKey ( method ) ) { methods . put ( method , new AnnotationBuilder ( ) ) ; } if ( methodParameters . get ( method ) == null ) { methodParameters . put ( method , new HashMap < Intege... | Add an annotation to the specified method parameter . If the method is not already present it will be added . If the method parameter is not already present it will be added . |
22,020 | public AnnotatedTypeBuilder < X > removeFromMethodParameter ( Method method , int position , Class < ? extends Annotation > annotationType ) { if ( methods . get ( method ) == null ) { throw new IllegalArgumentException ( "Method not present " + method + " on " + javaClass ) ; } else { if ( methodParameters . get ( met... | Remove an annotation from the specified method parameter . |
22,021 | public MapSession getSession ( String id , boolean updateTTL ) { return Optional . ofNullable ( cache . get ( id ) ) . map ( v -> ( MapSession ) v . get ( ) ) . map ( v -> updateTTL ( v , updateTTL ) ) . orElse ( null ) ; } | Returns session with optional parameter whether or not update time accessed . |
22,022 | @ ManagedAttribute ( description = "Number of seconds since cache started" , displayName = "Seconds since cache started" , units = Units . SECONDS , measurementType = MeasurementType . TRENDSUP , displayType = DisplayType . SUMMARY ) public long getElapsedTime ( ) { return getTimeSinceStart ( ) ; } | Returns number of seconds since cache started |
22,023 | private boolean parentIsNotOfClass ( BaseCondition condition , Class < ? extends BooleanCondition > expectedParentClass ) { BaseCondition parent = condition . getParent ( ) ; return parent != null && parent . getClass ( ) != expectedParentClass ; } | We check if the parent if of the expected class hoping that if it is then we can avoid wrapping this condition in parentheses and still maintain the same logic . |
22,024 | public HashConfigurationBuilder consistentHashFactory ( ConsistentHashFactory < ? extends ConsistentHash > consistentHashFactory ) { attributes . attribute ( CONSISTENT_HASH_FACTORY ) . set ( consistentHashFactory ) ; return this ; } | The consistent hash factory in use . |
22,025 | public HashConfigurationBuilder numOwners ( int numOwners ) { if ( numOwners < 1 ) throw new IllegalArgumentException ( "numOwners cannot be less than 1" ) ; attributes . attribute ( NUM_OWNERS ) . set ( numOwners ) ; return this ; } | Number of cluster - wide replicas for each cache entry . |
22,026 | private Object handleTxCommand ( TxInvocationContext ctx , TransactionBoundaryCommand command ) { if ( trace ) log . tracef ( "handleTxCommand for command %s, origin %s" , command , getOrigin ( ctx ) ) ; updateTopologyId ( command ) ; return invokeNextAndHandle ( ctx , command , handleTxReturn ) ; } | Special processing required for transaction commands . |
22,027 | public DataContainerConfigurationBuilder dataContainer ( DataContainer dataContainer ) { attributes . attribute ( DATA_CONTAINER ) . set ( dataContainer ) ; return this ; } | Specify the data container in use |
22,028 | public < Original , E > OnCloseIterator < E > start ( Address origin , Supplier < Stream < Original > > streamSupplier , Iterable < IntermediateOperation > intOps , Object requestId ) { if ( trace ) { log . tracef ( "Iterator requested from %s using requestId %s" , origin , requestId ) ; } BaseStream stream = streamSup... | Starts an iteration process from the given stream that converts the stream to a subsequent stream using the given intermediate operations and then creates a managed iterator for the caller to subsequently retrieve . |
22,029 | public boolean equalsKey ( long address , WrappedBytes wrappedBytes ) { int headerOffset = evictionEnabled ? 24 : 8 ; byte type = MEMORY . getByte ( address , headerOffset ) ; headerOffset ++ ; int hashCode = wrappedBytes . hashCode ( ) ; if ( hashCode != MEMORY . getInt ( address , headerOffset ) ) { return false ; } ... | Assumes the address points to the entry excluding the pointer reference at the beginning |
22,030 | public boolean isExpired ( long address ) { int offset = evictionEnabled ? 24 : 8 ; byte metadataType = MEMORY . getByte ( address , offset ) ; if ( ( metadataType & IMMORTAL ) != 0 ) { return false ; } offset += 1 ; offset += 4 ; int keyLength = MEMORY . getInt ( address , offset ) ; offset += 4 ; long now = timeServi... | Returns whether entry is expired . |
22,031 | public void cleanupLeaverTransactions ( List < Address > members ) { Iterator < RemoteTransaction > it = getRemoteTransactions ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { RecoveryAwareRemoteTransaction recTx = ( RecoveryAwareRemoteTransaction ) it . next ( ) ; recTx . computeOrphan ( members ) ; if ( recTx . isIn... | First moves the prepared transactions originated on the leavers into the recovery cache and then cleans up the transactions that are not yet prepared . |
22,032 | public Xid getRemoteTransactionXid ( Long internalId ) { for ( RemoteTransaction rTx : getRemoteTransactions ( ) ) { RecoverableTransactionIdentifier gtx = ( RecoverableTransactionIdentifier ) rTx . getGlobalTransaction ( ) ; if ( gtx . getInternalId ( ) == internalId ) { if ( trace ) log . tracef ( "Found xid %s match... | Iterates over the remote transactions and returns the XID of the one that has an internal id equal with the supplied internal Id . |
22,033 | @ Start ( priority = 14 ) public void start ( ) { initMBeanServer ( globalConfig ) ; if ( mBeanServer != null ) { Collection < ComponentRef < ? > > components = basicComponentRegistry . getRegisteredComponents ( ) ; Collection < ResourceDMBean > resourceDMBeans = getResourceDMBeansFromComponents ( components ) ; nonCac... | Here is where the registration is being performed . |
22,034 | public void stop ( ) { if ( needToUnregister ) { try { unregisterMBeans ( nonCacheDMBeans ) ; needToUnregister = false ; } catch ( Exception e ) { log . problemsUnregisteringMBeans ( e ) ; } } if ( unregisterCacheMBean ) globalJmxRegistration . unregisterCacheMBean ( this . cacheName , this . cacheConfiguration . clust... | Unregister when the cache is being stopped . |
22,035 | public int estimateSize ( Codec codec ) { int size = key . length + 1 ; if ( ! ControlByte . NON_EXISTING . hasFlag ( control ) && ! ControlByte . NOT_READ . hasFlag ( control ) ) { size += 8 ; } if ( ! ControlByte . REMOVE_OP . hasFlag ( control ) ) { size += value . length ; size += codec . estimateExpirationSize ( l... | The estimated size . |
22,036 | public static String readString ( ByteBuf bf ) { byte [ ] bytes = readRangedBytes ( bf ) ; return bytes . length > 0 ? new String ( bytes , CharsetUtil . UTF_8 ) : "" ; } | Reads length of String and then returns an UTF - 8 formatted String of such length . If the length is 0 an empty String is returned . |
22,037 | CompletableFuture < CounterConfiguration > getConfiguration ( String name ) { return stateCache . getAsync ( stateKey ( name ) ) . thenCompose ( existingConfiguration -> { if ( existingConfiguration == null ) { return checkGlobalConfiguration ( name ) ; } else { return CompletableFuture . completedFuture ( existingConf... | Returns the counter s configuration . |
22,038 | private CompletableFuture < CounterConfiguration > checkGlobalConfiguration ( String name ) { for ( AbstractCounterConfiguration config : configuredCounters ) { if ( config . name ( ) . equals ( name ) ) { CounterConfiguration cConfig = parsedConfigToConfig ( config ) ; return stateCache . putIfAbsentAsync ( stateKey (... | Checks if the counter is defined in the Infinispan s configuration file . |
22,039 | private void validateConfiguration ( CounterConfiguration configuration ) { storage . validatePersistence ( configuration ) ; switch ( configuration . type ( ) ) { case BOUNDED_STRONG : validateStrongCounterBounds ( configuration . lowerBound ( ) , configuration . initialValue ( ) , configuration . upperBound ( ) ) ; b... | Validates the counter s configuration . |
22,040 | QueryResponse unicast ( Address address , ClusteredQueryCommand clusteredQueryCommand ) { if ( address . equals ( myAddress ) ) { Future < QueryResponse > localResponse = localInvoke ( clusteredQueryCommand ) ; try { return localResponse . get ( ) ; } catch ( InterruptedException e ) { throw new SearchException ( "Inte... | Send this ClusteredQueryCommand to a node . |
22,041 | List < QueryResponse > broadcast ( ClusteredQueryCommand clusteredQueryCommand ) { Future < QueryResponse > localResponse = localInvoke ( clusteredQueryCommand ) ; Map < Address , Response > responses = rpcManager . invokeRemotely ( null , clusteredQueryCommand , rpcOptions ) ; List < QueryResponse > queryResponses = c... | Broadcast this ClusteredQueryCommand to all cluster nodes . The command will be also invoked on local node . |
22,042 | public void runL1UpdateIfPossible ( InternalCacheEntry ice ) { try { if ( ice != null ) { Object key ; if ( sync . attemptUpdateToRunning ( ) && ! dc . containsKey ( ( key = ice . getKey ( ) ) ) ) { stateTransferLock . acquireSharedTopologyLock ( ) ; try { if ( ! dc . containsKey ( key ) && ! cdl . getCacheTopology ( )... | Attempts to the L1 update and set the value . If the L1 update was marked as being skipped this will instead just set the value to release blockers . A null value can be provided which will not run the L1 update but will just alert other waiters that a null was given . |
22,043 | public ConnectionPoolConfigurationBuilder withPoolProperties ( Properties properties ) { TypedProperties typed = TypedProperties . toTypedProperties ( properties ) ; exhaustedAction ( typed . getEnumProperty ( ConfigurationProperties . CONNECTION_POOL_EXHAUSTED_ACTION , ExhaustedAction . class , ExhaustedAction . value... | Configures the connection pool parameter according to properties |
22,044 | CompletableFuture < Void > handleLifespanExpireEntry ( K key , V value , long lifespan , boolean skipLocking ) { if ( expiring . putIfAbsent ( key , key ) == null ) { if ( trace ) { log . tracef ( "Submitting expiration removal for key %s which had lifespan of %s" , toStr ( key ) , lifespan ) ; } AdvancedCache < K , V ... | holds the lock until this CompletableFuture completes . Without lock skipping this would deadlock . |
22,045 | CompletableFuture < Boolean > handleMaxIdleExpireEntry ( K key , V value , long maxIdle , boolean skipLocking ) { return actualRemoveMaxIdleExpireEntry ( key , value , maxIdle , skipLocking ) ; } | Method invoked when an entry is found to be expired via get |
22,046 | CompletableFuture < Boolean > actualRemoveMaxIdleExpireEntry ( K key , V value , long maxIdle , boolean skipLocking ) { CompletableFuture < Boolean > completableFuture = new CompletableFuture < > ( ) ; Object expiringObject = expiring . putIfAbsent ( key , completableFuture ) ; if ( expiringObject == null ) { if ( trac... | Method invoked when entry should be attempted to be removed via max idle |
22,047 | public S purgeOnStartup ( boolean b ) { attributes . attribute ( PURGE_ON_STARTUP ) . set ( b ) ; purgeOnStartup = b ; return self ( ) ; } | If true purges this cache store when it starts up . |
22,048 | public < T extends StoreConfigurationBuilder < ? , ? > > T addStore ( Class < T > klass ) { try { Constructor < T > constructor = klass . getDeclaredConstructor ( PersistenceConfigurationBuilder . class ) ; T builder = constructor . newInstance ( this ) ; this . stores . add ( builder ) ; return builder ; } catch ( Exc... | Adds a cache loader that uses the specified builder class to build its configuration . |
22,049 | public static SmallIntSet from ( Set < Integer > set ) { if ( set instanceof SmallIntSet ) { return ( SmallIntSet ) set ; } else { return new SmallIntSet ( set ) ; } } | Either converts the given set to an IntSet if it is one or creates a new IntSet and copies the contents |
22,050 | public boolean add ( int i ) { boolean wasSet = bitSet . get ( i ) ; if ( ! wasSet ) { bitSet . set ( i ) ; return true ; } return false ; } | Add an integer to the set without boxing the parameter . |
22,051 | public boolean remove ( int i ) { boolean wasSet = bitSet . get ( i ) ; if ( wasSet ) { bitSet . clear ( i ) ; return true ; } return false ; } | Remove an integer from the set without boxing . |
22,052 | public static Object fromStorage ( Object stored , Encoder encoder , Wrapper wrapper ) { if ( encoder == null || wrapper == null ) { throw new IllegalArgumentException ( "Both Encoder and Wrapper must be provided!" ) ; } if ( stored == null ) return null ; return encoder . fromStorage ( wrapper . unwrap ( stored ) ) ; ... | Decode object from storage format . |
22,053 | public static Object toStorage ( Object toStore , Encoder encoder , Wrapper wrapper ) { if ( encoder == null || wrapper == null ) { throw new IllegalArgumentException ( "Both Encoder and Wrapper must be provided!" ) ; } if ( toStore == null ) return null ; return wrapper . wrap ( encoder . toStorage ( toStore ) ) ; } | Encode object to storage format . |
22,054 | public static String requireSingleAttribute ( final XMLStreamReader reader , final String attributeName ) throws XMLStreamException { final int count = reader . getAttributeCount ( ) ; if ( count == 0 ) { throw missingRequired ( reader , Collections . singleton ( attributeName ) ) ; } requireNoNamespaceAttribute ( read... | Require that the current element have only a single attribute with the given name . |
22,055 | private void configureEvent ( CacheEntryListenerInvocation listenerInvocation , EventImpl < K , V > e , K key , V value , Metadata metadata , boolean pre , InvocationContext ctx , FlagAffectedCommand command , V previousValue , Metadata previousMetadata ) { key = convertKey ( listenerInvocation , key ) ; value = conver... | Configure event data . Currently used for created modified removed invalidated events . |
22,056 | private void configureEvent ( CacheEntryListenerInvocation listenerInvocation , EventImpl < K , V > e , K key , V value , boolean pre , InvocationContext ctx ) { e . setPre ( pre ) ; e . setKey ( convertKey ( listenerInvocation , key ) ) ; e . setValue ( convertValue ( listenerInvocation , value ) ) ; e . setOriginLoca... | Configure event data . Currently used for activated loaded visited events . |
22,057 | private void configureEvent ( CacheEntryListenerInvocation listenerInvocation , EventImpl < K , V > e , K key , V value , Metadata metadata ) { e . setKey ( convertKey ( listenerInvocation , key ) ) ; e . setValue ( convertValue ( listenerInvocation , value ) ) ; e . setMetadata ( metadata ) ; e . setOriginLocal ( true... | Configure event data . Currently used for expired events . |
22,058 | private FilterIndexingServiceProvider findIndexingServiceProvider ( IndexedFilter indexedFilter ) { if ( filterIndexingServiceProviders != null ) { for ( FilterIndexingServiceProvider provider : filterIndexingServiceProviders ) { if ( provider . supportsFilter ( indexedFilter ) ) { return provider ; } } } log . noFilte... | Gets a suitable indexing provider for the given indexed filter . |
22,059 | public void shutdownNow ( ) { log . tracef ( "Stopping limited executor %s" , name ) ; running = false ; lock . lock ( ) ; try { queue . clear ( ) ; for ( Thread t : threads . keySet ( ) ) { t . interrupt ( ) ; } } finally { lock . unlock ( ) ; } } | Stops the executor and cancels any queued tasks . |
22,060 | void notifyCacheCollected ( ) { int result = expectedCaches . decrementAndGet ( ) ; if ( isTraceEnabled ( ) ) { log ( ) . tracef ( "[%s] Cache collected. Missing=%s." , xid , result ) ; } if ( result == 0 ) { onCachesCollected ( ) ; } } | Invoked every time a cache is found to be involved in a transaction . |
22,061 | private void onCachesCollected ( ) { if ( isTraceEnabled ( ) ) { log ( ) . tracef ( "[%s] All caches collected: %s" , xid , cacheNames ) ; } int size = cacheNames . size ( ) ; if ( size == 0 ) { sendReply ( ) ; return ; } List < CompletableFuture < Void > > futures = new ArrayList < > ( size ) ; for ( ByteString cacheN... | Invoked when all caches are ready to complete the transaction . |
22,062 | private CompletableFuture < Void > completeCache ( ByteString cacheName ) throws Throwable { TxState state = globalTxTable . getState ( new CacheXid ( cacheName , xid ) ) ; HotRodServer . CacheInfo cacheInfo = server . getCacheInfo ( cacheName . toString ( ) , header . getVersion ( ) , header . getMessageId ( ) , true ... | Completes the transaction for a specific cache . |
22,063 | private CompletableFuture < Void > completeWithRemoteCommand ( AdvancedCache < ? , ? > cache , RpcManager rpcManager , TxState state ) throws Throwable { CommandsFactory commandsFactory = cache . getComponentRegistry ( ) . getCommandsFactory ( ) ; CacheRpcCommand command = buildRemoteCommand ( cache . getCacheConfigura... | Completes the transaction in the cache when the originator no longer belongs to the cache topology . |
22,064 | private CompletableFuture < Void > forwardCompleteCommand ( ByteString cacheName , RpcManager rpcManager , TxState state ) { Address originator = state . getOriginator ( ) ; CacheRpcCommand command = buildForwardCommand ( cacheName , state . getTimeout ( ) ) ; return rpcManager . invokeCommand ( originator , command , ... | Completes the transaction in the cache when the originator is still in the cache topology . |
22,065 | public final void addValue ( ExtendedStatistic stat , double value ) { container . addValue ( stat , value ) ; if ( trace ) { log . tracef ( "Add %s to %s" , value , stat ) ; } } | Adds a value to a statistic collected for this transaction . |
22,066 | public final void terminateTransaction ( ) { if ( trace ) { log . tracef ( "Terminating transaction. Is read only? %s. Is commit? %s" , readOnly , committed ) ; } long execTime = timeService . timeDuration ( initTime , NANOSECONDS ) ; if ( readOnly ) { if ( committed ) { incrementValue ( NUM_COMMITTED_RO_TX ) ; addValu... | Signals this transaction as completed and updates the statistics to the final values ready to be merged in the cache statistics . |
22,067 | public final void flushTo ( ConcurrentGlobalContainer globalContainer ) { if ( trace ) { log . tracef ( "Flush this [%s] to %s" , this , globalContainer ) ; } container . mergeTo ( globalContainer ) ; } | Merges this statistics in the global container . |
22,068 | protected final void copyValue ( ExtendedStatistic from , ExtendedStatistic to ) { try { double value = container . getValue ( from ) ; container . addValue ( to , value ) ; if ( log . isDebugEnabled ( ) ) { log . debugf ( "Copy value [%s] from [%s] to [%s]" , value , from , to ) ; } } catch ( ExtendedStatisticNotFound... | Copies a statistic value and adds it to another statistic . |
22,069 | void writeLock ( int count ) { if ( count > 0 && counter != null ) counter . acquireShared ( count ) ; sync . acquireShared ( 1 ) ; } | Acquires the write lock and consumes the specified amount of buffer space . Blocks if the object is currently locked for reading or if the buffer is full and count is greater than 0 . |
22,070 | void reset ( int count ) { if ( counter != null ) counter . releaseShared ( count ) ; available . releaseShared ( count ) ; } | Resets the buffer counter to the specified number . |
22,071 | public void forceUnlock ( String lockName ) { Cache < Object , Integer > lockCache = getDistLockCache ( ) . getAdvancedCache ( ) . withFlags ( Flag . SKIP_CACHE_STORE , Flag . SKIP_CACHE_LOAD ) ; FileCacheKey fileCacheKey = new FileCacheKey ( indexName , lockName , affinitySegmentId ) ; Object previousValue = lockCache... | Force release of the lock in this directory . Make sure to understand the consequences |
22,072 | public static < K , V > CacheEventFilterConverter < K , V , ObjectFilter . FilterResult > makeFilter ( Query query ) { return makeFilter ( query . getQueryString ( ) , query . getParameters ( ) ) ; } | Create an event filter out of an Ickle query . |
22,073 | public static QueryFactory getQueryFactory ( Cache < ? , ? > cache ) { if ( cache == null || cache . getAdvancedCache ( ) == null ) { throw new IllegalArgumentException ( "cache parameter shall not be null" ) ; } AdvancedCache < ? , ? > advancedCache = cache . getAdvancedCache ( ) ; ensureAccessPermissions ( advancedCa... | Obtain the query factory for building DSL based Ickle queries . |
22,074 | public LongStream toStream ( ) { return LongStream . iterate ( memory , l -> l + 8 ) . limit ( pointerCount ) . map ( UNSAFE :: getLong ) . filter ( l -> l != 0 ) ; } | Returns a stream of longs that are all of the various memory locations |
22,075 | public void start ( ) { initMBeanServer ( globalConfig ) ; if ( mBeanServer != null ) { Collection < ComponentRef < ? > > components = basicComponentRegistry . getRegisteredComponents ( ) ; resourceDMBeans = Collections . synchronizedCollection ( getResourceDMBeansFromComponents ( components ) ) ; registrar . registerM... | On start the mbeans are registered . |
22,076 | public void stop ( ) { if ( stopped ) return ; if ( needToUnregister ) { try { unregisterMBeans ( resourceDMBeans ) ; needToUnregister = false ; } catch ( Exception e ) { log . problemsUnregisteringMBeans ( e ) ; } } stopped = true ; } | On stop the mbeans are unregistered . |
22,077 | public < C extends ConnectionFactoryConfigurationBuilder < ? > > C connectionFactory ( Class < C > klass ) { if ( connectionFactory != null ) { throw new IllegalStateException ( "A ConnectionFactory has already been configured for this store" ) ; } try { Constructor < C > constructor = klass . getDeclaredConstructor ( ... | Use the specified ConnectionFactory to handle connection to the database |
22,078 | private boolean stoppingAndNotAllowed ( ComponentStatus status , InvocationContext ctx ) throws Exception { return status . isStopping ( ) && ( ! ctx . isInTxScope ( ) || ! isOngoingTransaction ( ctx ) ) ; } | If the cache is STOPPING non - transaction invocations or transactional invocations for transaction others than the ongoing ones are no allowed . This method returns true if under this circumstances meet . Otherwise it returns false . |
22,079 | private KeyValuePair < CacheTransaction , Object > waitForTransactionsToComplete ( Collection < PendingTransaction > transactionsToCheck , long expectedEndTime ) throws InterruptedException { if ( transactionsToCheck . isEmpty ( ) ) { return null ; } for ( PendingTransaction tx : transactionsToCheck ) { for ( Map . Ent... | cache - tx and key if it timed out otherwise null |
22,080 | private int compareIntervals ( Interval < K > i1 , Interval < K > i2 ) { int res1 = compare ( i1 . up , i2 . low ) ; if ( res1 < 0 || res1 <= 0 && ( ! i1 . includeUpper || ! i2 . includeLower ) ) { return - 1 ; } int res2 = compare ( i2 . up , i1 . low ) ; if ( res2 < 0 || res2 <= 0 && ( ! i2 . includeUpper || ! i1 . i... | Compare two Intervals . |
22,081 | public boolean remove ( Interval < K > i ) { checkValidInterval ( i ) ; return remove ( root . left , i ) ; } | Removes the Interval . |
22,082 | public List < Node < K , V > > stab ( K k ) { Interval < K > i = new Interval < K > ( k , true , k , true ) ; final List < Node < K , V > > nodes = new ArrayList < Node < K , V > > ( ) ; findOverlap ( root . left , i , new NodeCallback < K , V > ( ) { public void handle ( Node < K , V > node ) { nodes . add ( node ) ; ... | Find all Intervals that contain a given value . |
22,083 | InvocationCallback queuePoll ( ) { InvocationCallback element ; synchronized ( this ) { if ( tail != head ) { element = elements [ head & mask ] ; head ++ ; } else { element = null ; frozen = true ; } } return element ; } | Remove one handler from the deque or freeze the deque if there are no more elements . |
22,084 | private BeanManagerInfo getBeanManagerInfo ( ClassLoader cl ) { BeanManagerInfo bmi = bmpSingleton . bmInfos . get ( cl ) ; if ( bmi == null ) { synchronized ( this ) { bmi = bmpSingleton . bmInfos . get ( cl ) ; if ( bmi == null ) { bmi = new BeanManagerInfo ( ) ; bmpSingleton . bmInfos . put ( cl , bmi ) ; } } } retu... | Get or create the BeanManagerInfo for the given ClassLoader |
22,085 | public void addGet ( Object key , boolean remote ) { if ( ! isEnabled ( ) ) { return ; } syncOffer ( remote ? Stat . REMOTE_GET : Stat . LOCAL_GET , key ) ; } | Adds the key to the read top - key . |
22,086 | public void addPut ( Object key , boolean remote ) { if ( ! isEnabled ( ) ) { return ; } syncOffer ( remote ? Stat . REMOTE_PUT : Stat . LOCAL_PUT , key ) ; } | Adds the key to the put top - key . |
22,087 | public void addLockInformation ( Object key , boolean contention , boolean failLock ) { if ( ! isEnabled ( ) ) { return ; } syncOffer ( Stat . MOST_LOCKED_KEYS , key ) ; if ( contention ) { syncOffer ( Stat . MOST_CONTENDED_KEYS , key ) ; } if ( failLock ) { syncOffer ( Stat . MOST_FAILED_KEYS , key ) ; } } | Adds the lock information about the key namely if the key suffer some contention and if the keys was locked or not . |
22,088 | public final void tryFlushAll ( ) { if ( flushing . compareAndSet ( false , true ) ) { if ( reset ) { for ( Stat stat : Stat . values ( ) ) { topKeyWrapper . get ( stat ) . reset ( this , capacity ) ; } reset = false ; } else { for ( Stat stat : Stat . values ( ) ) { topKeyWrapper . get ( stat ) . flush ( ) ; } } flush... | Tries to flush all the enqueue offers to be visible globally . |
22,089 | protected < K , V > Map < K , V > allocMap ( int size ) { return size == 0 ? Collections . emptyMap ( ) : new HashMap < > ( size * 4 / 3 , 0.75f ) ; } | We usually know the size of the map ahead and we want to return static empty map if we re not going to add anything . |
22,090 | public void validateNamedParameters ( ) { if ( namedParameters != null ) { for ( Map . Entry < String , Object > e : namedParameters . entrySet ( ) ) { if ( e . getValue ( ) == null ) { throw log . queryParameterNotSet ( e . getKey ( ) ) ; } } } } | Ensure all named parameters have non - null values . |
22,091 | public void visitCollection ( InvocationContext ctx , Collection < ? extends VisitableCommand > toVisit ) throws Throwable { for ( VisitableCommand command : toVisit ) { command . acceptVisitor ( ctx , this ) ; } } | Helper method to visit a collection of VisitableCommands . |
22,092 | public static boolean isLegacyIndexingEnabled ( Descriptor messageDescriptor ) { boolean isLegacyIndexingEnabled = true ; for ( Option o : messageDescriptor . getFileDescriptor ( ) . getOptions ( ) ) { if ( o . getName ( ) . equals ( INDEXED_BY_DEFAULT_OPTION ) ) { isLegacyIndexingEnabled = Boolean . valueOf ( ( String... | Retrieves the value of the indexed_by_default protobuf option from the schema file defining the given message descriptor . |
22,093 | public static String getterName ( Class < ? > componentClass ) { if ( componentClass == null ) return null ; StringBuilder sb = new StringBuilder ( "get" ) ; sb . append ( componentClass . getSimpleName ( ) ) ; return sb . toString ( ) ; } | Returns a getter for a given class |
22,094 | public static Method getterMethod ( Class < ? > target , Class < ? > componentClass ) { try { return target . getMethod ( getterName ( componentClass ) ) ; } catch ( NoSuchMethodException e ) { return null ; } catch ( NullPointerException e ) { return null ; } } | Returns a Method object corresponding to a getter that retrieves an instance of componentClass from target . |
22,095 | public static Method setterMethod ( Class < ? > target , Class < ? > componentClass ) { try { return target . getMethod ( setterName ( componentClass ) , componentClass ) ; } catch ( NoSuchMethodException e ) { return null ; } catch ( NullPointerException e ) { return null ; } } | Returns a Method object corresponding to a setter that sets an instance of componentClass from target . |
22,096 | private Properties extractIndexingProperties ( OperationContext context , ModelNode operation , String cacheConfiguration ) { Properties properties = new Properties ( ) ; PathAddress cacheAddress = getCacheAddressFromOperation ( operation ) ; Resource cacheConfigResource = context . readResourceFromRoot ( cacheAddress ... | Extract indexing information for the cache from the model . |
22,097 | void populate ( ModelNode fromModel , ModelNode toModel ) throws OperationFailedException { for ( AttributeDefinition attr : CacheResource . CACHE_ATTRIBUTES ) { attr . validateAndSet ( fromModel , toModel ) ; } } | Transfer elements common to both operations and models |
22,098 | public static List < Method > getAllMethodsShallow ( Class < ? > c , Class < ? extends Annotation > annotationType ) { List < Method > annotated = new ArrayList < > ( ) ; for ( Method m : c . getDeclaredMethods ( ) ) { if ( m . isAnnotationPresent ( annotationType ) ) annotated . add ( m ) ; } return annotated ; } | Returns a set of Methods that contain the given method annotation . This includes all public protected package and private methods but not those of superclasses and interfaces . |
22,099 | private static boolean notFound ( Method m , Collection < Method > s ) { for ( Method found : s ) { if ( m . getName ( ) . equals ( found . getName ( ) ) && Arrays . equals ( m . getParameterTypes ( ) , found . getParameterTypes ( ) ) ) return false ; } return true ; } | Tests whether a method has already been found i . e . overridden . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.