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 ) { lockManag...
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 , t...
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 ( ) ) ; }...
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 . notifyCac...
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...
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 ) ; } catc...
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 ( tr...
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 ) ) { Adv...
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 ( ) ....
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 . ad...
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 ( ) ...
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 =...
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 =...
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 Cac...
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 (...
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 (...
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 -> searchWor...
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 ( cacheI...
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...
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 = ...
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 : ...
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 ) ; } SmallInt...
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 ) ; registeredObj...
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 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 ( ) ...
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 . ...
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 ( ) , inte...
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 . getGlobalCompo...
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 . isM...
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...
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 ; } els...
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 , distLoc...
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 ( ) , transactionStat...
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 ( invocatio...
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 aggregatedPa...
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 = ...
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 . a...
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 Filter...
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 opera...
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 . unlo...
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 " + t...
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 { writeLo...
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 ( fileListCa...
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 ( matche...
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...
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 , glob...
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 ...
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 {...
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 ,...
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 ( ) ) { ...
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 . i...
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 : comm...
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 :...
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 .