idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
9,100 | String doHandleCommand ( final String command ) { app . handleCommand ( command ) ; final String output = buffer . toString ( ) ; buffer . setLength ( 0 ) ; return output ; } | Called by handleCommand . |
9,101 | public void setWanPublisherConfigs ( List < WanPublisherConfig > wanPublisherConfigs ) { if ( wanPublisherConfigs != null && ! wanPublisherConfigs . isEmpty ( ) ) { this . wanPublisherConfigs = wanPublisherConfigs ; } } | Sets the list of configured WAN publisher targets for this WAN replication . |
9,102 | final Collection < ServiceNamespace > retainAndGetNamespaces ( ) { PartitionReplicationEvent event = new PartitionReplicationEvent ( partitionId , 0 ) ; Collection < FragmentedMigrationAwareService > services = nodeEngine . getServices ( FragmentedMigrationAwareService . class ) ; Set < ServiceNamespace > namespaces = new HashSet < > ( ) ; for ( FragmentedMigrationAwareService service : services ) { Collection < ServiceNamespace > serviceNamespaces = service . getAllServiceNamespaces ( event ) ; if ( serviceNamespaces != null ) { namespaces . addAll ( serviceNamespaces ) ; } } namespaces . add ( NonFragmentedServiceNamespace . INSTANCE ) ; PartitionReplicaManager replicaManager = partitionService . getReplicaManager ( ) ; replicaManager . retainNamespaces ( partitionId , namespaces ) ; return replicaManager . getNamespaces ( partitionId ) ; } | works only on primary . backups are retained in PartitionBackupReplicaAntiEntropyTask |
9,103 | private void initFinalPositionAndOffset ( BufferObjectDataInput in , ClassDefinition cd ) { int fieldCount ; try { finalPosition = in . readInt ( ) ; fieldCount = in . readInt ( ) ; } catch ( IOException e ) { throw new HazelcastSerializationException ( e ) ; } if ( fieldCount != cd . getFieldCount ( ) ) { throw new IllegalStateException ( "Field count[" + fieldCount + "] in stream does not match " + cd ) ; } offset = in . position ( ) ; } | Initialises the finalPosition and offset and validates the fieldCount against the given class definition |
9,104 | void reset ( ) { cd = initCd ; serializer = initSerializer ; in . position ( initPosition ) ; finalPosition = initFinalPosition ; offset = initOffset ; } | Resets the state to the initial state for future reuse . |
9,105 | void advanceContextToNextPortableToken ( int factoryId , int classId , int version ) throws IOException { cd = serializer . setupPositionAndDefinition ( in , factoryId , classId , version ) ; initFinalPositionAndOffset ( in , cd ) ; } | When we advance in the token navigation we need to re - initialise the class definition with the coordinates of the new portable object in the context of which we will be navigating further . |
9,106 | void advanceContextToGivenFrame ( NavigationFrame frame ) { in . position ( frame . streamPosition ) ; offset = frame . streamOffset ; cd = frame . cd ; } | Sets up the stream for the given frame which contains all info required to change to context for a given field . |
9,107 | @ SuppressWarnings ( { "unchecked" , "unused" } ) public < K , V > ICache < K , V > getOrCreateCache ( String cacheName , CacheConfig < K , V > cacheConfig ) { ensureOpen ( ) ; String cacheNameWithPrefix = getCacheNameWithPrefix ( cacheName ) ; ICacheInternal < ? , ? > cache = caches . get ( cacheNameWithPrefix ) ; if ( cache == null ) { cache = createCacheInternal ( cacheName , cacheConfig ) ; } return ensureOpenIfAvailable ( ( ICacheInternal < K , V > ) cache ) ; } | used in EE |
9,108 | public void destroy ( ) { if ( ! isDestroyed . compareAndSet ( false , true ) ) { return ; } deregisterLifecycleListener ( ) ; for ( ICacheInternal cache : caches . values ( ) ) { cache . destroy ( ) ; } caches . clear ( ) ; isClosed . set ( true ) ; postDestroy ( ) ; } | Destroys all managed caches . |
9,109 | public String generate ( Config config ) { isNotNull ( config , "Config" ) ; StringBuilder xml = new StringBuilder ( ) ; XmlGenerator gen = new XmlGenerator ( xml ) ; xml . append ( "<hazelcast " ) . append ( "xmlns=\"http://www.hazelcast.com/schema/config\"\n" ) . append ( "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" ) . append ( "xsi:schemaLocation=\"http://www.hazelcast.com/schema/config " ) . append ( "http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd\">" ) ; gen . open ( "group" ) . node ( "name" , config . getGroupConfig ( ) . getName ( ) ) . node ( "password" , getOrMaskValue ( config . getGroupConfig ( ) . getPassword ( ) ) ) . close ( ) . node ( "license-key" , getOrMaskValue ( config . getLicenseKey ( ) ) ) . node ( "instance-name" , config . getInstanceName ( ) ) ; manCenterXmlGenerator ( gen , config ) ; gen . appendProperties ( config . getProperties ( ) ) ; securityXmlGenerator ( gen , config ) ; wanReplicationXmlGenerator ( gen , config ) ; networkConfigXmlGenerator ( gen , config ) ; advancedNetworkConfigXmlGenerator ( gen , config ) ; mapConfigXmlGenerator ( gen , config ) ; replicatedMapConfigXmlGenerator ( gen , config ) ; cacheConfigXmlGenerator ( gen , config ) ; queueXmlGenerator ( gen , config ) ; multiMapXmlGenerator ( gen , config ) ; collectionXmlGenerator ( gen , "list" , config . getListConfigs ( ) . values ( ) ) ; collectionXmlGenerator ( gen , "set" , config . getSetConfigs ( ) . values ( ) ) ; topicXmlGenerator ( gen , config ) ; semaphoreXmlGenerator ( gen , config ) ; lockXmlGenerator ( gen , config ) ; countDownLatchXmlGenerator ( gen , config ) ; ringbufferXmlGenerator ( gen , config ) ; atomicLongXmlGenerator ( gen , config ) ; atomicReferenceXmlGenerator ( gen , config ) ; executorXmlGenerator ( gen , config ) ; durableExecutorXmlGenerator ( gen , config ) ; scheduledExecutorXmlGenerator ( gen , config ) ; eventJournalXmlGenerator ( gen , config ) ; merkleTreeXmlGenerator ( gen , config ) ; partitionGroupXmlGenerator ( gen , config ) ; cardinalityEstimatorXmlGenerator ( gen , config ) ; listenerXmlGenerator ( gen , config ) ; serializationXmlGenerator ( gen , config ) ; reliableTopicXmlGenerator ( gen , config ) ; liteMemberXmlGenerator ( gen , config ) ; nativeMemoryXmlGenerator ( gen , config ) ; servicesXmlGenerator ( gen , config ) ; hotRestartXmlGenerator ( gen , config ) ; flakeIdGeneratorXmlGenerator ( gen , config ) ; crdtReplicationXmlGenerator ( gen , config ) ; pnCounterXmlGenerator ( gen , config ) ; quorumXmlGenerator ( gen , config ) ; cpSubsystemConfig ( gen , config ) ; xml . append ( "</hazelcast>" ) ; return format ( xml . toString ( ) , INDENT ) ; } | Generates the XML string based on some Config . |
9,110 | private VectorClock toVectorClock ( List < Entry < String , Long > > replicaLogicalTimestamps ) { final VectorClock timestamps = new VectorClock ( ) ; for ( Entry < String , Long > replicaTimestamp : replicaLogicalTimestamps ) { timestamps . setReplicaTimestamp ( replicaTimestamp . getKey ( ) , replicaTimestamp . getValue ( ) ) ; } return timestamps ; } | Transforms the list of replica logical timestamps to a vector clock instance . |
9,111 | private int getMaxConfiguredReplicaCount ( ) { if ( maxConfiguredReplicaCount > 0 ) { return maxConfiguredReplicaCount ; } else { final ClientMessage request = PNCounterGetConfiguredReplicaCountCodec . encodeRequest ( name ) ; final ClientMessage response = invoke ( request ) ; final PNCounterGetConfiguredReplicaCountCodec . ResponseParameters resultParameters = PNCounterGetConfiguredReplicaCountCodec . decodeResponse ( response ) ; maxConfiguredReplicaCount = resultParameters . response ; } return maxConfiguredReplicaCount ; } | Returns the max configured replica count . When invoked for the first time this method will fetch the configuration from a cluster member . |
9,112 | private List < Object > convertToObjectKeys ( Collection keys ) { if ( keys == null || keys . isEmpty ( ) ) { return Collections . emptyList ( ) ; } final List < Object > objectKeys = new ArrayList < > ( keys . size ( ) ) ; for ( Object key : keys ) { objectKeys . add ( toObject ( key ) ) ; } return objectKeys ; } | Deserialises all of the items in the provided collection if they are not deserialised already . |
9,113 | public final InternalQueryCache createNew ( String cacheId ) { try { QueryCacheConfig queryCacheConfig = initQueryCacheConfig ( request , cacheId ) ; if ( queryCacheConfig == null ) { return NULL_QUERY_CACHE ; } queryCache = createUnderlyingQueryCache ( queryCacheConfig , request , cacheId ) ; AccumulatorInfo info = toAccumulatorInfo ( queryCacheConfig , mapName , cacheId , predicate ) ; addInfoToSubscriberContext ( info ) ; info . setPublishable ( true ) ; String publisherListenerId = queryCache . getPublisherListenerId ( ) ; if ( publisherListenerId == null ) { createSubscriberAccumulator ( info ) ; } createPublisherAccumulator ( info ) ; queryCache . setPublisherListenerId ( this . publisherListenerId ) ; } catch ( Throwable throwable ) { removeQueryCacheConfig ( mapName , request . getCacheName ( ) ) ; throw rethrow ( throwable ) ; } return queryCache ; } | Here order of method calls should not change . |
9,114 | private InternalQueryCache createUnderlyingQueryCache ( QueryCacheConfig queryCacheConfig , QueryCacheRequest request , String cacheId ) { SubscriberContext subscriberContext = context . getSubscriberContext ( ) ; QueryCacheFactory queryCacheFactory = subscriberContext . getQueryCacheFactory ( ) ; request . withQueryCacheConfig ( queryCacheConfig ) ; return queryCacheFactory . create ( request , cacheId ) ; } | This is the cache which we store all key - value pairs . |
9,115 | public static String validateIndexAttribute ( String attribute ) { checkHasText ( attribute , "Map index attribute must contain text" ) ; String keyPrefix = KEY_ATTRIBUTE_NAME . value ( ) ; if ( attribute . startsWith ( keyPrefix ) && attribute . length ( ) > keyPrefix . length ( ) ) { if ( attribute . charAt ( keyPrefix . length ( ) ) != '#' ) { LOG . warning ( KEY_ATTRIBUTE_NAME . value ( ) + " used without a following '#' char in index attribute '" + attribute + "'. Don't you want to index a key?" ) ; } } return attribute ; } | Validates index attribute content . |
9,116 | private void replayEventsOverResultSet ( QueryResult queryResult ) throws Exception { Map < Integer , Future < Object > > future = readAccumulators ( ) ; for ( Map . Entry < Integer , Future < Object > > entry : future . entrySet ( ) ) { int partitionId = entry . getKey ( ) ; Object eventsInOneAcc = entry . getValue ( ) . get ( ) ; if ( eventsInOneAcc == null ) { continue ; } eventsInOneAcc = mapServiceContext . toObject ( eventsInOneAcc ) ; List < QueryCacheEventData > eventDataList = ( List < QueryCacheEventData > ) eventsInOneAcc ; for ( QueryCacheEventData eventData : eventDataList ) { if ( eventData . getDataKey ( ) == null ) { removePartitionResults ( queryResult , partitionId ) ; } else { add ( queryResult , newQueryResultRow ( eventData ) ) ; } } } } | Replay events over the result set of initial query . These events are received events during execution of the initial query . |
9,117 | private void removePartitionResults ( QueryResult queryResult , int partitionId ) { List < QueryResultRow > rows = queryResult . getRows ( ) ; rows . removeIf ( resultRow -> getPartitionId ( resultRow ) == partitionId ) ; } | Remove matching entries from given result set with the given partition ID . |
9,118 | private Future < Object > readAndResetAccumulator ( String mapName , String cacheId , Integer partitionId ) { Operation operation = new ReadAndResetAccumulatorOperation ( mapName , cacheId ) ; OperationService operationService = getNodeEngine ( ) . getOperationService ( ) ; return operationService . invokeOnPartition ( MapService . SERVICE_NAME , operation , partitionId ) ; } | Read and reset the accumulator of query cache inside the given partition . |
9,119 | public static String getName ( DistributedObject distributedObject ) { if ( distributedObject instanceof PrefixedDistributedObject ) { return ( ( PrefixedDistributedObject ) distributedObject ) . getPrefixedName ( ) ; } else { return distributedObject . getName ( ) ; } } | Gets the name of the given distributed object . |
9,120 | private void equalizeEntryCountWithPrimary ( ) { int diff = recordStore . size ( ) - primaryEntryCount ; if ( diff > 0 ) { recordStore . sampleAndForceRemoveEntries ( diff ) ; assert recordStore . size ( ) == primaryEntryCount : String . format ( "Failed" + " to remove %d entries while attempting to match" + " primary entry count %d," + " recordStore size is now %d" , diff , primaryEntryCount , recordStore . size ( ) ) ; } } | Equalizes backup entry count with primary in order to have identical memory occupancy . |
9,121 | public final void invalidateKey ( Data key , String dataStructureName , String sourceUuid ) { checkNotNull ( key , "key cannot be null" ) ; checkNotNull ( sourceUuid , "sourceUuid cannot be null" ) ; Invalidation invalidation = newKeyInvalidation ( key , dataStructureName , sourceUuid ) ; invalidateInternal ( invalidation , getPartitionId ( key ) ) ; } | Invalidates supplied key from Near Caches of supplied data structure name . |
9,122 | public final void invalidateAllKeys ( String dataStructureName , String sourceUuid ) { checkNotNull ( sourceUuid , "sourceUuid cannot be null" ) ; int orderKey = getPartitionId ( dataStructureName ) ; Invalidation invalidation = newClearInvalidation ( dataStructureName , sourceUuid ) ; sendImmediately ( invalidation , orderKey ) ; } | Invalidates all keys from Near Caches of supplied data structure name . |
9,123 | private void flush ( Collection < Record > recordsToBeFlushed , boolean backup ) { for ( Record record : recordsToBeFlushed ) { mapDataStore . flush ( record . getKey ( ) , record . getValue ( ) , backup ) ; } } | Flushes evicted records to map store . |
9,124 | public Data readBackupData ( Data key ) { Record record = getRecord ( key ) ; if ( record == null ) { return null ; } else { if ( partitionService . isPartitionOwner ( partitionId ) ) { record . setLastAccessTime ( Clock . currentTimeMillis ( ) ) ; } } Object value = record . getValue ( ) ; mapServiceContext . interceptAfterGet ( name , value ) ; return mapServiceContext . toData ( value ) ; } | This method is called directly by user threads in other words it is called outside of the partition threads . |
9,125 | private void fullScanLocalDataToClear ( Indexes indexes ) { InternalIndex [ ] indexesSnapshot = indexes . getIndexes ( ) ; for ( Record record : storage . values ( ) ) { Data key = record . getKey ( ) ; Object value = Records . getValueOrCachedValue ( record , serializationService ) ; indexes . removeEntry ( key , value , Index . OperationSource . SYSTEM ) ; } Indexes . markPartitionAsUnindexed ( partitionId , indexesSnapshot ) ; } | Clears local data of this partition from global index by doing partition full - scan . |
9,126 | public boolean isCompatible ( ConfigCheck found ) { if ( ! equals ( groupName , found . groupName ) ) { return false ; } verifyJoiner ( found ) ; verifyPartitionGroup ( found ) ; verifyPartitionCount ( found ) ; verifyApplicationValidationToken ( found ) ; return true ; } | Checks if two Hazelcast configurations are compatible . |
9,127 | void signalProtocolEstablished ( String inboundProtocol ) { assert ! channel . isClientMode ( ) : "Signal protocol should only be made on channel in serverMode" ; this . inboundProtocol = inboundProtocol ; channel . outboundPipeline ( ) . wakeup ( ) ; } | Signals the ProtocolEncoder that the protocol is known . This call will be made by the ProtocolDecoder as soon as it knows the inbound protocol . |
9,128 | public void scheduleExpirationTask ( ) { if ( nodeEngine . getLocalMember ( ) . isLiteMember ( ) || scheduled . get ( ) || ! scheduled . compareAndSet ( false , true ) ) { return ; } scheduledExpirationTask = globalTaskScheduler . scheduleWithRepetition ( task , taskPeriodSeconds , taskPeriodSeconds , SECONDS ) ; scheduledOneTime . set ( true ) ; } | Starts scheduling of the task that clears expired entries . Calling this method multiple times has same effect . |
9,129 | void unscheduleExpirationTask ( ) { scheduled . set ( false ) ; ScheduledFuture < ? > scheduledFuture = this . scheduledExpirationTask ; if ( scheduledFuture != null ) { scheduledFuture . cancel ( false ) ; } } | Ends scheduling of the task that clears expired entries . Calling this method multiple times has same effect . |
9,130 | public static void incrementOtherOperationsCount ( MapService service , String mapName ) { MapServiceContext mapServiceContext = service . getMapServiceContext ( ) ; MapContainer mapContainer = mapServiceContext . getMapContainer ( mapName ) ; if ( mapContainer . getMapConfig ( ) . isStatisticsEnabled ( ) ) { LocalMapStatsImpl localMapStats = mapServiceContext . getLocalMapStatsProvider ( ) . getLocalMapStatsImpl ( mapName ) ; localMapStats . incrementOtherOperations ( ) ; } } | Increments other operations count statistic in local map statistics . |
9,131 | public boolean shouldBackup ( ) { NodeEngine nodeEngine = getNodeEngine ( ) ; IPartitionService partitionService = nodeEngine . getPartitionService ( ) ; Address thisAddress = nodeEngine . getThisAddress ( ) ; IPartition partition = partitionService . getPartition ( getPartitionId ( ) ) ; if ( ! thisAddress . equals ( partition . getOwnerOrNull ( ) ) ) { return false ; } return super . shouldBackup ( ) ; } | This operation runs on both primary and backup If it is running on backup we should not send a backup operation |
9,132 | @ SuppressWarnings ( "unchecked" ) void cleanup ( Ringbuffer ringbuffer ) { if ( ringbuffer . headSequence ( ) > ringbuffer . tailSequence ( ) ) { return ; } long now = currentTimeMillis ( ) ; while ( ringbuffer . headSequence ( ) <= ringbuffer . tailSequence ( ) ) { final long headSequence = ringbuffer . headSequence ( ) ; if ( ringExpirationMs [ toIndex ( headSequence ) ] > now ) { return ; } ringbuffer . set ( headSequence , null ) ; ringbuffer . setHeadSequence ( ringbuffer . headSequence ( ) + 1 ) ; } } | Cleans up the ringbuffer by deleting all expired items . |
9,133 | private void updateStatistics ( ) { final PNCounterService service = getService ( ) ; final LocalPNCounterStatsImpl stats = service . getLocalPNCounterStats ( name ) ; if ( delta > 0 ) { stats . incrementIncrementOperationCount ( ) ; } else if ( delta < 0 ) { stats . incrementDecrementOperationCount ( ) ; } stats . setValue ( getBeforeUpdate ? ( response . getValue ( ) + delta ) : response . getValue ( ) ) ; } | Updates the local PN counter statistics |
9,134 | public void storeKeys ( Iterator < K > iterator ) { long startedNanos = System . nanoTime ( ) ; FileOutputStream fos = null ; try { buf = allocate ( BUFFER_SIZE ) ; lastWrittenBytes = 0 ; lastKeyCount = 0 ; fos = new FileOutputStream ( tmpStoreFile , false ) ; writeInt ( fos , MAGIC_BYTES ) ; writeInt ( fos , FileFormat . INTERLEAVED_LENGTH_FIELD . ordinal ( ) ) ; writeKeySet ( fos , fos . getChannel ( ) , iterator ) ; if ( lastKeyCount == 0 ) { deleteQuietly ( storeFile ) ; updatePersistenceStats ( startedNanos ) ; return ; } fos . flush ( ) ; closeResource ( fos ) ; rename ( tmpStoreFile , storeFile ) ; updatePersistenceStats ( startedNanos ) ; } catch ( Exception e ) { logger . warning ( format ( "Could not store keys of Near Cache %s (%s)" , nearCacheName , storeFile . getAbsolutePath ( ) ) , e ) ; nearCacheStats . addPersistenceFailure ( e ) ; } finally { closeResource ( fos ) ; deleteQuietly ( tmpStoreFile ) ; } } | Stores the Near Cache keys from the supplied iterator . |
9,135 | public static ICompletableFuture < Object > invokeOnStableClusterSerial ( NodeEngine nodeEngine , Supplier < ? extends Operation > operationSupplier , int maxRetries ) { ClusterService clusterService = nodeEngine . getClusterService ( ) ; if ( ! clusterService . isJoined ( ) ) { return new CompletedFuture < Object > ( null , null , new CallerRunsExecutor ( ) ) ; } RestartingMemberIterator memberIterator = new RestartingMemberIterator ( clusterService , maxRetries ) ; InvokeOnMemberFunction invokeOnMemberFunction = new InvokeOnMemberFunction ( operationSupplier , nodeEngine , memberIterator ) ; Iterator < ICompletableFuture < Object > > invocationIterator = map ( memberIterator , invokeOnMemberFunction ) ; ILogger logger = nodeEngine . getLogger ( ChainingFuture . class ) ; ExecutionService executionService = nodeEngine . getExecutionService ( ) ; ManagedExecutorService executor = executionService . getExecutor ( ExecutionService . ASYNC_EXECUTOR ) ; return new ChainingFuture < Object > ( invocationIterator , executor , memberIterator , logger ) ; } | Invoke operation on all cluster members . |
9,136 | private boolean isApplicable ( QueryCacheEventData event ) { if ( ! getInfo ( ) . isPublishable ( ) ) { return false ; } final int partitionId = event . getPartitionId ( ) ; if ( isEndEvent ( event ) ) { sequenceProvider . reset ( partitionId ) ; removeFromBrokenSequences ( event ) ; return false ; } if ( isNextEvent ( event ) ) { long currentSequence = sequenceProvider . getSequence ( partitionId ) ; sequenceProvider . compareAndSetSequence ( currentSequence , event . getSequence ( ) , partitionId ) ; removeFromBrokenSequences ( event ) ; return true ; } handleUnexpectedEvent ( event ) ; return false ; } | Checks whether the event data is applicable to the query cache . |
9,137 | void removeUnknownMembers ( ) { ClusterServiceImpl clusterService = node . getClusterService ( ) ; for ( InternalPartitionImpl partition : partitions ) { for ( int i = 0 ; i < InternalPartition . MAX_REPLICA_COUNT ; i ++ ) { PartitionReplica replica = partition . getReplica ( i ) ; if ( replica == null ) { continue ; } if ( clusterService . getMember ( replica . address ( ) , replica . uuid ( ) ) == null ) { partition . setReplica ( i , null ) ; if ( logger . isFinestEnabled ( ) ) { logger . finest ( "PartitionId=" + partition . getPartitionId ( ) + " " + replica + " is removed from replica index: " + i + ", partition: " + partition ) ; } } } } } | Checks all replicas for all partitions . If the cluster service does not contain the member for any address in the partition table it will remove the address from the partition . |
9,138 | public InternalPartition [ ] getPartitionsCopy ( ) { NopPartitionListener listener = new NopPartitionListener ( ) ; InternalPartition [ ] result = new InternalPartition [ partitions . length ] ; for ( int i = 0 ; i < partitionCount ; i ++ ) { result [ i ] = partitions [ i ] . copy ( listener ) ; } return result ; } | Returns a copy of the current partition table . |
9,139 | public static < T extends Throwable > RuntimeException rethrowAllowedTypeFirst ( final Throwable t , Class < T > allowedType ) throws T { rethrowIfError ( t ) ; if ( allowedType . isAssignableFrom ( t . getClass ( ) ) ) { throw ( T ) t ; } else { throw peel ( t ) ; } } | This rethrow the exception providing an allowed Exception in first priority even it is a Runtime exception |
9,140 | public SerializerConfig setClass ( final Class < ? extends Serializer > clazz ) { String className = clazz == null ? null : clazz . getName ( ) ; return setClassName ( className ) ; } | Sets the class of the serializer implementation . |
9,141 | public boolean contains ( DelayedEntry entry ) { Data key = ( Data ) entry . getKey ( ) ; return index . containsKey ( key ) ; } | Checks whether an item exist in queue or not . |
9,142 | public int drainTo ( Collection < DelayedEntry > collection ) { checkNotNull ( collection , "collection can not be null" ) ; Iterator < DelayedEntry > iterator = deque . iterator ( ) ; while ( iterator . hasNext ( ) ) { DelayedEntry e = iterator . next ( ) ; collection . add ( e ) ; iterator . remove ( ) ; } resetCountIndex ( ) ; return collection . size ( ) ; } | Removes all available elements from this queue and adds them to the given collection . |
9,143 | public static int getInt ( JsonObject object , String field ) { final JsonValue value = object . get ( field ) ; throwExceptionIfNull ( value , field ) ; return value . asInt ( ) ; } | Returns a field in a Json object as an int . Throws IllegalArgumentException if the field value is null . |
9,144 | public static int getInt ( JsonObject object , String field , int defaultValue ) { final JsonValue value = object . get ( field ) ; if ( value == null || value . isNull ( ) ) { return defaultValue ; } else { return value . asInt ( ) ; } } | Returns a field in a Json object as an int . |
9,145 | public static long getLong ( JsonObject object , String field ) { final JsonValue value = object . get ( field ) ; throwExceptionIfNull ( value , field ) ; return value . asLong ( ) ; } | Returns a field in a Json object as a long . Throws IllegalArgumentException if the field value is null . |
9,146 | public static long getLong ( JsonObject object , String field , long defaultValue ) { final JsonValue value = object . get ( field ) ; if ( value == null || value . isNull ( ) ) { return defaultValue ; } else { return value . asLong ( ) ; } } | Returns a field in a Json object as a long . |
9,147 | public static double getDouble ( JsonObject object , String field ) { final JsonValue value = object . get ( field ) ; throwExceptionIfNull ( value , field ) ; return value . asDouble ( ) ; } | Returns a field in a Json object as a double . Throws IllegalArgumentException if the field value is null . |
9,148 | public static double getDouble ( JsonObject object , String field , double defaultValue ) { final JsonValue value = object . get ( field ) ; if ( value == null || value . isNull ( ) ) { return defaultValue ; } else { return value . asDouble ( ) ; } } | Returns a field in a Json object as a double . |
9,149 | public static float getFloat ( JsonObject object , String field ) { final JsonValue value = object . get ( field ) ; throwExceptionIfNull ( value , field ) ; return value . asFloat ( ) ; } | Returns a field in a Json object as a float . Throws IllegalArgumentException if the field value is null . |
9,150 | public static float getFloat ( JsonObject object , String field , float defaultValue ) { final JsonValue value = object . get ( field ) ; if ( value == null || value . isNull ( ) ) { return defaultValue ; } else { return value . asFloat ( ) ; } } | Returns a field in a Json object as a float . |
9,151 | public static String getString ( JsonObject object , String field ) { final JsonValue value = object . get ( field ) ; throwExceptionIfNull ( value , field ) ; return value . asString ( ) ; } | Returns a field in a Json object as a string . Throws IllegalArgumentException if the field value is null . |
9,152 | public static String getString ( JsonObject object , String field , String defaultValue ) { final JsonValue value = object . get ( field ) ; if ( value == null || value . isNull ( ) ) { return defaultValue ; } else { return value . asString ( ) ; } } | Returns a field in a Json object as a string . |
9,153 | public static boolean getBoolean ( JsonObject object , String field ) { final JsonValue value = object . get ( field ) ; throwExceptionIfNull ( value , field ) ; return value . asBoolean ( ) ; } | Returns a field in a Json object as a boolean . Throws IllegalArgumentException if the field value is null . |
9,154 | public static boolean getBoolean ( JsonObject object , String field , boolean defaultValue ) { final JsonValue value = object . get ( field ) ; if ( value == null || value . isNull ( ) ) { return defaultValue ; } else { return value . asBoolean ( ) ; } } | Returns a field in a Json object as a boolean . |
9,155 | public static JsonArray getArray ( JsonObject object , String field ) { final JsonValue value = object . get ( field ) ; throwExceptionIfNull ( value , field ) ; return value . asArray ( ) ; } | Returns a field in a Json object as an array . Throws IllegalArgumentException if the field value is null . |
9,156 | public static JsonArray getArray ( JsonObject object , String field , JsonArray defaultValue ) { final JsonValue value = object . get ( field ) ; if ( value == null || value . isNull ( ) ) { return defaultValue ; } else { return value . asArray ( ) ; } } | Returns a field in a Json object as an array . |
9,157 | public static JsonObject getObject ( JsonObject object , String field ) { final JsonValue value = object . get ( field ) ; throwExceptionIfNull ( value , field ) ; return value . asObject ( ) ; } | Returns a field in a Json object as an object . Throws IllegalArgumentException if the field value is null . |
9,158 | public static JsonObject getObject ( JsonObject object , String field , JsonObject defaultValue ) { final JsonValue value = object . get ( field ) ; if ( value == null || value . isNull ( ) ) { return defaultValue ; } else { return value . asObject ( ) ; } } | Returns a field in a Json object as an object . |
9,159 | private static String toJsonCollection ( Collection objects ) { Iterator iterator = objects . iterator ( ) ; if ( ! iterator . hasNext ( ) ) { return "" ; } final Object first = iterator . next ( ) ; if ( ! iterator . hasNext ( ) ) { return toJson ( first ) ; } final StringBuilder buf = new StringBuilder ( ) ; if ( first != null ) { buf . append ( toJson ( first ) ) ; } while ( iterator . hasNext ( ) ) { buf . append ( ',' ) ; final Object obj = iterator . next ( ) ; if ( obj != null ) { buf . append ( toJson ( obj ) ) ; } } return buf . toString ( ) ; } | Serializes a collection of objects into its JSON representation . |
9,160 | public final Map < Tuple2 < String , UUID > , Tuple2 < Long , Long > > getWaitTimeouts ( ) { return unmodifiableMap ( waitTimeouts ) ; } | queried locally in tests |
9,161 | public void init ( RingbufferConfig config , NodeEngine nodeEngine ) { this . config = config ; this . serializationService = nodeEngine . getSerializationService ( ) ; initRingbufferStore ( nodeEngine . getConfigClassLoader ( ) ) ; } | Initializes the ring buffer with references to other services the ringbuffer store and the config . This is because on a replication operation the container is only partially constructed . The init method finishes the configuration of the ring buffer container for further usage . |
9,162 | public long addAll ( T [ ] items ) { long firstSequence = ringbuffer . peekNextTailSequence ( ) ; long lastSequence = ringbuffer . peekNextTailSequence ( ) ; if ( store . isEnabled ( ) && items . length != 0 ) { try { store . storeAll ( firstSequence , convertToData ( items ) ) ; } catch ( Exception e ) { throw new HazelcastException ( e ) ; } } for ( int i = 0 ; i < items . length ; i ++ ) { lastSequence = addInternal ( items [ i ] ) ; } return lastSequence ; } | Adds all items to the ringbuffer . Sets the expiration time if TTL is configured and also attempts to store the items in the data store if one is configured . |
9,163 | @ SuppressWarnings ( "unchecked" ) public void set ( long sequenceId , T item ) { final E rbItem = convertToRingbufferFormat ( item ) ; ringbuffer . set ( sequenceId , rbItem ) ; if ( sequenceId > tailSequence ( ) ) { ringbuffer . setTailSequence ( sequenceId ) ; if ( ringbuffer . size ( ) > ringbuffer . getCapacity ( ) ) { ringbuffer . setHeadSequence ( ringbuffer . tailSequence ( ) - ringbuffer . getCapacity ( ) + 1 ) ; } } if ( sequenceId < headSequence ( ) ) { ringbuffer . setHeadSequence ( sequenceId ) ; } if ( expirationPolicy != null ) { expirationPolicy . setExpirationAt ( sequenceId ) ; } } | Sets the item at the given sequence ID and updates the expiration time if TTL is configured . Unlike other methods for adding items into the ring buffer does not attempt to store the item in the data store . This method expands the ring buffer tail and head sequence to accommodate for the sequence . This means that it will move the head or tail sequence to the target sequence if the target sequence is less than the head sequence or greater than the tail sequence . |
9,164 | public Data readAsData ( long sequence ) { checkReadSequence ( sequence ) ; Object rbItem = readOrLoadItem ( sequence ) ; return serializationService . toData ( rbItem ) ; } | Reads one item from the ring buffer and returns the serialized format . If the item is not available it will try and load it from the ringbuffer store . If the stored format is already serialized there is no serialization . |
9,165 | private void checkReadSequence ( long sequence ) { final long tailSequence = ringbuffer . tailSequence ( ) ; if ( sequence > tailSequence ) { throw new IllegalArgumentException ( "sequence:" + sequence + " is too large. The current tailSequence is:" + tailSequence ) ; } if ( isStaleSequence ( sequence ) ) { throw new StaleSequenceException ( "sequence:" + sequence + " is too small and data store is disabled." + " The current headSequence is:" + headSequence ( ) + " tailSequence is:" + tailSequence , headSequence ( ) ) ; } } | Check if the sequence can be read from the ring buffer . |
9,166 | private Object readOrLoadItem ( long sequence ) { Object item ; if ( sequence < ringbuffer . headSequence ( ) && store . isEnabled ( ) ) { item = store . load ( sequence ) ; } else { item = ringbuffer . read ( sequence ) ; } return item ; } | Reads the item at the specified sequence or loads it from the ringbuffer store if one is enabled . The type of the returned object is equal to the ringbuffer format . |
9,167 | private Data [ ] convertToData ( T [ ] items ) { if ( items == null || items . length == 0 ) { return new Data [ 0 ] ; } if ( items [ 0 ] instanceof Data ) { return ( Data [ ] ) items ; } final Data [ ] ret = new Data [ items . length ] ; for ( int i = 0 ; i < items . length ; i ++ ) { ret [ i ] = convertToData ( items [ i ] ) ; } return ret ; } | Convert the supplied argument into serialized format . |
9,168 | protected Record getOrNullIfExpired ( Record record , long now , boolean backup ) { if ( ! isRecordStoreExpirable ( ) ) { return record ; } if ( record == null ) { return null ; } Data key = record . getKey ( ) ; if ( isLocked ( key ) ) { return record ; } if ( ! isExpired ( record , now , backup ) ) { return record ; } evict ( key , backup ) ; if ( ! backup ) { doPostEvictionOperations ( record ) ; } return null ; } | Check if record is reachable according to TTL or idle times . If not reachable return null . |
9,169 | Object getValue ( Object obj , String attributePath , Object metadata ) throws Exception { return getValue ( obj , attributePath ) ; } | Method for generic getters that can make use of metadata if available . These getters must gracefully fallback to not using metadata if unavailable . |
9,170 | @ SuppressWarnings ( { "checkstyle:npathcomplexity" , "checkstyle:returncount" } ) public static long estimateValueCost ( Object value ) { if ( value == null ) { return 0 ; } Class < ? > clazz = value . getClass ( ) ; Integer cost = KNOWN_FINAL_CLASSES_COSTS . get ( clazz ) ; if ( cost != null ) { return cost ; } if ( value instanceof String ) { return BASE_STRING_COST + ( ( String ) value ) . length ( ) * 2L ; } if ( value instanceof Timestamp ) { return SQL_TIMESTAMP_COST ; } if ( value instanceof Date ) { return DATE_COST ; } if ( clazz . isEnum ( ) ) { return 0 ; } if ( value instanceof BigDecimal ) { return ROUGH_BIG_DECIMAL_COST ; } if ( value instanceof BigInteger ) { return ROUGH_BIG_INTEGER_COST ; } return ROUGH_UNKNOWN_CLASS_COST ; } | Estimates the on - heap memory cost of the given value . |
9,171 | public static long estimateMapCost ( long size , boolean ordered , boolean usesCachedQueryableEntries ) { long mapCost ; if ( ordered ) { mapCost = BASE_CONCURRENT_SKIP_LIST_MAP_COST + size * CONCURRENT_SKIP_LIST_MAP_ENTRY_COST ; } else { mapCost = BASE_CONCURRENT_HASH_MAP_COST + size * CONCURRENT_HASH_MAP_ENTRY_COST ; } long queryableEntriesCost ; if ( usesCachedQueryableEntries ) { queryableEntriesCost = size * CACHED_QUERYABLE_ENTRY_COST ; } else { queryableEntriesCost = size * QUERY_ENTRY_COST ; } return mapCost + queryableEntriesCost ; } | Estimates the on - heap memory cost of a map backing an index . |
9,172 | static int getType ( Class classType ) { Integer type = TYPES . get ( classType ) ; if ( type != null ) { return type ; } List < Class < ? > > flattenedClasses = new ArrayList < Class < ? > > ( ) ; flatten ( classType , flattenedClasses ) ; for ( Class < ? > clazz : flattenedClasses ) { type = TYPES . get ( clazz ) ; if ( type != null ) { return type ; } } return - 1 ; } | Gets the accessible object probe type for this class object type . accessible object probe class object TYPE_PRIMITIVE_LONG = 1 byte short int long TYPE_LONG_NUMBER = 2 Byte Short Integer Long AtomicInteger AtomicLong TYPE_DOUBLE_PRIMITIVE = 3 double float TYPE_DOUBLE_NUMBER = 4 Double Float TYPE_COLLECTION = 5 Collection TYPE_MAP = 6 Map TYPE_COUNTER = 7 Counter |
9,173 | private void checkSslConfigAvailability ( Config config ) { if ( config . getAdvancedNetworkConfig ( ) . isEnabled ( ) ) { return ; } SSLConfig sslConfig = config . getNetworkConfig ( ) . getSSLConfig ( ) ; checkSslConfigAvailability ( sslConfig ) ; } | check SSL config for unisocket member configuration |
9,174 | private void checkSslConfigAvailability ( SSLConfig sslConfig ) { if ( sslConfig != null && sslConfig . isEnabled ( ) ) { if ( ! BuildInfoProvider . getBuildInfo ( ) . isEnterprise ( ) ) { throw new IllegalStateException ( "SSL/TLS requires Hazelcast Enterprise Edition" ) ; } } } | check given SSL config |
9,175 | static int getNodeRangeLow ( int nodeOrder ) { int level = getLevelOfNode ( nodeOrder ) ; int leftMostLeafOrder = getLeftMostNodeOrderOnLevel ( level ) ; int levelHashStep = ( int ) getNodeHashRangeOnLevel ( level ) ; int leafOrderOnLevel = nodeOrder - leftMostLeafOrder ; return Integer . MIN_VALUE + ( leafOrderOnLevel * levelHashStep ) ; } | Returns the lower bound of the hash range for a given node |
9,176 | private boolean checkSync ( ) { boolean sync = false ; long last = lastSubmitTime ; long now = Clock . currentTimeMillis ( ) ; if ( last + SYNC_DELAY_MS < now ) { CONSECUTIVE_SUBMITS . set ( this , 0 ) ; } else if ( CONSECUTIVE_SUBMITS . incrementAndGet ( this ) % SYNC_FREQUENCY == 0 ) { sync = true ; } lastSubmitTime = now ; return sync ; } | This is a hack to prevent overloading the system with unprocessed tasks . Once backpressure is added this can be removed . |
9,177 | public static < E1 > ConcurrentConveyor < E1 > concurrentConveyor ( E1 submitterGoneItem , QueuedPipe < E1 > ... queues ) { return new ConcurrentConveyor < E1 > ( submitterGoneItem , queues ) ; } | Creates a new concurrent conveyor . |
9,178 | public final boolean offer ( Queue < E > queue , E item ) throws ConcurrentConveyorException { if ( queue . offer ( item ) ) { return true ; } else { checkDrainerGone ( ) ; unparkDrainer ( ) ; return false ; } } | Offers an item to the given queue . No check is performed that the queue actually belongs to this conveyor . |
9,179 | public final int drainTo ( int queueIndex , Collection < ? super E > drain ) { return drain ( queues [ queueIndex ] , drain , Integer . MAX_VALUE ) ; } | Drains a batch of items from the queue at the supplied index into the supplied collection . |
9,180 | public final void drainerFailed ( Throwable t ) { if ( t == null ) { throw new NullPointerException ( "ConcurrentConveyor.drainerFailed(null)" ) ; } drainer = null ; drainerDepartureCause = t ; } | Called by the drainer thread to signal that it has failed and will drain no more items from the queue . |
9,181 | private String registerNodeShutdownListener ( ) { HazelcastInstance node = nodeEngine . getHazelcastInstance ( ) ; LifecycleService lifecycleService = node . getLifecycleService ( ) ; return lifecycleService . addLifecycleListener ( new LifecycleListener ( ) { public void stateChanged ( LifecycleEvent event ) { if ( event . getState ( ) == SHUTTING_DOWN ) { Set < Map . Entry < String , InvalidationQueue < Invalidation > > > entries = invalidationQueues . entrySet ( ) ; for ( Map . Entry < String , InvalidationQueue < Invalidation > > entry : entries ) { pollAndSendInvalidations ( entry . getKey ( ) , entry . getValue ( ) ) ; } } } } ) ; } | Sends remaining invalidation events in this invalidator s queues to the recipients . |
9,182 | public static < K , V > MapDataStore < K , V > createWriteBehindStore ( MapStoreContext mapStoreContext , int partitionId , WriteBehindProcessor writeBehindProcessor ) { MapServiceContext mapServiceContext = mapStoreContext . getMapServiceContext ( ) ; NodeEngine nodeEngine = mapServiceContext . getNodeEngine ( ) ; MapStoreConfig mapStoreConfig = mapStoreContext . getMapStoreConfig ( ) ; InternalSerializationService serializationService = ( ( InternalSerializationService ) nodeEngine . getSerializationService ( ) ) ; WriteBehindStore mapDataStore = new WriteBehindStore ( mapStoreContext , partitionId , serializationService ) ; mapDataStore . setWriteBehindQueue ( newWriteBehindQueue ( mapServiceContext , mapStoreConfig . isWriteCoalescing ( ) ) ) ; mapDataStore . setWriteBehindProcessor ( writeBehindProcessor ) ; return ( MapDataStore < K , V > ) mapDataStore ; } | Creates a write behind data store . |
9,183 | public static < K , V > MapDataStore < K , V > createWriteThroughStore ( MapStoreContext mapStoreContext ) { final MapStoreWrapper store = mapStoreContext . getMapStoreWrapper ( ) ; final MapServiceContext mapServiceContext = mapStoreContext . getMapServiceContext ( ) ; final NodeEngine nodeEngine = mapServiceContext . getNodeEngine ( ) ; final InternalSerializationService serializationService = ( ( InternalSerializationService ) nodeEngine . getSerializationService ( ) ) ; return ( MapDataStore < K , V > ) new WriteThroughStore ( store , serializationService ) ; } | Creates a write through data store . |
9,184 | public static < K , V > MapDataStore < K , V > emptyStore ( ) { return ( MapDataStore < K , V > ) EMPTY_MAP_DATA_STORE ; } | Used for providing neutral null behaviour . |
9,185 | public static JsonPathCursor createCursor ( String attributePath ) { ArrayList < Triple > triples = new ArrayList < Triple > ( DEFAULT_PATH_ELEMENT_COUNT ) ; int start = 0 ; int end ; while ( start < attributePath . length ( ) ) { boolean isArray = false ; try { while ( attributePath . charAt ( start ) == '[' || attributePath . charAt ( start ) == '.' ) { start ++ ; } } catch ( IndexOutOfBoundsException e ) { throw createIllegalArgumentException ( attributePath ) ; } end = start + 1 ; while ( end < attributePath . length ( ) ) { char c = attributePath . charAt ( end ) ; if ( '.' == c || '[' == c ) { break ; } else if ( ']' == c ) { isArray = true ; break ; } end ++ ; } String part = attributePath . substring ( start , end ) ; Triple triple = new Triple ( part , part . getBytes ( UTF8_CHARSET ) , isArray ) ; triples . add ( triple ) ; start = end + 1 ; } return new JsonPathCursor ( attributePath , triples ) ; } | Creates a new cursor from given attribute path . |
9,186 | public final void destroyRemotely ( ) { ClientMessage clientMessage = ClientDestroyProxyCodec . encodeRequest ( getDistributedObjectName ( ) , getServiceName ( ) ) ; try { new ClientInvocation ( getClient ( ) , clientMessage , getName ( ) ) . invoke ( ) . get ( ) ; } catch ( Exception e ) { throw rethrow ( e ) ; } } | Destroys the remote distributed object counterpart of this proxy by issuing the destruction request to the cluster . |
9,187 | protected List < T > getBatchChunk ( List < T > list , int batchSize , int chunkNumber ) { if ( list == null || list . isEmpty ( ) ) { return null ; } final int start = chunkNumber * batchSize ; final int end = Math . min ( start + batchSize , list . size ( ) ) ; if ( start >= end ) { return null ; } return list . subList ( start , end ) ; } | Used to partition the list to chunks . |
9,188 | public void init ( ClientContext clientContext ) { this . clientContext = clientContext ; this . clientConnectionStrategyConfig = clientContext . getClientConfig ( ) . getConnectionStrategyConfig ( ) ; this . logger = clientContext . getLoggingService ( ) . getLogger ( ClientConnectionStrategy . class ) ; } | Initialize this strategy with client context and config |
9,189 | public MerkleTreeConfig setMapName ( String mapName ) { if ( StringUtil . isNullOrEmpty ( mapName ) ) { throw new IllegalArgumentException ( "Merkle tree map name must not be empty." ) ; } this . mapName = mapName ; return this ; } | Sets the map name to which this config applies . Map names are also matched by pattern and merkle with map name default applies to all maps that do not have more specific merkle tree configs . |
9,190 | public SecurityConfig setClientPermissionConfigs ( Set < PermissionConfig > permissions ) { if ( securityService == null ) { throw new UnsupportedOperationException ( "Unsupported operation" ) ; } securityService . refreshClientPermissions ( permissions ) ; return this ; } | Updates client permission configuration cluster - wide . |
9,191 | public InternalQueryCache < K , V > tryCreateQueryCache ( String mapName , String cacheName , ConstructorFunction < String , InternalQueryCache < K , V > > constructor ) { ContextMutexFactory . Mutex mutex = lifecycleMutexFactory . mutexFor ( mapName ) ; try { synchronized ( mutex ) { ConcurrentMap < String , InternalQueryCache < K , V > > queryCacheRegistry = getOrPutIfAbsent ( queryCacheRegistryPerMap , mapName , queryCacheRegistryConstructor ) ; InternalQueryCache < K , V > queryCache = queryCacheRegistry . get ( cacheName ) ; String cacheId = queryCache == null ? UuidUtil . newUnsecureUuidString ( ) : queryCache . getCacheId ( ) ; queryCache = constructor . createNew ( cacheId ) ; if ( queryCache != NULL_QUERY_CACHE ) { queryCacheRegistry . put ( cacheName , queryCache ) ; return queryCache ; } return null ; } } finally { closeResource ( mutex ) ; } } | Idempotent query cache create mechanism . |
9,192 | public int getQueryCacheCount ( String mapName ) { Map < String , InternalQueryCache < K , V > > queryCacheRegistry = queryCacheRegistryPerMap . get ( mapName ) ; if ( queryCacheRegistry == null ) { return 0 ; } return queryCacheRegistry . size ( ) ; } | only used in tests |
9,193 | void requestExecution ( ) { for ( ; ; ) { State currentState = state . get ( ) ; switch ( currentState ) { case INACTIVE : if ( state . compareAndSet ( State . INACTIVE , State . RUNNING ) ) { scheduleExecution ( ) ; return ; } break ; case RUNNING : if ( state . compareAndSet ( State . RUNNING , State . REQUESTED ) ) { return ; } break ; default : return ; } } } | Request a new task execution if needed . |
9,194 | void afterExecution ( ) { for ( ; ; ) { State currentState = state . get ( ) ; switch ( currentState ) { case REQUESTED : state . set ( State . RUNNING ) ; scheduleExecution ( ) ; return ; case RUNNING : if ( state . compareAndSet ( State . RUNNING , State . INACTIVE ) ) { return ; } break ; default : throw new IllegalStateException ( "Inactive state is illegal here." ) ; } } } | The task has to call this method after its execution . |
9,195 | private Role calculateRole ( ) { boolean isPartitionOwner = partitionService . isPartitionOwner ( partitionId ) ; boolean isMapNamePartition = partitionId == mapNamePartition ; boolean isMapNamePartitionFirstReplica = false ; if ( hasBackup && isMapNamePartition ) { IPartition partition = partitionService . getPartition ( partitionId ) ; Address firstReplicaAddress = partition . getReplicaAddress ( 1 ) ; Member member = clusterService . getMember ( firstReplicaAddress ) ; if ( member != null ) { isMapNamePartitionFirstReplica = member . localMember ( ) ; } } return assignRole ( isPartitionOwner , isMapNamePartition , isMapNamePartitionFirstReplica ) ; } | Calculates and returns the role for the map key loader on this partition |
9,196 | private ExecutionCallback < Boolean > loadingFinishedCallback ( ) { return new ExecutionCallback < Boolean > ( ) { public void onResponse ( Boolean loadingFinished ) { if ( loadingFinished ) { updateLocalKeyLoadStatus ( null ) ; } } public void onFailure ( Throwable t ) { updateLocalKeyLoadStatus ( t ) ; } } ; } | Returns an execution callback to notify the record store for this map key loader that the key loading has finished . |
9,197 | private void updateLocalKeyLoadStatus ( Throwable t ) { Operation op = new KeyLoadStatusOperation ( mapName , t ) ; if ( hasBackup && role . is ( Role . SENDER_BACKUP ) ) { opService . createInvocationBuilder ( SERVICE_NAME , op , partitionId ) . setReplicaIndex ( 1 ) . invoke ( ) ; } else { opService . createInvocationBuilder ( SERVICE_NAME , op , partitionId ) . invoke ( ) ; } } | Notifies the record store of this map key loader that key loading has completed . |
9,198 | public Future < ? > startLoading ( MapStoreContext mapStoreContext , boolean replaceExistingValues ) { role . nextOrStay ( Role . SENDER ) ; if ( state . is ( State . LOADING ) ) { return keyLoadFinished ; } state . next ( State . LOADING ) ; return sendKeys ( mapStoreContext , replaceExistingValues ) ; } | Triggers key and value loading if there is no ongoing or completed key loading task otherwise does nothing . The actual loading is done on a separate thread . |
9,199 | public void triggerLoadingWithDelay ( ) { if ( delayedTrigger == null ) { Runnable runnable = ( ) -> { Operation op = new TriggerLoadIfNeededOperation ( mapName ) ; opService . invokeOnPartition ( SERVICE_NAME , op , mapNamePartition ) ; } ; delayedTrigger = new CoalescingDelayedTrigger ( execService , LOADING_TRIGGER_DELAY , LOADING_TRIGGER_DELAY , runnable ) ; } delayedTrigger . executeWithDelay ( ) ; } | Triggers key loading on SENDER if it hadn t started . Delays triggering if invoked multiple times . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.