idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
22,300 | protected final Object nonTxLockAndInvokeNext ( InvocationContext ctx , VisitableCommand command , LockPromise lockPromise , InvocationFinallyAction finallyFunction ) { return lockPromise . toInvocationStage ( ) . andHandle ( ctx , command , ( rCtx , rCommand , rv , throwable ) -> { if ( throwable != null ) { lockManager . unlockAll ( rCtx ) ; throw throwable ; } else { return invokeNextAndFinally ( rCtx , rCommand , finallyFunction ) ; } } ) ; } | Locks and invoke the next interceptor for non - transactional commands . |
22,301 | @ SuppressWarnings ( "UnusedParameters" ) public Object get ( Object session , Object key , long txTimestamp ) throws CacheException { if ( ! region . checkValid ( ) ) { return null ; } final Object val = cache . get ( key ) ; if ( val == null && session != null ) { putValidator . registerPendingPut ( session , key , txTimestamp ) ; } return val ; } | Attempt to retrieve an object from the cache . |
22,302 | @ SuppressWarnings ( "UnusedParameters" ) public boolean putFromLoad ( Object session , Object key , Object value , long txTimestamp , Object version , boolean minimalPutOverride ) throws CacheException { if ( ! region . checkValid ( ) ) { if ( trace ) { log . tracef ( "Region %s not valid" , region . getName ( ) ) ; } return false ; } if ( minimalPutOverride && cache . containsKey ( key ) ) { return false ; } PutFromLoadValidator . Lock lock = putValidator . acquirePutFromLoadLock ( session , key , txTimestamp ) ; if ( lock == null ) { if ( trace ) { log . tracef ( "Put from load lock not acquired for key %s" , key ) ; } return false ; } try { writeCache . putForExternalRead ( key , value ) ; } finally { putValidator . releasePutFromLoadLock ( key , lock ) ; } return true ; } | Attempt to cache an object after loading from the database explicitly specifying the minimalPut behavior . |
22,303 | private boolean isNull ( InternalCacheEntry < K , V > entry ) { if ( entry == null ) { return true ; } else if ( entry . canExpire ( ) ) { if ( entry . isExpired ( timeService . wallClockTime ( ) ) ) { if ( cacheNotifier . hasListener ( CacheEntryExpired . class ) ) { CompletionStages . join ( cacheNotifier . notifyCacheEntryExpired ( entry . getKey ( ) , entry . getValue ( ) , entry . getMetadata ( ) , ImmutableContext . INSTANCE ) ) ; } return true ; } } return false ; } | as we ll replace the old value when it s expired |
22,304 | private static < K , V > CacheStream < Entry < K , V > > cacheStreamCast ( CacheStream stream ) { return stream ; } | This is a hack to allow the cast to work . Java doesn t like subtypes in generics |
22,305 | public void contractStates ( ) { boolean contracted ; do { contracted = false ; for ( Iterator < State > iterator = states . iterator ( ) ; iterator . hasNext ( ) ; ) { State s = iterator . next ( ) ; if ( s . links . size ( ) == 1 && s . links . get ( 0 ) . type == LinkType . BACKTRACK ) { Link l = s . links . get ( 0 ) ; boolean contractedNow = false ; for ( State s2 : states ) { for ( Link l2 : s2 . links ) { if ( l2 . next == s && l2 . type != LinkType . SENTINEL ) { l2 . code = l2 . code + "\n" + l . code ; l2 . next = l . next ; contractedNow = true ; } } } if ( contractedNow ) { iterator . remove ( ) ; contracted = true ; } } } } while ( contracted ) ; for ( int i = 0 ; i < states . size ( ) ; ++ i ) { states . get ( i ) . id = i ; } } | Try to inline all states that contain only action and state shift . |
22,306 | public static String buildJmxDomain ( String domain , MBeanServer mBeanServer , String groupName ) { return findJmxDomain ( domain , mBeanServer , groupName ) ; } | Build the JMX domain name . |
22,307 | public static void registerMBean ( Object mbean , ObjectName objectName , MBeanServer mBeanServer ) throws Exception { if ( ! mBeanServer . isRegistered ( objectName ) ) { try { SecurityActions . registerMBean ( mbean , objectName , mBeanServer ) ; log . tracef ( "Registered %s under %s" , mbean , objectName ) ; } catch ( InstanceAlreadyExistsException e ) { log . couldNotRegisterObjectName ( objectName , e ) ; } } else { log . debugf ( "Object name %s already registered" , objectName ) ; } } | Register the given dynamic JMX MBean . |
22,308 | public static int unregisterMBeans ( String filter , MBeanServer mBeanServer ) { try { ObjectName filterObjName = new ObjectName ( filter ) ; Set < ObjectInstance > mbeans = mBeanServer . queryMBeans ( filterObjName , null ) ; for ( ObjectInstance mbean : mbeans ) { ObjectName name = mbean . getObjectName ( ) ; if ( trace ) log . trace ( "Unregistering mbean with name: " + name ) ; SecurityActions . unregisterMBean ( name , mBeanServer ) ; } return mbeans . size ( ) ; } catch ( Exception e ) { throw new CacheException ( "Unable to register mbeans with filter=" + filter , e ) ; } } | Unregister all mbeans whose object names match a given filter . |
22,309 | public void cacheStarting ( ComponentRegistry cr , Configuration cfg , String cacheName ) { InternalCacheRegistry icr = cr . getGlobalComponentRegistry ( ) . getComponent ( InternalCacheRegistry . class ) ; if ( ! icr . isInternalCache ( cacheName ) || icr . internalCacheHasFlag ( cacheName , Flag . QUERYABLE ) ) { AdvancedCache < ? , ? > cache = cr . getComponent ( Cache . class ) . getAdvancedCache ( ) ; ClassLoader aggregatedClassLoader = makeAggregatedClassLoader ( cr . getGlobalComponentRegistry ( ) . getGlobalConfiguration ( ) . classLoader ( ) ) ; SearchIntegrator searchFactory = null ; boolean isIndexed = cfg . indexing ( ) . index ( ) . isEnabled ( ) ; if ( isIndexed ) { setBooleanQueryMaxClauseCount ( ) ; cr . registerComponent ( new ShardAllocationManagerImpl ( ) , ShardAllocatorManager . class ) ; searchFactory = createSearchIntegrator ( cfg . indexing ( ) , cr , aggregatedClassLoader ) ; KeyTransformationHandler keyTransformationHandler = new KeyTransformationHandler ( aggregatedClassLoader ) ; cr . registerComponent ( keyTransformationHandler , KeyTransformationHandler . class ) ; createQueryInterceptorIfNeeded ( cr . getComponent ( BasicComponentRegistry . class ) , cfg , cache , searchFactory , keyTransformationHandler ) ; addCacheDependencyIfNeeded ( cacheName , cache . getCacheManager ( ) , cfg . indexing ( ) ) ; cr . registerComponent ( new QueryBox ( ) , QueryBox . class ) ; } registerMatcher ( cr , searchFactory , aggregatedClassLoader ) ; cr . registerComponent ( new EmbeddedQueryEngine ( cache , isIndexed ) , EmbeddedQueryEngine . class ) ; } } | Registers the Search interceptor in the cache before it gets started |
22,310 | private void checkIndexableClasses ( SearchIntegrator searchFactory , Set < Class < ? > > indexedEntities ) { for ( Class < ? > c : indexedEntities ) { if ( searchFactory . getIndexBinding ( new PojoIndexedTypeIdentifier ( c ) ) == null ) { throw log . classNotIndexable ( c . getName ( ) ) ; } } } | Check that the indexable classes declared by the user are really indexable . |
22,311 | private void registerQueryMBeans ( ComponentRegistry cr , Configuration cfg , SearchIntegrator searchIntegrator ) { AdvancedCache < ? , ? > cache = cr . getComponent ( Cache . class ) . getAdvancedCache ( ) ; GlobalJmxStatisticsConfiguration jmxConfig = cr . getGlobalComponentRegistry ( ) . getGlobalConfiguration ( ) . globalJmxStatistics ( ) ; if ( ! jmxConfig . enabled ( ) ) return ; if ( mbeanServer == null ) { mbeanServer = JmxUtil . lookupMBeanServer ( jmxConfig . mbeanServerLookup ( ) , jmxConfig . properties ( ) ) ; } String queryGroupName = getQueryGroupName ( jmxConfig . cacheManagerName ( ) , cache . getName ( ) ) ; String jmxDomain = JmxUtil . buildJmxDomain ( jmxConfig . domain ( ) , mbeanServer , queryGroupName ) ; try { ObjectName statsObjName = new ObjectName ( jmxDomain + ":" + queryGroupName + ",component=Statistics" ) ; InfinispanQueryStatisticsInfo stats = new InfinispanQueryStatisticsInfo ( searchIntegrator , statsObjName ) ; stats . setStatisticsEnabled ( cfg . jmxStatistics ( ) . enabled ( ) ) ; JmxUtil . registerMBean ( stats , statsObjName , mbeanServer ) ; cr . registerComponent ( stats , InfinispanQueryStatisticsInfo . class ) ; } catch ( Exception e ) { throw new CacheException ( "Unable to register query statistics MBean" , e ) ; } ManageableComponentMetadata massIndexerCompMetadata = cr . getGlobalComponentRegistry ( ) . getComponentMetadataRepo ( ) . findComponentMetadata ( MassIndexer . class ) . toManageableComponentMetadata ( ) ; try { KeyTransformationHandler keyTransformationHandler = ComponentRegistryUtils . getKeyTransformationHandler ( cache ) ; TimeService timeService = ComponentRegistryUtils . getTimeService ( cache ) ; DistributedExecutorMassIndexer massIndexer = new DistributedExecutorMassIndexer ( cache , searchIntegrator , keyTransformationHandler , timeService ) ; ResourceDMBean mbean = new ResourceDMBean ( massIndexer , massIndexerCompMetadata ) ; ObjectName massIndexerObjName = new ObjectName ( jmxDomain + ":" + queryGroupName + ",component=" + massIndexerCompMetadata . getJmxObjectName ( ) ) ; JmxUtil . registerMBean ( mbean , massIndexerObjName , mbeanServer ) ; } catch ( Exception e ) { throw new CacheException ( "Unable to create MassIndexer MBean" , e ) ; } } | Register query statistics and mass - indexer MBeans for a cache . |
22,312 | private ClassLoader makeAggregatedClassLoader ( ClassLoader globalClassLoader ) { Set < ClassLoader > classLoaders = new LinkedHashSet < > ( 6 ) ; if ( globalClassLoader != null ) { classLoaders . add ( globalClassLoader ) ; } classLoaders . add ( AggregatedClassLoader . class . getClassLoader ( ) ) ; classLoaders . add ( ClassLoaderService . class . getClassLoader ( ) ) ; classLoaders . add ( getClass ( ) . getClassLoader ( ) ) ; try { ClassLoader tccl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( tccl != null ) { classLoaders . add ( tccl ) ; } } catch ( Exception e ) { } try { ClassLoader syscl = ClassLoader . getSystemClassLoader ( ) ; if ( syscl != null ) { classLoaders . add ( syscl ) ; } } catch ( Exception e ) { } return new AggregatedClassLoader ( classLoaders ) ; } | Create a class loader that delegates loading to an ordered set of class loaders . |
22,313 | private void unregisterQueryMBeans ( ComponentRegistry cr , String cacheName ) { if ( mbeanServer != null ) { try { InfinispanQueryStatisticsInfo stats = cr . getComponent ( InfinispanQueryStatisticsInfo . class ) ; if ( stats != null ) { GlobalJmxStatisticsConfiguration jmxConfig = cr . getGlobalComponentRegistry ( ) . getGlobalConfiguration ( ) . globalJmxStatistics ( ) ; String queryGroupName = getQueryGroupName ( jmxConfig . cacheManagerName ( ) , cacheName ) ; String queryMBeanFilter = stats . getObjectName ( ) . getDomain ( ) + ":" + queryGroupName + ",*" ; JmxUtil . unregisterMBeans ( queryMBeanFilter , mbeanServer ) ; } } catch ( Exception e ) { throw new CacheException ( "Unable to unregister query MBeans" , e ) ; } } } | Unregister query related MBeans for a cache primarily the statistics but also all other MBeans from the same related group . |
22,314 | public final void stopTrack ( Flag track ) { setTrack ( track , false ) ; if ( ! trackStateTransfer && ! trackXSiteStateTransfer ) { if ( trace ) { log . tracef ( "Tracking is disabled. Clear tracker: %s" , tracker ) ; } tracker . clear ( ) ; } else { for ( Iterator < Map . Entry < Object , DiscardPolicy > > iterator = tracker . entrySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { if ( iterator . next ( ) . getValue ( ) . update ( trackStateTransfer , trackXSiteStateTransfer ) ) { iterator . remove ( ) ; } } } } | It stops tracking keys committed . |
22,315 | public final void commit ( final CacheEntry entry , final Flag operation , int segment , boolean l1Only , InvocationContext ctx ) { if ( trace ) { log . tracef ( "Trying to commit. Key=%s. Operation Flag=%s, L1 write/invalidation=%s" , toStr ( entry . getKey ( ) ) , operation , l1Only ) ; } if ( l1Only || ( operation == null && ! trackStateTransfer && ! trackXSiteStateTransfer ) ) { if ( trace ) { log . tracef ( "Committing key=%s. It is a L1 invalidation or a normal put and no tracking is enabled!" , toStr ( entry . getKey ( ) ) ) ; } commitEntry ( entry , segment , ctx ) ; return ; } if ( isTrackDisabled ( operation ) ) { if ( trace ) { log . tracef ( "Not committing key=%s. It is a state transfer key but no track is enabled!" , toStr ( entry . getKey ( ) ) ) ; } return ; } tracker . compute ( entry . getKey ( ) , ( o , discardPolicy ) -> { if ( discardPolicy != null && discardPolicy . ignore ( operation ) ) { if ( trace ) { log . tracef ( "Not committing key=%s. It was already overwritten! Discard policy=%s" , toStr ( entry . getKey ( ) ) , discardPolicy ) ; } return discardPolicy ; } commitEntry ( entry , segment , ctx ) ; DiscardPolicy newDiscardPolicy = calculateDiscardPolicy ( operation ) ; if ( trace ) { log . tracef ( "Committed key=%s. Old discard policy=%s. New discard policy=%s" , toStr ( entry . getKey ( ) ) , discardPolicy , newDiscardPolicy ) ; } return newDiscardPolicy ; } ) ; } | It tries to commit the cache entry . The entry is not committed if it is originated from state transfer and other operation already has updated it . |
22,316 | private void commitTransactions ( ) throws IOException { try { tm . commit ( ) ; } catch ( Exception e ) { log . unableToCommitTransaction ( e ) ; throw new IOException ( "SharedLuceneLock could not commit a transaction" , e ) ; } if ( trace ) { log . tracef ( "Batch transaction committed for index: %s" , indexName ) ; } } | Commits the existing transaction . It s illegal to call this if a transaction was not started . |
22,317 | public void clearLockSuspending ( ) { Transaction tx = null ; try { if ( ( tx = tm . getTransaction ( ) ) != null ) { tm . suspend ( ) ; } clearLock ( ) ; } catch ( Exception e ) { log . errorSuspendingTransaction ( e ) ; } finally { if ( tx != null ) { try { tm . resume ( tx ) ; } catch ( Exception e ) { throw new CacheException ( "Unable to resume suspended transaction " + tx , e ) ; } } } } | Will clear the lock eventually suspending a running transaction to make sure the release is immediately taking effect . |
22,318 | public void begin ( ) throws NotSupportedException , SystemException { Transaction currentTx ; if ( ( currentTx = getTransaction ( ) ) != null ) throw new NotSupportedException ( Thread . currentThread ( ) + " is already associated with a transaction (" + currentTx + ")" ) ; DummyTransaction tx = new DummyTransaction ( this ) ; setTransaction ( tx ) ; } | Starts a new transaction and associate it with the calling thread . |
22,319 | public void commit ( ) throws RollbackException , HeuristicMixedException , HeuristicRollbackException , SecurityException , IllegalStateException , SystemException { DummyTransaction tx = getTransaction ( ) ; if ( tx == null ) throw new IllegalStateException ( "thread not associated with transaction" ) ; tx . commit ( ) ; setTransaction ( null ) ; } | Commit the transaction associated with the calling thread . |
22,320 | public void rollback ( ) throws IllegalStateException , SecurityException , SystemException { Transaction tx = getTransaction ( ) ; if ( tx == null ) throw new IllegalStateException ( "no transaction associated with thread" ) ; tx . rollback ( ) ; setTransaction ( null ) ; } | Rolls back the transaction associated with the calling thread . |
22,321 | public void setRollbackOnly ( ) throws IllegalStateException , SystemException { Transaction tx = getTransaction ( ) ; if ( tx == null ) throw new IllegalStateException ( "no transaction associated with calling thread" ) ; tx . setRollbackOnly ( ) ; } | Mark the transaction associated with the calling thread for rollback only . |
22,322 | public Transaction suspend ( ) throws SystemException { Transaction retval = getTransaction ( ) ; setTransaction ( null ) ; if ( trace ) log . tracef ( "Suspending tx %s" , retval ) ; return retval ; } | Suspend the association the calling thread has to a transaction and return the suspended transaction . When returning from this method the calling thread is no longer associated with a transaction . |
22,323 | public void resume ( Transaction tx ) throws InvalidTransactionException , IllegalStateException , SystemException { if ( trace ) log . tracef ( "Resuming tx %s" , tx ) ; setTransaction ( tx ) ; } | Resume the association of the calling thread with the given transaction . |
22,324 | void removeFromIndexes ( TransactionContext transactionContext , Object key ) { Stream < IndexedTypeIdentifier > typeIdentifiers = getKnownClasses ( ) . stream ( ) . filter ( searchFactoryHandler :: hasIndex ) . map ( PojoIndexedTypeIdentifier :: new ) ; Set < Work > deleteWorks = typeIdentifiers . map ( e -> searchWorkCreator . createEntityWork ( keyToString ( key ) , e , WorkType . DELETE ) ) . collect ( Collectors . toSet ( ) ) ; performSearchWorks ( deleteWorks , transactionContext ) ; } | Remove entries from all indexes by key . |
22,325 | private void removeFromIndexes ( Object value , Object key , TransactionContext transactionContext ) { performSearchWork ( value , keyToString ( key ) , WorkType . DELETE , transactionContext ) ; } | Method that will be called when data needs to be removed from Lucene . |
22,326 | void sendHeaderAndCounterNameAndRead ( Channel channel ) { ByteBuf buf = getHeaderAndCounterNameBufferAndRead ( channel , 0 ) ; channel . writeAndFlush ( buf ) ; } | Writes the operation header followed by the counter s name . |
22,327 | protected Spliterator < InternalCacheEntry < K , V > > filterExpiredEntries ( Spliterator < InternalCacheEntry < K , V > > spliterator ) { long accessTime = timeService . wallClockTime ( ) ; return new FilterSpliterator < > ( spliterator , expiredIterationPredicate ( accessTime ) ) ; } | Returns a new spliterator that will not return entries that have expired . |
22,328 | protected Predicate < InternalCacheEntry < K , V > > expiredIterationPredicate ( long accessTime ) { return e -> ! e . canExpire ( ) || ! ( e . isExpired ( accessTime ) && expirationManager . entryExpiredInMemoryFromIteration ( e , accessTime ) . join ( ) == Boolean . TRUE ) ; } | Returns a predicate that will return false when an entry is expired . This predicate assumes this is invoked from an iteration process . |
22,329 | void rollbackTransaction ( HotRodHeader header , Subject subject , XidImpl xid ) { RollbackTransactionOperation operation = new RollbackTransactionOperation ( header , server , subject , xid , this :: writeTransactionResponse ) ; executor . execute ( operation ) ; } | Handles a rollback request from a client . |
22,330 | void commitTransaction ( HotRodHeader header , Subject subject , XidImpl xid ) { CommitTransactionOperation operation = new CommitTransactionOperation ( header , server , subject , xid , this :: writeTransactionResponse ) ; executor . execute ( operation ) ; } | Handles a commit request from a client |
22,331 | void prepareTransaction ( HotRodHeader header , Subject subject , XidImpl xid , boolean onePhaseCommit , List < TransactionWrite > writes , boolean recoverable , long timeout ) { HotRodServer . CacheInfo cacheInfo = server . getCacheInfo ( header ) ; AdvancedCache < byte [ ] , byte [ ] > cache = server . cache ( cacheInfo , header , subject ) ; validateConfiguration ( cache ) ; executor . execute ( ( ) -> prepareTransactionInternal ( header , cache , cacheInfo . versionGenerator , xid , onePhaseCommit , writes , recoverable , timeout ) ) ; } | Handles a prepare request from a client |
22,332 | private boolean isValid ( TransactionWrite write , AdvancedCache < byte [ ] , byte [ ] > readCache ) { if ( write . skipRead ( ) ) { if ( isTrace ) { log . tracef ( "Operation %s wasn't read." , write ) ; } return true ; } CacheEntry < byte [ ] , byte [ ] > entry = readCache . getCacheEntry ( write . key ) ; if ( write . wasNonExisting ( ) ) { if ( isTrace ) { log . tracef ( "Key didn't exist for operation %s. Entry is %s" , write , entry ) ; } return entry == null || entry . getValue ( ) == null ; } if ( isTrace ) { log . tracef ( "Checking version for operation %s. Entry is %s" , write , entry ) ; } return entry != null && write . versionRead == MetadataUtils . extractVersion ( entry ) ; } | Validates if the value read is still valid and the write operation can proceed . |
22,333 | public CommonTree parseQuery ( String queryString , QueryResolverDelegate resolverDelegate , QueryRendererDelegate rendererDelegate ) throws ParsingException { IckleLexer lexer = new IckleLexer ( new ANTLRStringStream ( queryString ) ) ; CommonTokenStream tokens = new CommonTokenStream ( lexer ) ; IckleParser parser = new IckleParser ( tokens ) ; try { IckleParser . statement_return r = parser . statement ( ) ; if ( parser . hasErrors ( ) ) { throw log . getQuerySyntaxException ( queryString , parser . getErrorMessages ( ) ) ; } CommonTree tree = ( CommonTree ) r . getTree ( ) ; tree = resolve ( tokens , tree , resolverDelegate ) ; tree = render ( tokens , tree , rendererDelegate ) ; return tree ; } catch ( RecognitionException e ) { throw log . getQuerySyntaxException ( queryString , e ) ; } } | Parses the given query string . |
22,334 | private String serializeObj ( WrappedByteArray mv ) throws Exception { return Base64 . getEncoder ( ) . encodeToString ( mv . getBytes ( ) ) ; } | Use MarshalledValue . Externalizer to serialize . |
22,335 | private WrappedByteArray deserializeObj ( String key ) throws Exception { byte [ ] data = Base64 . getDecoder ( ) . decode ( key ) ; return new WrappedByteArray ( data ) ; } | Use MarshalledValue . Externalizer to deserialize . |
22,336 | public static IntSet from ( Set < Integer > integerSet ) { if ( integerSet instanceof IntSet ) { return ( IntSet ) integerSet ; } int size = integerSet . size ( ) ; switch ( size ) { case 0 : return EmptyIntSet . getInstance ( ) ; case 1 : return new SingletonIntSet ( integerSet . iterator ( ) . next ( ) ) ; default : return new SmallIntSet ( integerSet ) ; } } | Returns an IntSet based on the provided Set . This method tries to return or create the most performant IntSet based on the Set provided . If the Set is already an IntSet it will just return that . The returned IntSet may or may not be immutable so no guarantees are provided from that respect . |
22,337 | public static IntSet from ( PrimitiveIterator . OfInt iterator ) { boolean hasNext = iterator . hasNext ( ) ; if ( ! hasNext ) { return EmptyIntSet . getInstance ( ) ; } int firstValue = iterator . nextInt ( ) ; hasNext = iterator . hasNext ( ) ; if ( ! hasNext ) { return new SingletonIntSet ( firstValue ) ; } SmallIntSet set = new SmallIntSet ( ) ; set . set ( firstValue ) ; iterator . forEachRemaining ( ( IntConsumer ) set :: set ) ; return set ; } | Returns an IntSet based on the ints in the iterator . This method will try to return the most performant IntSet based on what ints are provided if any . The returned IntSet may or may not be immutable so no guarantees are provided from that respect . |
22,338 | public static IntSet mutableFrom ( Set < Integer > integerSet ) { if ( integerSet instanceof SmallIntSet ) { return ( SmallIntSet ) integerSet ; } if ( integerSet instanceof ConcurrentSmallIntSet ) { return ( ConcurrentSmallIntSet ) integerSet ; } return mutableCopyFrom ( integerSet ) ; } | Returns an IntSet that is mutable that contains all of the values from the given set . If this provided Set is already an IntSet and mutable it will return the same object . |
22,339 | public static IntSet mutableCopyFrom ( Set < Integer > mutableSet ) { if ( mutableSet instanceof SingletonIntSet ) { return mutableSet ( ( ( SingletonIntSet ) mutableSet ) . value ) ; } return new SmallIntSet ( mutableSet ) ; } | Returns an IntSet that contains all ints from the given Set that is mutable . Updates to the original Set or the returned IntSet are not reflected in the other . |
22,340 | public static IntSet concurrentCopyFrom ( IntSet intSet , int maxExclusive ) { ConcurrentSmallIntSet cis = new ConcurrentSmallIntSet ( maxExclusive ) ; intSet . forEach ( ( IntConsumer ) cis :: set ) ; return cis ; } | Returns a copy of the given set that supports concurrent operations . The returned set will contain all of the ints the provided set contained . The returned set only supports up to the maximum size the previous int set supported when this method is invoked or the largest int it held . |
22,341 | static < K , V > boolean isRegistered ( AbstractJCache < K , V > cache , ObjectNameType objectNameType ) { Set < ObjectName > registeredObjectNames ; MBeanServer mBeanServer = cache . getMBeanServer ( ) ; if ( mBeanServer != null ) { ObjectName objectName = calculateObjectName ( cache , objectNameType ) ; registeredObjectNames = SecurityActions . queryNames ( objectName , null , mBeanServer ) ; return ! registeredObjectNames . isEmpty ( ) ; } else { return false ; } } | Checks whether an ObjectName is already registered . |
22,342 | public < K , V > RemoteCache < K , V > getCache ( String cacheName ) { return getCache ( cacheName , configuration . forceReturnValues ( ) , null , null ) ; } | Retrieves a named cache from the remote server if the cache has been defined otherwise if the cache name is undefined it will return null . |
22,343 | public < K , V > RemoteCache < K , V > getCache ( ) { return getCache ( configuration . forceReturnValues ( ) ) ; } | Retrieves the default cache from the remote server . |
22,344 | public void stop ( ) { if ( isStarted ( ) ) { log . debugf ( "Stopping remote cache manager %x" , System . identityHashCode ( this ) ) ; synchronized ( cacheName2RemoteCache ) { for ( Map . Entry < RemoteCacheKey , RemoteCacheHolder > cache : cacheName2RemoteCache . entrySet ( ) ) { cache . getValue ( ) . remoteCache ( ) . stop ( ) ; } cacheName2RemoteCache . clear ( ) ; } listenerNotifier . stop ( ) ; counterManager . stop ( ) ; channelFactory . destroy ( ) ; } unregisterMBean ( ) ; started = false ; } | Stop the remote cache manager disconnecting all existing connections . As part of the disconnection all registered client cache listeners will be removed since client no longer can receive callbacks . |
22,345 | private void initRemoteCache ( RemoteCacheImpl remoteCache , OperationsFactory operationsFactory ) { if ( configuration . statistics ( ) . jmxEnabled ( ) ) { remoteCache . init ( marshaller , operationsFactory , configuration . keySizeEstimate ( ) , configuration . valueSizeEstimate ( ) , configuration . batchSize ( ) , mbeanObjectName ) ; } else { remoteCache . init ( marshaller , operationsFactory , configuration . keySizeEstimate ( ) , configuration . valueSizeEstimate ( ) , configuration . batchSize ( ) ) ; } } | Method that handles cache initialization - needed as a placeholder |
22,346 | public static < E > Set < E > difference ( Set < ? extends E > s1 , Set < ? extends E > s2 ) { Set < E > copy1 = new HashSet < > ( s1 ) ; copy1 . removeAll ( new HashSet < > ( s2 ) ) ; return copy1 ; } | Returns the elements that are present in s1 but which are not present in s2 without changing the contents of neither s1 nor s2 . |
22,347 | public void cacheComponents ( ) { stateTransferManager = basicComponentRegistry . getComponent ( StateTransferManager . class ) . wired ( ) ; responseGenerator = basicComponentRegistry . getComponent ( ResponseGenerator . class ) . wired ( ) ; commandsFactory = basicComponentRegistry . getComponent ( CommandsFactory . class ) . wired ( ) ; stateTransferLock = basicComponentRegistry . getComponent ( StateTransferLock . class ) . wired ( ) ; inboundInvocationHandler = basicComponentRegistry . getComponent ( PerCacheInboundInvocationHandler . class ) . wired ( ) ; versionGenerator = basicComponentRegistry . getComponent ( VersionGenerator . class ) . wired ( ) ; distributionManager = basicComponentRegistry . getComponent ( DistributionManager . class ) . wired ( ) ; basicComponentRegistry . getComponent ( ClusterCacheStats . class ) ; basicComponentRegistry . getComponent ( CacheConfigurationMBean . class ) ; basicComponentRegistry . getComponent ( InternalConflictManager . class ) ; basicComponentRegistry . getComponent ( LocalStreamManager . class ) ; basicComponentRegistry . getComponent ( ClusterStreamManager . class ) ; basicComponentRegistry . getComponent ( ClusterPublisherManager . class ) ; basicComponentRegistry . getComponent ( XSiteStateTransferManager . class ) ; basicComponentRegistry . getComponent ( BackupSender . class ) ; basicComponentRegistry . getComponent ( StateTransferManager . class ) ; basicComponentRegistry . getComponent ( StateReceiver . class ) ; basicComponentRegistry . getComponent ( PreloadManager . class ) ; } | Invoked last after all services are wired |
22,348 | public CacheStream < R > filter ( Predicate < ? super R > predicate ) { return addIntermediateOperation ( new FilterOperation < > ( predicate ) ) ; } | Intermediate operations that are stored for lazy evalulation |
22,349 | public R reduce ( R identity , BinaryOperator < R > accumulator ) { return performOperation ( TerminalFunctions . reduceFunction ( identity , accumulator ) , true , accumulator , null ) ; } | Now we have terminal operators |
22,350 | public Iterator < R > iterator ( ) { log . tracef ( "Distributed iterator invoked with rehash: %s" , rehashAware ) ; if ( ! rehashAware ) { CloseableIterator < R > closeableIterator = nonRehashRemoteIterator ( dm . getReadConsistentHash ( ) , segmentsToFilter , null , IdentityPublisherDecorator . getInstance ( ) , intermediateOperations ) ; onClose ( closeableIterator :: close ) ; return closeableIterator ; } else { Iterable < IntermediateOperation > ops = iteratorOperation . prepareForIteration ( intermediateOperations , ( Function ) nonNullKeyFunction ( ) ) ; CloseableIterator < R > closeableIterator ; if ( segmentCompletionListener != null && iteratorOperation != IteratorOperation . FLAT_MAP ) { closeableIterator = new CompletionListenerRehashIterator < > ( ops , segmentCompletionListener ) ; } else { closeableIterator = new RehashIterator < > ( ops ) ; } onClose ( closeableIterator :: close ) ; Function < R , R > function = iteratorOperation . getFunction ( ) ; if ( function != null ) { return new IteratorMapper < > ( closeableIterator , function ) ; } else { return closeableIterator ; } } } | The next ones are key tracking terminal operators |
22,351 | private static ProtobufMetadataManagerImpl getProtobufMetadataManager ( EmbeddedCacheManager cacheManager ) { if ( cacheManager == null ) { throw new IllegalArgumentException ( "cacheManager cannot be null" ) ; } ProtobufMetadataManagerImpl metadataManager = ( ProtobufMetadataManagerImpl ) cacheManager . getGlobalComponentRegistry ( ) . getComponent ( ProtobufMetadataManager . class ) ; if ( metadataManager == null ) { throw new IllegalStateException ( "ProtobufMetadataManager not initialised yet!" ) ; } return metadataManager ; } | Obtains the ProtobufMetadataManagerImpl instance associated to a cache manager . |
22,352 | public static boolean isStoreMetadata ( Metadata metadata , InternalCacheEntry ice ) { return metadata != null && ( ice == null || isEntryMetadataAware ( ice ) ) && ( metadata . version ( ) != null || ! ( metadata instanceof EmbeddedMetadata ) ) ; } | Indicates whether the entire metadata object needs to be stored or not . |
22,353 | @ SuppressWarnings ( "unchecked" ) public < T > Attribute < T > attribute ( String name ) { return ( Attribute < T > ) this . attributes . get ( name ) ; } | Returns the named attribute |
22,354 | public void read ( AttributeSet other ) { for ( Iterator < Attribute < ? > > iterator = attributes . values ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { Attribute < Object > attribute = ( Attribute < Object > ) iterator . next ( ) ; Attribute < Object > a = other . attribute ( attribute . name ( ) ) ; if ( a . isModified ( ) ) { attribute . read ( a ) ; } } } | Copies all attribute from another AttributeSet |
22,355 | public void write ( XMLStreamWriter writer , String xmlElementName ) throws XMLStreamException { if ( isModified ( ) ) { writer . writeStartElement ( xmlElementName ) ; write ( writer ) ; writer . writeEndElement ( ) ; } } | Writes this attributeset to the specified XMLStreamWriter as an element |
22,356 | public void write ( XMLStreamWriter writer , String xmlElementName , AttributeDefinition < ? > ... defs ) throws XMLStreamException { boolean skip = true ; for ( AttributeDefinition def : defs ) { skip = skip && ! attribute ( def ) . isModified ( ) ; } if ( ! skip ) { writer . writeStartElement ( xmlElementName ) ; for ( AttributeDefinition def : defs ) { Attribute attr = attribute ( def ) ; attr . write ( writer , attr . getAttributeDefinition ( ) . xmlName ( ) ) ; } writer . writeEndElement ( ) ; } } | Writes the specified attributes in this attributeset to the specified XMLStreamWriter as an element |
22,357 | public void write ( XMLStreamWriter writer ) throws XMLStreamException { for ( Attribute < ? > attr : attributes . values ( ) ) { if ( attr . isPersistent ( ) ) attr . write ( writer , attr . getAttributeDefinition ( ) . xmlName ( ) ) ; } } | Writes the attributes of this attributeset as part of the current element |
22,358 | private void setBufferToCurrentChunkIfPossible ( ) { ChunkCacheKey key = new ChunkCacheKey ( fileKey . getIndexName ( ) , filename , currentLoadedChunk , chunkSize , affinitySegmentId ) ; buffer = ( byte [ ] ) chunksCache . get ( key ) ; if ( buffer == null ) { currentLoadedChunk -- ; bufferPosition = chunkSize ; } else { currentBufferSize = buffer . length ; } } | RAMDirectory teaches to position the cursor to the end of previous chunk in this case |
22,359 | public static BuildContext newDirectoryInstance ( Cache < ? , ? > metadataCache , Cache < ? , ? > chunksCache , Cache < ? , ? > distLocksCache , String indexName ) { validateIndexCaches ( indexName , metadataCache , chunksCache , distLocksCache ) ; return new DirectoryBuilderImpl ( metadataCache , chunksCache , distLocksCache , indexName ) ; } | Starting point to create a Directory instance . |
22,360 | public static Features isAvailableOrThrowException ( Features features , String feature , ClassLoader classLoader ) { if ( features == null ) { features = new Features ( classLoader ) ; } isAvailableOrThrowException ( features , feature ) ; return features ; } | Verify that the specified feature is enabled . Initializes features if the provided one is null allowing for lazily initialized Features instance . |
22,361 | public S idColumnName ( String idColumnName ) { attributes . attribute ( ID_COLUMN_NAME ) . set ( idColumnName ) ; return self ( ) ; } | The name of the database column used to store the keys |
22,362 | public S idColumnType ( String idColumnType ) { attributes . attribute ( ID_COLUMN_TYPE ) . set ( idColumnType ) ; return self ( ) ; } | The type of the database column used to store the keys |
22,363 | public S dataColumnName ( String dataColumnName ) { attributes . attribute ( DATA_COLUMN_NAME ) . set ( dataColumnName ) ; return self ( ) ; } | The name of the database column used to store the entries |
22,364 | public S dataColumnType ( String dataColumnType ) { attributes . attribute ( DATA_COLUMN_TYPE ) . set ( dataColumnType ) ; return self ( ) ; } | The type of the database column used to store the entries |
22,365 | public S timestampColumnName ( String timestampColumnName ) { attributes . attribute ( TIMESTAMP_COLUMN_NAME ) . set ( timestampColumnName ) ; return self ( ) ; } | The name of the database column used to store the timestamps |
22,366 | public S timestampColumnType ( String timestampColumnType ) { attributes . attribute ( TIMESTAMP_COLUMN_TYPE ) . set ( timestampColumnType ) ; return self ( ) ; } | The type of the database column used to store the timestamps |
22,367 | public S segmentColumnName ( String segmentColumnName ) { attributes . attribute ( SEGMENT_COLUMN_NAME ) . set ( segmentColumnName ) ; return self ( ) ; } | The name of the database column used to store the segments |
22,368 | public S segmentColumnType ( String segmentColumnType ) { attributes . attribute ( SEGMENT_COLUMN_TYPE ) . set ( segmentColumnType ) ; return self ( ) ; } | The type of the database column used to store the segments |
22,369 | public final synchronized boolean waitUntilPrepared ( boolean commit ) throws InterruptedException { boolean result ; State state = commit ? State . COMMIT_ONLY : State . ROLLBACK_ONLY ; if ( trace ) { log . tracef ( "[%s] Current status is %s, setting status to: %s" , globalTransaction . globalId ( ) , transactionState , state ) ; } transactionState . add ( state ) ; if ( transactionState . contains ( State . PREPARED ) ) { result = true ; if ( trace ) { log . tracef ( "[%s] Transaction is PREPARED" , globalTransaction . globalId ( ) ) ; } } else if ( transactionState . contains ( State . PREPARING ) ) { wait ( ) ; result = true ; if ( trace ) { log . tracef ( "[%s] Transaction was in PREPARING state but now it is prepared" , globalTransaction . globalId ( ) ) ; } } else { if ( trace ) { log . tracef ( "[%s] Transaction is not delivered yet" , globalTransaction . globalId ( ) ) ; } result = false ; } return result ; } | Commit and rollback commands invokes this method and they are blocked here if the state is PREPARING |
22,370 | public < C > void addContinuousQueryListener ( Query query , ContinuousQueryListener < K , C > listener ) { addContinuousQueryListener ( query . getQueryString ( ) , query . getParameters ( ) , listener ) ; } | Registers a continuous query listener that uses a query DSL based filter . The listener will receive notifications when a cache entry joins or leaves the matching set defined by the query . |
22,371 | public < A extends Annotation > CacheKeyInvocationContext < A > getCacheKeyInvocationContext ( InvocationContext invocationContext ) { assertNotNull ( invocationContext , "invocationContext parameter must not be null" ) ; final MethodMetaData < A > methodMetaData = ( MethodMetaData < A > ) getMethodMetaData ( invocationContext . getMethod ( ) ) ; return new CacheKeyInvocationContextImpl < A > ( invocationContext , methodMetaData ) ; } | Returns the cache key invocation context corresponding to the given invocation context . |
22,372 | private MethodMetaData < ? extends Annotation > getMethodMetaData ( Method method ) { MethodMetaData < ? extends Annotation > methodMetaData = methodMetaDataCache . get ( method ) ; if ( methodMetaData == null ) { final String cacheName ; final Annotation cacheAnnotation ; final AggregatedParameterMetaData aggregatedParameterMetaData ; final CacheKeyGenerator cacheKeyGenerator ; final CacheDefaults cacheDefaultsAnnotation = method . getDeclaringClass ( ) . getAnnotation ( CacheDefaults . class ) ; if ( method . isAnnotationPresent ( CacheResult . class ) ) { final CacheResult cacheResultAnnotation = method . getAnnotation ( CacheResult . class ) ; cacheKeyGenerator = getCacheKeyGenerator ( beanManager , cacheResultAnnotation . cacheKeyGenerator ( ) , cacheDefaultsAnnotation ) ; cacheName = getCacheName ( method , cacheResultAnnotation . cacheName ( ) , cacheDefaultsAnnotation , true ) ; aggregatedParameterMetaData = getAggregatedParameterMetaData ( method , false ) ; cacheAnnotation = cacheResultAnnotation ; } else if ( method . isAnnotationPresent ( CacheRemove . class ) ) { final CacheRemove cacheRemoveEntryAnnotation = method . getAnnotation ( CacheRemove . class ) ; cacheKeyGenerator = getCacheKeyGenerator ( beanManager , cacheRemoveEntryAnnotation . cacheKeyGenerator ( ) , cacheDefaultsAnnotation ) ; cacheName = getCacheName ( method , cacheRemoveEntryAnnotation . cacheName ( ) , cacheDefaultsAnnotation , false ) ; aggregatedParameterMetaData = getAggregatedParameterMetaData ( method , false ) ; cacheAnnotation = cacheRemoveEntryAnnotation ; if ( cacheName . isEmpty ( ) ) { throw log . cacheRemoveEntryMethodWithoutCacheName ( method . getName ( ) ) ; } } else if ( method . isAnnotationPresent ( CacheRemoveAll . class ) ) { final CacheRemoveAll cacheRemoveAllAnnotation = method . getAnnotation ( CacheRemoveAll . class ) ; cacheKeyGenerator = null ; cacheName = getCacheName ( method , cacheRemoveAllAnnotation . cacheName ( ) , cacheDefaultsAnnotation , false ) ; aggregatedParameterMetaData = getAggregatedParameterMetaData ( method , false ) ; cacheAnnotation = cacheRemoveAllAnnotation ; if ( cacheName . isEmpty ( ) ) { throw log . cacheRemoveAllMethodWithoutCacheName ( method . getName ( ) ) ; } } else if ( method . isAnnotationPresent ( CachePut . class ) ) { final CachePut cachePutAnnotation = method . getAnnotation ( CachePut . class ) ; cacheKeyGenerator = getCacheKeyGenerator ( beanManager , cachePutAnnotation . cacheKeyGenerator ( ) , cacheDefaultsAnnotation ) ; cacheName = getCacheName ( method , cachePutAnnotation . cacheName ( ) , cacheDefaultsAnnotation , true ) ; aggregatedParameterMetaData = getAggregatedParameterMetaData ( method , true ) ; cacheAnnotation = cachePutAnnotation ; } else { throw log . methodWithoutCacheAnnotation ( method . getName ( ) ) ; } final MethodMetaData < ? extends Annotation > newCacheMethodMetaData = new MethodMetaData < Annotation > ( method , aggregatedParameterMetaData , asSet ( method . getAnnotations ( ) ) , cacheKeyGenerator , cacheAnnotation , cacheName ) ; methodMetaData = methodMetaDataCache . putIfAbsent ( method , newCacheMethodMetaData ) ; if ( methodMetaData == null ) { methodMetaData = newCacheMethodMetaData ; } } return methodMetaData ; } | Returns the method meta data for the given method . |
22,373 | private AggregatedParameterMetaData getAggregatedParameterMetaData ( Method method , boolean cacheValueAllowed ) { final Class < ? > [ ] parameterTypes = method . getParameterTypes ( ) ; final Annotation [ ] [ ] parameterAnnotations = method . getParameterAnnotations ( ) ; final List < ParameterMetaData > parameters = new ArrayList < ParameterMetaData > ( ) ; final List < ParameterMetaData > keyParameters = new ArrayList < ParameterMetaData > ( ) ; ParameterMetaData valueParameter = null ; for ( int i = 0 ; i < parameterTypes . length ; i ++ ) { final Set < Annotation > annotations = asSet ( parameterAnnotations [ i ] ) ; final ParameterMetaData parameterMetaData = new ParameterMetaData ( parameterTypes [ i ] , i , annotations ) ; for ( Annotation oneAnnotation : annotations ) { final Class < ? > type = oneAnnotation . annotationType ( ) ; if ( CacheKey . class . equals ( type ) ) { keyParameters . add ( parameterMetaData ) ; } else if ( cacheValueAllowed && CacheValue . class . equals ( type ) ) { if ( valueParameter != null ) { throw log . cachePutMethodWithMoreThanOneCacheValueParameter ( method . getName ( ) ) ; } valueParameter = parameterMetaData ; } } parameters . add ( parameterMetaData ) ; } if ( cacheValueAllowed && valueParameter == null ) { if ( parameters . size ( ) > 1 ) { throw log . cachePutMethodWithoutCacheValueParameter ( method . getName ( ) ) ; } valueParameter = parameters . get ( 0 ) ; } if ( keyParameters . isEmpty ( ) ) { keyParameters . addAll ( parameters ) ; } if ( valueParameter != null && keyParameters . size ( ) > 1 ) { keyParameters . remove ( valueParameter ) ; } return new AggregatedParameterMetaData ( parameters , keyParameters , valueParameter ) ; } | Returns the aggregated parameter meta data for the given method . |
22,374 | public static void registerProtoFiles ( SerializationContext ctx ) throws IOException { FileDescriptorSource fileDescriptorSource = new FileDescriptorSource ( ) ; fileDescriptorSource . addProtoFile ( QUERY_PROTO_RES , MarshallerRegistration . class . getResourceAsStream ( QUERY_PROTO_RES ) ) ; fileDescriptorSource . addProtoFile ( MESSAGE_PROTO_RES , MarshallerRegistration . class . getResourceAsStream ( MESSAGE_PROTO_RES ) ) ; ctx . registerProtoFiles ( fileDescriptorSource ) ; } | Registers proto files . |
22,375 | public static void registerMarshallers ( SerializationContext ctx ) { ctx . registerMarshaller ( new QueryRequest . NamedParameter . Marshaller ( ) ) ; ctx . registerMarshaller ( new QueryRequest . Marshaller ( ) ) ; ctx . registerMarshaller ( new QueryResponse . Marshaller ( ) ) ; ctx . registerMarshaller ( new FilterResultMarshaller ( ) ) ; ctx . registerMarshaller ( new ContinuousQueryResult . ResultType . Marshaller ( ) ) ; ctx . registerMarshaller ( new ContinuousQueryResult . Marshaller ( ) ) ; } | Registers marshallers . |
22,376 | Double getSum ( ) { if ( count == 0 ) { return null ; } double tmp = sum + sumCompensation ; if ( Double . isNaN ( tmp ) && Double . isInfinite ( simpleSum ) ) { return simpleSum ; } else { return tmp ; } } | Returns the sum of seen values . If any value is a NaN or the sum is at any point a NaN then the average will be NaN . The average returned can vary depending upon the order in which values are seen . |
22,377 | public static ModelNode createReadAttributeOperation ( PathAddress address , String name ) { return createAttributeOperation ( ModelDescriptionConstants . READ_ATTRIBUTE_OPERATION , address , name ) ; } | Creates a read - attribute operation using the specified address and name . |
22,378 | public static ModelNode createWriteAttributeOperation ( PathAddress address , String name , ModelNode value ) { ModelNode operation = createAttributeOperation ( ModelDescriptionConstants . WRITE_ATTRIBUTE_OPERATION , address , name ) ; operation . get ( ModelDescriptionConstants . VALUE ) . set ( value ) ; return operation ; } | Creates a write - attribute operation using the specified address namem and value . |
22,379 | public static ModelNode createUndefineAttributeOperation ( PathAddress address , String name ) { return createAttributeOperation ( ModelDescriptionConstants . UNDEFINE_ATTRIBUTE_OPERATION , address , name ) ; } | Creates an undefine - attribute operation using the specified address and name . |
22,380 | public TransactionConfigurationBuilder transactionManagerLookup ( TransactionManagerLookup tml ) { attributes . attribute ( TRANSACTION_MANAGER_LOOKUP ) . set ( tml ) ; if ( tml != null ) { this . transactionMode ( TransactionMode . TRANSACTIONAL ) ; } return this ; } | Configure Transaction manager lookup directly using an instance of TransactionManagerLookup . Calling this method marks the cache as transactional . |
22,381 | void addFileName ( final String fileName ) { writeLock . lock ( ) ; try { final FileListCacheValue fileList = getFileList ( ) ; boolean done = fileList . add ( fileName ) ; if ( done ) { updateFileList ( fileList ) ; if ( trace ) log . trace ( "Updated file listing: added " + fileName ) ; } } finally { writeLock . unlock ( ) ; } } | Adds a new fileName in the list of files making up this index |
22,382 | public void removeAndAdd ( final String toRemove , final String toAdd ) { writeLock . lock ( ) ; try { FileListCacheValue fileList = getFileList ( ) ; boolean done = fileList . addAndRemove ( toAdd , toRemove ) ; if ( done ) { updateFileList ( fileList ) ; if ( trace ) { log . trace ( "Updated file listing: added " + toAdd + " and removed " + toRemove ) ; } } } finally { writeLock . unlock ( ) ; } } | Optimized implementation to perform both a remove and an add |
22,383 | public void deleteFileName ( final String fileName ) { writeLock . lock ( ) ; try { FileListCacheValue fileList = getFileList ( ) ; boolean done = fileList . remove ( fileName ) ; if ( done ) { updateFileList ( fileList ) ; if ( trace ) log . trace ( "Updated file listing: removed " + fileName ) ; } } finally { writeLock . unlock ( ) ; } } | Deleted a file from the list of files actively part of the index |
22,384 | @ GuardedBy ( "writeLock" ) private void updateFileList ( FileListCacheValue fileList ) { if ( writeAsync ) { cacheNoRetrieve . putAsync ( fileListCacheKey , fileList ) ; } else { if ( trace ) { log . tracef ( "Updating file listing view from %s" , getAddress ( cacheNoRetrieve ) ) ; } cacheNoRetrieve . put ( fileListCacheKey , fileList ) ; } } | Makes sure the Cache is updated . |
22,385 | protected void injectDependencies ( Cache cache ) { this . queryCache = cache . getCacheManager ( ) . getGlobalComponentRegistry ( ) . getComponent ( QueryCache . class ) ; ComponentRegistry componentRegistry = cache . getAdvancedCache ( ) . getComponentRegistry ( ) ; matcher = componentRegistry . getComponent ( matcherImplClass ) ; if ( matcher == null ) { throw new CacheException ( "Expected component not found in registry: " + matcherImplClass . getName ( ) ) ; } } | Acquires a Matcher instance from the ComponentRegistry of the given Cache object . |
22,386 | public Cache < K , V > createCache ( Configuration configuration , GlobalComponentRegistry globalComponentRegistry , String cacheName ) throws CacheConfigurationException { try { if ( configuration . compatibility ( ) . enabled ( ) ) { log . warnCompatibilityDeprecated ( cacheName ) ; } if ( configuration . simpleCache ( ) ) { return createSimpleCache ( configuration , globalComponentRegistry , cacheName ) ; } else { return createAndWire ( configuration , globalComponentRegistry , cacheName ) ; } } catch ( RuntimeException re ) { throw re ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } | This implementation clones the configuration passed in before using it . |
22,387 | private void bootstrap ( String cacheName , AdvancedCache < ? , ? > cache , Configuration configuration , GlobalComponentRegistry globalComponentRegistry , StreamingMarshaller globalMarshaller ) { this . configuration = configuration ; componentRegistry = new ComponentRegistry ( cacheName , configuration , cache , globalComponentRegistry , globalComponentRegistry . getClassLoader ( ) ) ; EncoderRegistry encoderRegistry = globalComponentRegistry . getComponent ( EncoderRegistry . class ) ; if ( configuration . compatibility ( ) . enabled ( ) && configuration . compatibility ( ) . marshaller ( ) != null ) { Marshaller marshaller = configuration . compatibility ( ) . marshaller ( ) ; componentRegistry . wireDependencies ( marshaller ) ; if ( ! encoderRegistry . isConversionSupported ( MediaType . APPLICATION_OBJECT , marshaller . mediaType ( ) ) ) { encoderRegistry . registerTranscoder ( new TranscoderMarshallerAdapter ( marshaller ) ) ; } } encoderRegistry . registerTranscoder ( new TranscoderMarshallerAdapter ( globalMarshaller ) ) ; basicComponentRegistry = componentRegistry . getComponent ( BasicComponentRegistry . class ) ; basicComponentRegistry . registerAlias ( Cache . class . getName ( ) , AdvancedCache . class . getName ( ) , AdvancedCache . class ) ; basicComponentRegistry . registerComponent ( AdvancedCache . class . getName ( ) , cache , false ) ; componentRegistry . registerComponent ( new CacheJmxRegistration ( ) , CacheJmxRegistration . class . getName ( ) , true ) ; if ( configuration . transaction ( ) . recovery ( ) . enabled ( ) ) { componentRegistry . registerComponent ( new RecoveryAdminOperations ( ) , RecoveryAdminOperations . class . getName ( ) , true ) ; } if ( configuration . sites ( ) . hasEnabledBackups ( ) ) { componentRegistry . registerComponent ( new XSiteAdminOperations ( ) , XSiteAdminOperations . class . getName ( ) , true ) ; } componentRegistry . registerComponent ( new RollingUpgradeManager ( ) , RollingUpgradeManager . class . getName ( ) , true ) ; } | Bootstraps this factory with a Configuration and a ComponentRegistry . |
22,388 | public void init ( Marshaller marshaller , OperationsFactory operationsFactory , int estimateKeySize , int estimateValueSize , int batchSize ) { this . defaultMarshaller = marshaller ; this . operationsFactory = operationsFactory ; this . estimateKeySize = estimateKeySize ; this . estimateValueSize = estimateValueSize ; this . batchSize = batchSize ; this . dataFormat = defaultDataFormat ; } | Inititalize without mbeans |
22,389 | public Component prepareRenderer ( TableCellRenderer renderer , int row , int column ) { Component c = super . prepareRenderer ( renderer , row , column ) ; if ( ! isCellSelected ( row , column ) ) { c . setBackground ( colorForRow ( row ) ) ; c . setForeground ( UIManager . getColor ( "Table.foreground" ) ) ; } else { c . setBackground ( UIManager . getColor ( "Table.selectionBackground" ) ) ; c . setForeground ( UIManager . getColor ( "Table.selectionForeground" ) ) ; } return c ; } | Shades alternate rows in different colors . |
22,390 | public final void reset ( ) { if ( trace ) { log . tracef ( "Resetting Node Scope Statistics" ) ; } globalContainer . reset ( ) ; percentiles = new EnumMap < > ( PercentileStatistic . class ) ; for ( PercentileStatistic percentileStatistic : PercentileStatistic . values ( ) ) { percentiles . put ( percentileStatistic , new ReservoirSampler ( ) ) ; } } | reset all the statistics collected so far . |
22,391 | public final void merge ( TransactionStatistics transactionStatistics ) { if ( trace ) { log . tracef ( "Merge transaction statistics %s to the node statistics" , transactionStatistics ) ; } ReservoirSampler reservoirSampler ; ExtendedStatistic percentileSample ; if ( transactionStatistics . isLocalTransaction ( ) ) { if ( transactionStatistics . isReadOnly ( ) ) { reservoirSampler = percentiles . get ( RO_LOCAL_EXECUTION ) ; percentileSample = transactionStatistics . isCommitted ( ) ? RO_TX_SUCCESSFUL_EXECUTION_TIME : RO_TX_ABORTED_EXECUTION_TIME ; } else { reservoirSampler = percentiles . get ( WR_LOCAL_EXECUTION ) ; percentileSample = transactionStatistics . isCommitted ( ) ? WR_TX_SUCCESSFUL_EXECUTION_TIME : WR_TX_ABORTED_EXECUTION_TIME ; } } else { if ( transactionStatistics . isReadOnly ( ) ) { reservoirSampler = percentiles . get ( RO_REMOTE_EXECUTION ) ; percentileSample = transactionStatistics . isCommitted ( ) ? RO_TX_SUCCESSFUL_EXECUTION_TIME : RO_TX_ABORTED_EXECUTION_TIME ; } else { reservoirSampler = percentiles . get ( WR_REMOTE_EXECUTION ) ; percentileSample = transactionStatistics . isCommitted ( ) ? WR_TX_SUCCESSFUL_EXECUTION_TIME : WR_TX_ABORTED_EXECUTION_TIME ; } } doMerge ( transactionStatistics , reservoirSampler , percentileSample ) ; } | Merges a transaction statistics in this cache statistics . |
22,392 | public void cacheStarting ( ComponentRegistry cr , Configuration cfg , String cacheName ) { BasicComponentRegistry gcr = cr . getGlobalComponentRegistry ( ) . getComponent ( BasicComponentRegistry . class ) ; InternalCacheRegistry icr = gcr . getComponent ( InternalCacheRegistry . class ) . running ( ) ; if ( ! icr . isInternalCache ( cacheName ) ) { ProtobufMetadataManagerImpl protobufMetadataManager = ( ProtobufMetadataManagerImpl ) gcr . getComponent ( ProtobufMetadataManager . class ) . running ( ) ; protobufMetadataManager . addCacheDependency ( cacheName ) ; SerializationContext serCtx = protobufMetadataManager . getSerializationContext ( ) ; RemoteQueryManager remoteQueryManager = buildQueryManager ( cfg , serCtx , cr ) ; cr . registerComponent ( remoteQueryManager , RemoteQueryManager . class ) ; } } | Registers the remote value wrapper interceptor in the cache before it gets started . |
22,393 | public Object visitPrepareCommand ( TxInvocationContext ctx , PrepareCommand command ) throws Throwable { if ( ctx . isOriginLocal ( ) ) { for ( WriteCommand wc : command . getModifications ( ) ) { for ( Object key : wc . getAffectedKeys ( ) ) { dataContainer . remove ( key ) ; } } } else { for ( WriteCommand wc : command . getModifications ( ) ) { Collection < ? > keys = wc . getAffectedKeys ( ) ; if ( log . isTraceEnabled ( ) ) { log . tracef ( "Invalidating keys %s with lock owner %s" , keys , ctx . getLockOwner ( ) ) ; } for ( Object key : keys ) { putFromLoadValidator . beginInvalidatingKey ( ctx . getLockOwner ( ) , key ) ; } } } return invokeNext ( ctx , command ) ; } | as part of EntryWrappingInterceptor |
22,394 | public void removeListener ( byte [ ] listenerId ) { boolean removed = listeners . removeIf ( id -> Arrays . equals ( id , listenerId ) ) ; if ( trace ) { log . tracef ( "Decoder %08X removed? %s listener %s" , hashCode ( ) , Boolean . toString ( removed ) , Util . printArray ( listenerId ) ) ; } } | must be called from event loop thread! |
22,395 | public static String nullIfEmpty ( String s ) { if ( s != null && s . length ( ) == 0 ) { return null ; } else { return s ; } } | Returns null if the parameter is null or empty otherwise it returns it untouched |
22,396 | public static ConfigurationBuilderHolder loadConfiguration ( ServiceRegistry registry , Properties properties ) { String config = ConfigurationHelper . extractPropertyValue ( INFINISPAN_CONFIG_RESOURCE_PROP , properties ) ; ConfigurationBuilderHolder holder = loadConfiguration ( registry , ( config != null ) ? config : DEF_INFINISPAN_CONFIG_RESOURCE ) ; String globalStatsProperty = ConfigurationHelper . extractPropertyValue ( INFINISPAN_GLOBAL_STATISTICS_PROP , properties ) ; if ( globalStatsProperty != null ) { holder . getGlobalConfigurationBuilder ( ) . globalJmxStatistics ( ) . enabled ( Boolean . parseBoolean ( globalStatsProperty ) ) ; } return holder ; } | This is public for reuse by tests |
22,397 | public static < T > T findValue ( ServiceRegistry registry , ServiceName name ) { ServiceController < T > service = findService ( registry , name ) ; return ( ( service != null ) && ( service . getState ( ) == State . UP ) ) ? service . getValue ( ) : null ; } | Returns the value of the specified service if the service exists and is started . |
22,398 | public static < T > T getValue ( ServiceController < T > controller ) throws StartException { start ( controller ) ; return controller . getValue ( ) ; } | Returns the service value of the specified service starting it if necessary . |
22,399 | public static void stop ( ServiceController < ? > controller ) { try { transition ( controller , State . DOWN ) ; } catch ( StartException e ) { throw new IllegalStateException ( e ) ; } } | Ensures the specified service is stopped . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.