idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
8,900 | public void forEach ( final Consumer < V > consumer ) { for ( Map . Entry < Long , V > entry : map . entrySet ( ) ) { consumer . accept ( entry . getValue ( ) ) ; } } | Iterate over the values in the map |
8,901 | public static String removeModifierSuffix ( String fullName ) { int indexOfFirstOpeningToken = fullName . indexOf ( MODIFIER_OPENING_TOKEN ) ; if ( indexOfFirstOpeningToken == - 1 ) { return fullName ; } int indexOfSecondOpeningToken = fullName . lastIndexOf ( MODIFIER_OPENING_TOKEN ) ; if ( indexOfSecondOpeningToken !... | Remove modifier suffix from given fullName . |
8,902 | public static String getModifierSuffix ( String fullName , String baseName ) { if ( fullName . equals ( baseName ) ) { return null ; } int indexOfOpeningBracket = fullName . indexOf ( MODIFIER_OPENING_TOKEN ) ; return fullName . substring ( indexOfOpeningBracket , fullName . length ( ) ) ; } | Get modifier suffix if fullName contains any otherwise returns null . |
8,903 | public < T > T readDataAsObject ( ) throws IOException { Data data = readData ( ) ; return data == null ? null : ( T ) serializationService . toObject ( data ) ; } | a future optimization would be to skip the construction of the Data object . |
8,904 | private boolean isValidJoinMessage ( JoinMessage joinMessage ) { try { return validateJoinMessage ( joinMessage ) ; } catch ( ConfigMismatchException e ) { throw e ; } catch ( Exception e ) { return false ; } } | rethrows only on ConfigMismatchException ; in case of other exception returns false . |
8,905 | public void handleMasterResponse ( Address masterAddress , Address callerAddress ) { clusterServiceLock . lock ( ) ; try { if ( logger . isFineEnabled ( ) ) { logger . fine ( format ( "Handling master response %s from %s" , masterAddress , callerAddress ) ) ; } if ( clusterService . isJoined ( ) ) { if ( logger . isFin... | Set master address if required . |
8,906 | private boolean shouldMergeTo ( Address thisAddress , Address targetAddress ) { String thisAddressStr = "[" + thisAddress . getHost ( ) + "]:" + thisAddress . getPort ( ) ; String targetAddressStr = "[" + targetAddress . getHost ( ) + "]:" + targetAddress . getPort ( ) ; if ( thisAddressStr . equals ( targetAddressStr ... | Determines whether this address should merge to target address and called when two sides are equal on all aspects . This is a pure function that must produce always the same output when called with the same parameters . This logic should not be changed otherwise compatibility will be broken . |
8,907 | public static TransactionContext getTransactionContext ( HazelcastInstance hazelcastInstance ) { TransactionContextHolder transactionContextHolder = ( TransactionContextHolder ) TransactionSynchronizationManager . getResource ( hazelcastInstance ) ; if ( transactionContextHolder == null ) { throw new NoTransactionExcep... | Returns the transaction context for the given Hazelcast instance bounded to the current thread . |
8,908 | protected MergePolicyConfig mergePolicyConfig ( boolean mergePolicyExist , String mergePolicy , int batchSize ) { if ( mergePolicyExist ) { MergePolicyConfig config = new MergePolicyConfig ( mergePolicy , batchSize ) ; return config ; } return new MergePolicyConfig ( ) ; } | returns a MergePolicyConfig based on given parameters if these exist or the default MergePolicyConfig |
8,909 | public void start ( ) { if ( ! raftIntegration . isReady ( ) ) { raftIntegration . schedule ( new Runnable ( ) { public void run ( ) { start ( ) ; } } , RAFT_NODE_INIT_DELAY_MILLIS , MILLISECONDS ) ; return ; } if ( logger . isFineEnabled ( ) ) { logger . fine ( "Starting raft node: " + localMember + " for " + groupId ... | Starts the periodic tasks such as voting leader failure - detection snapshot handling . |
8,910 | private void applyLogEntry ( LogEntry entry ) { if ( logger . isFineEnabled ( ) ) { logger . fine ( "Processing " + entry ) ; } Object response = null ; Object operation = entry . operation ( ) ; if ( operation instanceof RaftGroupCmd ) { if ( operation instanceof DestroyRaftGroupCmd ) { setStatus ( TERMINATED ) ; } el... | Applies the log entry by executing operation attached and set execution result to the related future if any available . |
8,911 | public void runQueryOperation ( Object operation , SimpleCompletableFuture resultFuture ) { long commitIndex = state . commitIndex ( ) ; Object result = raftIntegration . runOperation ( operation , commitIndex ) ; resultFuture . setResult ( result ) ; } | Executes query operation sets execution result to the future . |
8,912 | public boolean installSnapshot ( SnapshotEntry snapshot ) { long commitIndex = state . commitIndex ( ) ; if ( commitIndex > snapshot . index ( ) ) { logger . info ( "Ignored stale " + snapshot + ", commit index at: " + commitIndex ) ; return false ; } else if ( commitIndex == snapshot . index ( ) ) { logger . info ( "I... | Restores the snapshot sent by the leader if it s not applied before . |
8,913 | public void updateGroupMembers ( long logIndex , Collection < Endpoint > members ) { state . updateGroupMembers ( logIndex , members ) ; printMemberState ( ) ; } | Updates Raft group members . |
8,914 | private int pollRemovedCountHolders ( AtomicReferenceArray < Queue < Integer > > removedCountHolders ) { int count = 0 ; for ( int i = 0 ; i < partitionCount ; i ++ ) { Queue < Integer > removalCounts = removedCountHolders . get ( i ) ; count += removalCounts . poll ( ) ; } return count ; } | should be called when noMissingMapWideEvent false otherwise polling can cause NPE |
8,915 | private void evictMap ( SampleableConcurrentHashMap < ? , ? > map , int triggeringEvictionSize , int afterEvictionSize ) { map . purgeStaleEntries ( ) ; int mapSize = map . size ( ) ; if ( mapSize - triggeringEvictionSize >= 0 ) { for ( SampleableConcurrentHashMap . SamplingEntry entry : map . getRandomSamples ( mapSiz... | It works on best effort basis . If multi - threaded calls involved it may evict all elements but it s unlikely . |
8,916 | public int drainTo ( Collection < E > collection ) { int size = queue . drainTo ( collection ) ; addCapacity ( - size ) ; return size ; } | Removes all elements from this queue and adds them to the given collection . |
8,917 | public static Data toHeapData ( Data data ) { if ( data == null || data instanceof HeapData ) { return data ; } return new HeapData ( data . toByteArray ( ) ) ; } | Converts Data to HeapData . Useful for offheap conversion . |
8,918 | public void setEntryCounting ( boolean enable ) { if ( enable ) { if ( ! entryCountingEnable ) { cacheContext . increaseEntryCount ( size ( ) ) ; } } else { if ( entryCountingEnable ) { cacheContext . decreaseEntryCount ( size ( ) ) ; } } this . entryCountingEnable = enable ; } | Called by only same partition thread . So there is no synchronization and visibility problem . |
8,919 | void setClusterTimeDiff ( long diff ) { if ( logger . isFineEnabled ( ) ) { logger . fine ( "Setting cluster time diff to " + diff + "ms." ) ; } if ( abs ( diff ) > abs ( maxClusterTimeDiff ) ) { maxClusterTimeDiff = diff ; } this . clusterTimeDiff = diff ; } | Set the cluster time diff and records the maximum observed cluster time diff |
8,920 | public static int calculateMaxPartitionSize ( int maxEntryCount , int partitionCount ) { final double balancedPartitionSize = ( double ) maxEntryCount / ( double ) partitionCount ; final double approximatedStdDev = Math . sqrt ( balancedPartitionSize ) ; int stdDevMultiplier ; if ( maxEntryCount <= STD_DEV_OF_5_THRESHO... | for calculating the estimated max size . |
8,921 | private void ensureQuorumPresent ( Operation op ) { QuorumServiceImpl quorumService = operationService . nodeEngine . getQuorumService ( ) ; quorumService . ensureQuorumPresent ( op ) ; } | Ensures that the quorum is present if the quorum is configured and the operation service is quorum aware . |
8,922 | public final void run ( ) { int partitionCount = partitionService . getPartitionCount ( ) ; latch = new CountDownLatch ( partitionCount ) ; for ( int partitionId = 0 ; partitionId < partitionCount ; partitionId ++ ) { operationExecutor . execute ( new CollectContainerRunnable ( partitionId ) ) ; } try { latch . await (... | Collects the containers from the data structure in a thread - safe way . |
8,923 | public final void destroy ( ) { for ( Collection < C > containers : containersByPartitionId . values ( ) ) { for ( C container : containers ) { destroy ( container ) ; } } containersByPartitionId . clear ( ) ; onDestroy ( ) ; } | Destroys all collected containers . |
8,924 | private static int setAndGetAllListenerFlags ( ) { int listenerFlags = 0 ; EntryEventType [ ] values = EntryEventType . values ( ) ; for ( EntryEventType eventType : values ) { listenerFlags = listenerFlags | eventType . getType ( ) ; } return listenerFlags ; } | Sets and gets all listener flags . |
8,925 | protected void sendClientMessage ( Throwable throwable ) { if ( throwable instanceof ScheduledTaskResult . ExecutionExceptionDecorator ) { super . sendClientMessage ( throwable . getCause ( ) ) ; } else { super . sendClientMessage ( throwable ) ; } } | Exceptions may be wrapped in ExecutionExceptionDecorator the wrapped ExecutionException should be sent to the client . |
8,926 | private static void checkValidAlternative ( List < ClientConfig > alternativeClientConfigs ) { if ( alternativeClientConfigs . isEmpty ( ) ) { throw new InvalidConfigurationException ( "ClientFailoverConfig should have at least one client config." ) ; } ClientConfig mainConfig = alternativeClientConfigs . get ( 0 ) ; f... | For a client to be valid alternative all configurations should be equal except GroupConfig SecurityConfig Discovery related parts of NetworkConfig Credentials related configs |
8,927 | public static JsonArray array ( String ... strings ) { if ( strings == null ) { throw new NullPointerException ( "values is null" ) ; } JsonArray array = new JsonArray ( ) ; for ( String value : strings ) { array . add ( value ) ; } return array ; } | Creates a new JsonArray that contains the JSON representations of the given strings . |
8,928 | public static JsonValue parse ( String string ) { if ( string == null ) { throw new NullPointerException ( "string is null" ) ; } DefaultHandler handler = new DefaultHandler ( ) ; new JsonParser ( handler ) . parse ( string ) ; return handler . getValue ( ) ; } | Parses the given input string as JSON . The input must contain a valid JSON value optionally padded with whitespace . |
8,929 | public static long fastLongMix ( long k ) { final long phi = 0x9E3779B97F4A7C15L ; long h = k * phi ; h ^= h >>> 32 ; return h ^ ( h >>> 16 ) ; } | Hash function based on Knuth s multiplicative method . This version is faster than using Murmur hash but provides acceptable behavior . |
8,930 | private void flushAndRemoveQueryCaches ( PartitionMigrationEvent event ) { int partitionId = event . getPartitionId ( ) ; QueryCacheContext queryCacheContext = mapServiceContext . getQueryCacheContext ( ) ; PublisherContext publisherContext = queryCacheContext . getPublisherContext ( ) ; if ( event . getMigrationEndpoi... | Flush and remove query cache on this source partition . |
8,931 | public List < T > descendingKeys ( ) { List < T > list = new ArrayList < T > ( map . keySet ( ) ) ; sort ( list , new Comparator < T > ( ) { public int compare ( T o1 , T o2 ) { MutableLong l1 = map . get ( o1 ) ; MutableLong l2 = map . get ( o2 ) ; return compare ( l2 . value , l1 . value ) ; } private int compare ( l... | Returns a List of keys in descending value order . |
8,932 | public long get ( T item ) { MutableLong count = map . get ( item ) ; return count == null ? 0 : count . value ; } | Get current counter for an item item |
8,933 | public void set ( T item , long value ) { MutableLong entry = map . get ( item ) ; if ( entry == null ) { entry = MutableLong . valueOf ( value ) ; map . put ( item , entry ) ; total += value ; } else { total -= entry . value ; total += value ; entry . value = value ; } } | Set counter of item to value |
8,934 | public void add ( T item , long delta ) { MutableLong entry = map . get ( item ) ; if ( entry == null ) { entry = MutableLong . valueOf ( delta ) ; map . put ( item , entry ) ; } else { entry . value += delta ; } total += delta ; } | Add delta to the item |
8,935 | public long getAndSet ( T item , long value ) { MutableLong entry = map . get ( item ) ; if ( entry == null ) { entry = MutableLong . valueOf ( value ) ; map . put ( item , entry ) ; total += value ; return 0 ; } long oldValue = entry . value ; total = total - oldValue + value ; entry . value = value ; return oldValue ... | Set counter for item and return previous value |
8,936 | public boolean imbalanceDetected ( LoadImbalance imbalance ) { long min = imbalance . minimumLoad ; long max = imbalance . maximumLoad ; if ( min == Long . MIN_VALUE || max == Long . MAX_VALUE ) { return false ; } long lowerBound = ( long ) ( MIN_MAX_RATIO_MIGRATION_THRESHOLD * max ) ; return min < lowerBound ; } | Checks if an imbalance was detected in the system |
8,937 | public MigratablePipeline findPipelineToMigrate ( LoadImbalance imbalance ) { Set < ? extends MigratablePipeline > candidates = imbalance . getPipelinesOwnedBy ( imbalance . srcOwner ) ; long migrationThreshold = ( long ) ( ( imbalance . maximumLoad - imbalance . minimumLoad ) * MAXIMUM_NO_OF_EVENTS_AFTER_MIGRATION_COE... | Attempt to find a pipeline to migrate to a new NioThread . |
8,938 | public void addEventData ( CacheEventData cacheEventData ) { if ( events == null ) { events = new HashSet < CacheEventData > ( ) ; } this . events . add ( cacheEventData ) ; } | Helper method for adding multiple CacheEventData into this Set |
8,939 | public static < T > T newInstanceOrNull ( Class < ? extends T > clazz , Object ... params ) { Constructor < T > constructor = selectMatchingConstructor ( clazz , params ) ; if ( constructor == null ) { return null ; } try { return constructor . newInstance ( params ) ; } catch ( IllegalAccessException e ) { return null... | Create a new instance of a given class . It will search for a constructor matching passed parameters . If a matching constructor is not found then it returns null . |
8,940 | public static < K , V > Map < K , V > aggregate ( Map < K , V > map1 , Map < K , V > map2 ) { return new AggregatingMap < K , V > ( map1 , map2 ) ; } | Creates new aggregating maps . |
8,941 | @ SuppressWarnings ( "unchecked" ) < T > ICompletableFuture < Map < Integer , T > > invokeAsync ( ) { assert ! invoked : "already invoked" ; invoked = true ; ensureNotCallingFromPartitionOperationThread ( ) ; invokeOnAllPartitions ( ) ; return future ; } | Executes all the operations on the partitions . |
8,942 | @ SuppressWarnings ( "unchecked" ) public < E > E read ( long sequence ) { checkReadSequence ( sequence ) ; return ( E ) items [ toIndex ( sequence ) ] ; } | Reads one item from the ringbuffer . |
8,943 | protected void markExpirable ( long expiryTime ) { if ( expiryTime > 0 && expiryTime < Long . MAX_VALUE ) { hasEntryWithExpiration = true ; } if ( isPrimary ( ) && hasEntryWithExpiration ) { cacheService . getExpirationManager ( ) . scheduleExpirationTask ( ) ; } } | This method marks current replica as expirable and also starts expiration task if necessary . |
8,944 | public static < T > T [ ] createCopy ( T [ ] src ) { return Arrays . copyOf ( src , src . length ) ; } | Create copy of the src array . |
8,945 | public static < T > T [ ] remove ( T [ ] src , T object ) { int index = indexOf ( src , object ) ; if ( index == - 1 ) { return src ; } T [ ] dst = ( T [ ] ) Array . newInstance ( src . getClass ( ) . getComponentType ( ) , src . length - 1 ) ; System . arraycopy ( src , 0 , dst , 0 , index ) ; if ( index < src . lengt... | Removes an item from the array . |
8,946 | public static < T > T [ ] append ( T [ ] array1 , T [ ] array2 ) { T [ ] dst = ( T [ ] ) Array . newInstance ( array1 . getClass ( ) . getComponentType ( ) , array1 . length + array2 . length ) ; System . arraycopy ( array1 , 0 , dst , 0 , array1 . length ) ; System . arraycopy ( array2 , 0 , dst , array1 . length , ar... | Appends 2 arrays . |
8,947 | public static < T > T [ ] replaceFirst ( T [ ] src , T oldValue , T [ ] newValues ) { int index = indexOf ( src , oldValue ) ; if ( index == - 1 ) { return src ; } T [ ] dst = ( T [ ] ) Array . newInstance ( src . getClass ( ) . getComponentType ( ) , src . length - 1 + newValues . length ) ; System . arraycopy ( src ,... | Replaces the first occurrence of the oldValue by the newValue . |
8,948 | public static String getInstanceName ( String instanceName , Config config ) { String name = instanceName ; if ( name == null || name . trim ( ) . length ( ) == 0 ) { name = createInstanceName ( config ) ; } return name ; } | Return real name for the hazelcast instance s instance |
8,949 | public VoteRequest toCandidate ( ) { role = RaftRole . CANDIDATE ; preCandidateState = null ; leaderState = null ; candidateState = new CandidateState ( majority ( ) ) ; candidateState . grantVote ( localEndpoint ) ; persistVote ( incrementTerm ( ) , localEndpoint ) ; return new VoteRequest ( localEndpoint , term , log... | Switches this node to candidate role . Clears pre - candidate and leader states . Initializes candidate state for current majority and grants vote for local endpoint as a candidate . |
8,950 | public void updateGroupMembers ( long logIndex , Collection < Endpoint > members ) { assert committedGroupMembers == lastGroupMembers : "Cannot update group members to: " + members + " at log index: " + logIndex + " because last group members: " + lastGroupMembers + " is different than committed group members: " + comm... | Initializes the last applied group members with the members and logIndex . This method expects there s no uncommitted membership changes committed members are the same as the last applied members . |
8,951 | public void init ( boolean fromBackup ) { if ( ! fromBackup && store . isEnabled ( ) ) { Set < Long > keys = store . loadAllKeys ( ) ; if ( keys != null ) { long maxId = - 1 ; for ( Long key : keys ) { QueueItem item = new QueueItem ( this , key , null ) ; getItemQueue ( ) . offer ( item ) ; maxId = Math . max ( maxId ... | Initializes the item queue with items from the queue store if the store is enabled and if item queue is not being initialized as a part of a backup operation . If the item queue is being initialized as a part of a backup operation then the operation is in charge of adding items to a queue and the items are not loaded f... |
8,952 | public void txnPollBackupReserve ( long itemId , String transactionId ) { QueueItem item = getBackupMap ( ) . remove ( itemId ) ; if ( item != null ) { txMap . put ( itemId , new TxQueueItem ( item ) . setPollOperation ( true ) . setTransactionId ( transactionId ) ) ; return ; } if ( txMap . remove ( itemId ) == null )... | Makes a reservation for a poll operation . Should be executed as a part of the prepare phase for a transactional queue poll on the partition backup replica . The ID of the item being polled is determined by the partition owner . |
8,953 | public long offer ( Data data ) { QueueItem item = new QueueItem ( this , nextId ( ) , null ) ; if ( store . isEnabled ( ) ) { try { store . store ( item . getItemId ( ) , data ) ; } catch ( Exception e ) { throw new HazelcastException ( e ) ; } } if ( ! store . isEnabled ( ) || store . getMemoryLimit ( ) > getItemQueu... | TX Methods Ends |
8,954 | public void offerBackup ( Data data , long itemId ) { QueueItem item = new QueueItem ( this , itemId , null ) ; if ( ! store . isEnabled ( ) || store . getMemoryLimit ( ) > getItemQueue ( ) . size ( ) ) { item . setData ( data ) ; } getBackupMap ( ) . put ( itemId , item ) ; } | Offers the item to the backup map . If the memory limit has been achieved the item data will not be kept in - memory . Executed on the backup replica |
8,955 | public void addAllBackup ( Map < Long , Data > dataMap ) { for ( Map . Entry < Long , Data > entry : dataMap . entrySet ( ) ) { QueueItem item = new QueueItem ( this , entry . getKey ( ) , null ) ; if ( ! store . isEnabled ( ) || store . getMemoryLimit ( ) > getItemQueue ( ) . size ( ) ) { item . setData ( entry . getV... | Offers the items to the backup map in bulk . If the memory limit has been achieved the item data will not be kept in - memory . Executed on the backup replica |
8,956 | public void pollBackup ( long itemId ) { QueueItem item = getBackupMap ( ) . remove ( itemId ) ; if ( item != null ) { age ( item , Clock . currentTimeMillis ( ) ) ; } } | Polls an item on the backup replica . The item ID is predetermined when executing the poll operation on the partition owner . Executed on the backup replica |
8,957 | public long remove ( Data data ) { Iterator < QueueItem > iterator = getItemQueue ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { QueueItem item = iterator . next ( ) ; if ( data . equals ( item . getData ( ) ) ) { if ( store . isEnabled ( ) ) { try { store . delete ( item . getItemId ( ) ) ; } catch ( Exceptio... | iterates all items checks equality with data This method does not trigger store load . |
8,958 | public boolean contains ( Collection < Data > dataSet ) { for ( Data data : dataSet ) { boolean contains = false ; for ( QueueItem item : getItemQueue ( ) ) { if ( item . getData ( ) != null && item . getData ( ) . equals ( data ) ) { contains = true ; break ; } } if ( ! contains ) { return false ; } } return true ; } | Checks if the queue contains all items in the dataSet . This method does not trigger store load . |
8,959 | public List < Data > getAsDataList ( ) { List < Data > dataList = new ArrayList < Data > ( getItemQueue ( ) . size ( ) ) ; for ( QueueItem item : getItemQueue ( ) ) { if ( store . isEnabled ( ) && item . getData ( ) == null ) { try { load ( item ) ; } catch ( Exception e ) { throw new HazelcastException ( e ) ; } } dat... | Returns data in the queue . This method triggers store load . |
8,960 | public Deque < QueueItem > getItemQueue ( ) { if ( itemQueue == null ) { itemQueue = new LinkedList < QueueItem > ( ) ; if ( backupMap != null && ! backupMap . isEmpty ( ) ) { List < QueueItem > values = new ArrayList < QueueItem > ( backupMap . values ( ) ) ; Collections . sort ( values ) ; itemQueue . addAll ( values... | Returns the item queue on the partition owner . This method will also move the items from the backup map if this member has been promoted from a backup replica to the partition owner and clear the backup map . |
8,961 | public Map < Long , QueueItem > getBackupMap ( ) { if ( backupMap == null ) { if ( itemQueue != null ) { backupMap = createHashMap ( itemQueue . size ( ) ) ; for ( QueueItem item : itemQueue ) { backupMap . put ( item . getItemId ( ) , item ) ; } itemQueue . clear ( ) ; itemQueue = null ; } else { backupMap = new HashM... | Return the map containing queue items when this instance is a backup replica . The map contains both items that are parts of different transactions and items which have already been committed to the queue . |
8,962 | protected long [ ] createItemIdArray ( ) { int size = operationList . size ( ) ; long [ ] itemIds = new long [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { CollectionTxnOperation operation = ( CollectionTxnOperation ) operationList . get ( i ) ; itemIds [ i ] = CollectionTxnUtil . getItemId ( operation ) ; } return i... | Creates an array of IDs for all operations in this transaction log . The ID is negative if the operation is a remove operation . |
8,963 | private RingbufferConfig getRingbufferConfig ( RingbufferService service , ObjectNamespace ns ) { final String serviceName = ns . getServiceName ( ) ; if ( RingbufferService . SERVICE_NAME . equals ( serviceName ) ) { return service . getRingbufferConfig ( ns . getObjectName ( ) ) ; } else if ( MapService . SERVICE_NAM... | Returns the ringbuffer config for the provided namespace . The namespace provides information whether the requested ringbuffer is a ringbuffer that the user is directly interacting with through a ringbuffer proxy or if this is a backing ringbuffer for an event journal . If a ringbuffer configuration for an event journa... |
8,964 | public void handle ( Data key , String sourceUuid , UUID partitionUuid , long sequence ) { if ( ! localUuid . equals ( sourceUuid ) ) { if ( key == null ) { nearCache . clear ( ) ; } else { nearCache . invalidate ( serializeKeys ? key : serializationService . toObject ( key ) ) ; } } int partitionId = getPartitionIdOrD... | Handles a single invalidation |
8,965 | public void handle ( Collection < Data > keys , Collection < String > sourceUuids , Collection < UUID > partitionUuids , Collection < Long > sequences ) { Iterator < Data > keyIterator = keys . iterator ( ) ; Iterator < Long > sequenceIterator = sequences . iterator ( ) ; Iterator < UUID > partitionUuidIterator = parti... | Handles batch invalidations |
8,966 | @ SuppressWarnings ( "WeakerAccess" ) public void register ( int errorCode , Class clazz , ExceptionFactory exceptionFactory ) { if ( intToFactory . containsKey ( errorCode ) ) { throw new HazelcastException ( "Code " + errorCode + " already used" ) ; } if ( ! clazz . equals ( exceptionFactory . createException ( "" , ... | method is used by Jet |
8,967 | protected boolean notHaveAnyExpirableRecord ( PartitionContainer partitionContainer ) { boolean notExist = true ; final ConcurrentMap < String , RecordStore > maps = partitionContainer . getMaps ( ) ; for ( RecordStore store : maps . values ( ) ) { if ( store . isExpirable ( ) ) { notExist = false ; break ; } } return ... | Here we check if that partition has any expirable record or not if no expirable record exists in that partition no need to fire an expiration operation . |
8,968 | public RestApiConfig enableGroups ( RestEndpointGroup ... endpointGroups ) { if ( endpointGroups != null ) { enabledGroups . addAll ( Arrays . asList ( endpointGroups ) ) ; } return this ; } | Enables provided REST endpoint groups . It doesn t replace already enabled groups . |
8,969 | public RestApiConfig disableGroups ( RestEndpointGroup ... endpointGroups ) { if ( endpointGroups != null ) { enabledGroups . removeAll ( Arrays . asList ( endpointGroups ) ) ; } return this ; } | Disables provided REST endpoint groups . |
8,970 | private int getLocalMemberListIndex ( ) { final Collection < Member > dataMembers = nodeEngine . getClusterService ( ) . getMembers ( DATA_MEMBER_SELECTOR ) ; int index = - 1 ; for ( Member dataMember : dataMembers ) { index ++ ; if ( dataMember . equals ( nodeEngine . getLocalMember ( ) ) ) { return index ; } } return... | Returns the index of the local member in the membership list containing only data members . |
8,971 | public JsonArray add ( JsonValue value ) { if ( value == null ) { throw new NullPointerException ( "value is null" ) ; } values . add ( value ) ; return this ; } | Appends the specified JSON value to the end of this array . |
8,972 | public JsonArray set ( int index , JsonValue value ) { if ( value == null ) { throw new NullPointerException ( "value is null" ) ; } values . set ( index , value ) ; return this ; } | Replaces the element at the specified position in this array with the specified JSON value . |
8,973 | public Iterator < JsonValue > iterator ( ) { final Iterator < JsonValue > iterator = values . iterator ( ) ; return new Iterator < JsonValue > ( ) { public boolean hasNext ( ) { return iterator . hasNext ( ) ; } public JsonValue next ( ) { return iterator . next ( ) ; } public void remove ( ) { throw new UnsupportedOpe... | Returns an iterator over the values of this array in document order . The returned iterator cannot be used to modify this array . |
8,974 | public BufferBuilder append ( ClientProtocolBuffer srcBuffer , int srcOffset , int length ) { ensureCapacity ( length ) ; srcBuffer . getBytes ( srcOffset , protocolBuffer . byteArray ( ) , position , length ) ; position += length ; return this ; } | Append a source buffer to the end of the internal buffer resizing the internal buffer as required . |
8,975 | public void appendEntries ( LogEntry ... newEntries ) { int lastTerm = lastLogOrSnapshotTerm ( ) ; long lastIndex = lastLogOrSnapshotIndex ( ) ; if ( ! checkAvailableCapacity ( newEntries . length ) ) { throw new IllegalStateException ( "Not enough capacity! Capacity: " + logs . getCapacity ( ) + ", Size: " + logs . si... | Appends new entries to the Raft log . |
8,976 | public JsonValue parse ( Reader reader , int buffersize ) throws IOException { if ( reader == null ) { throw new NullPointerException ( "reader is null" ) ; } if ( buffersize <= 0 ) { throw new IllegalArgumentException ( "buffersize is zero or negative" ) ; } this . reader = reader ; buffer = new char [ buffersize ] ; ... | Reads a single value from the given reader and parses it as JsonValue . The input must be pointing to the beginning of a JsonLiteral not JsonArray or JsonObject . |
8,977 | public static long getThreadId ( ) { final Long threadId = THREAD_LOCAL . get ( ) ; if ( threadId != null ) { return threadId ; } return Thread . currentThread ( ) . getId ( ) ; } | Get the thread ID . |
8,978 | public static String createThreadName ( String hzName , String name ) { checkNotNull ( name , "name can't be null" ) ; return "hz." + hzName + "." + name ; } | Creates the threadname with prefix and notation . |
8,979 | public V get ( SerializationService serializationService ) { if ( ! valueExists ) { assert serializationService != null ; value = serializationService . toObject ( serializedValue ) ; valueExists = true ; } return value ; } | get - or - deserialize - and - get |
8,980 | public DeferredValue < V > shallowCopy ( ) { if ( this == NULL_VALUE ) { return NULL_VALUE ; } DeferredValue < V > copy = new DeferredValue < V > ( ) ; if ( serializedValueExists ) { copy . serializedValueExists = true ; copy . serializedValue = serializedValue ; } if ( valueExists ) { copy . valueExists = true ; copy ... | returns a new DeferredValue representing the same value as this |
8,981 | void updateMembers ( MembersView membersView ) { MemberMap currentMemberMap = memberMapRef . get ( ) ; Collection < MemberImpl > addedMembers = new LinkedList < > ( ) ; Collection < MemberImpl > removedMembers = new LinkedList < > ( ) ; ClusterHeartbeatManager clusterHeartbeatManager = clusterService . getClusterHeartb... | handles both new and left members |
8,982 | protected String decrypt ( String encryptedStr ) throws Exception { String [ ] split = encryptedStr . split ( ":" ) ; checkTrue ( split . length == 3 , "Wrong format of the encrypted variable (" + encryptedStr + ")" ) ; byte [ ] salt = Base64 . getDecoder ( ) . decode ( split [ 0 ] . getBytes ( UTF8_CHARSET ) ) ; check... | Decrypts given encrypted variable . |
8,983 | public void shutdownInvocations ( ) { logger . finest ( "Shutting down invocations" ) ; invocationRegistry . shutdown ( ) ; invocationMonitor . shutdown ( ) ; inboundResponseHandlerSupplier . shutdown ( ) ; try { invocationMonitor . awaitTermination ( TERMINATION_TIMEOUT_MILLIS ) ; } catch ( InterruptedException e ) { ... | Shuts down invocation infrastructure . New invocation requests will be rejected after shutdown and all pending invocations will be notified with a failure response . |
8,984 | public static void markPartitionAsIndexed ( int partitionId , InternalIndex [ ] indexes ) { for ( InternalIndex index : indexes ) { index . markPartitionAsIndexed ( partitionId ) ; } } | Marks the given partition as indexed by the given indexes . |
8,985 | public static void markPartitionAsUnindexed ( int partitionId , InternalIndex [ ] indexes ) { for ( InternalIndex index : indexes ) { index . markPartitionAsUnindexed ( partitionId ) ; } } | Marks the given partition as unindexed by the given indexes . |
8,986 | public void destroyIndexes ( ) { InternalIndex [ ] indexesSnapshot = getIndexes ( ) ; indexes = EMPTY_INDEXES ; compositeIndexes = EMPTY_INDEXES ; indexesByName . clear ( ) ; attributeIndexRegistry . clear ( ) ; converterCache . clear ( ) ; for ( InternalIndex index : indexesSnapshot ) { index . destroy ( ) ; } } | Destroys and then removes all the indexes from this indexes instance . |
8,987 | public void putEntry ( QueryableEntry queryableEntry , Object oldValue , Index . OperationSource operationSource ) { InternalIndex [ ] indexes = getIndexes ( ) ; for ( InternalIndex index : indexes ) { index . putEntry ( queryableEntry , oldValue , operationSource ) ; } } | Inserts a new queryable entry into this indexes instance or updates the existing one . |
8,988 | public void removeEntry ( Data key , Object value , Index . OperationSource operationSource ) { InternalIndex [ ] indexes = getIndexes ( ) ; for ( InternalIndex index : indexes ) { index . removeEntry ( key , value , operationSource ) ; } } | Removes the entry from this indexes instance identified by the given key and value . |
8,989 | @ SuppressWarnings ( "unchecked" ) public Set < QueryableEntry > query ( Predicate predicate ) { stats . incrementQueryCount ( ) ; if ( ! haveAtLeastOneIndex ( ) || ! ( predicate instanceof IndexAwarePredicate ) ) { return null ; } IndexAwarePredicate indexAwarePredicate = ( IndexAwarePredicate ) predicate ; QueryConte... | Performs a query on this indexes instance using the given predicate . |
8,990 | private void verifyNodeStarted ( ) { NodeEngineImpl nodeEngine = ( NodeEngineImpl ) getNodeEngine ( ) ; nodeStartCompleted = nodeEngine . getNode ( ) . getNodeExtension ( ) . isStartCompleted ( ) ; if ( ! nodeStartCompleted ) { throw new IllegalStateException ( "Migration operation is received before startup is complet... | Verifies that the node startup is completed . |
8,991 | private void verifyPartitionStateVersion ( ) { InternalPartitionService partitionService = getService ( ) ; int localPartitionStateVersion = partitionService . getPartitionStateVersion ( ) ; if ( partitionStateVersion != localPartitionStateVersion ) { if ( getNodeEngine ( ) . getThisAddress ( ) . equals ( migrationInfo... | Verifies that the sent partition state version matches the local version or this node is master . |
8,992 | final void verifyMaster ( ) { NodeEngine nodeEngine = getNodeEngine ( ) ; Address masterAddress = nodeEngine . getMasterAddress ( ) ; if ( ! migrationInfo . getMaster ( ) . equals ( masterAddress ) ) { throw new IllegalStateException ( "Migration initiator is not master node! => " + toString ( ) ) ; } if ( getMigration... | Verifies that the local master is equal to the migration master . |
8,993 | private void verifyMigrationParticipant ( ) { Member localMember = getNodeEngine ( ) . getLocalMember ( ) ; if ( getMigrationParticipantType ( ) == MigrationParticipant . SOURCE ) { if ( migrationInfo . getSourceCurrentReplicaIndex ( ) == 0 && ! migrationInfo . getSource ( ) . isIdentical ( localMember ) ) { throw new ... | Checks if the local member matches the migration source or destination if this node is the migration source or destination . |
8,994 | private void verifyPartitionOwner ( ) { InternalPartition partition = getPartition ( ) ; PartitionReplica owner = partition . getOwnerReplicaOrNull ( ) ; if ( owner == null ) { throw new RetryableHazelcastException ( "Cannot migrate at the moment! Owner of the partition is null => " + migrationInfo ) ; } if ( ! owner .... | Verifies that this node is the owner of the partition . |
8,995 | final void verifyExistingDestination ( ) { PartitionReplica destination = migrationInfo . getDestination ( ) ; Member target = getNodeEngine ( ) . getClusterService ( ) . getMember ( destination . address ( ) , destination . uuid ( ) ) ; if ( target == null ) { throw new TargetNotMemberException ( "Destination of migra... | Verifies that the destination is a cluster member . |
8,996 | private void verifyClusterState ( ) { NodeEngineImpl nodeEngine = ( NodeEngineImpl ) getNodeEngine ( ) ; ClusterState clusterState = nodeEngine . getClusterService ( ) . getClusterState ( ) ; if ( ! clusterState . isMigrationAllowed ( ) ) { throw new IllegalStateException ( "Cluster state does not allow migrations! " +... | Verifies that the cluster is active . |
8,997 | void setActiveMigration ( ) { InternalPartitionServiceImpl partitionService = getService ( ) ; MigrationManager migrationManager = partitionService . getMigrationManager ( ) ; MigrationInfo currentActiveMigration = migrationManager . setActiveMigration ( migrationInfo ) ; if ( currentActiveMigration != null ) { if ( mi... | Sets the active migration and the partition migration flag . |
8,998 | @ SuppressWarnings ( "unchecked" ) private < T > T extract ( I input ) { if ( attributePath == null ) { if ( input instanceof Map . Entry ) { return ( T ) ( ( Map . Entry ) input ) . getValue ( ) ; } } else if ( input instanceof Extractable ) { return ( T ) ( ( Extractable ) input ) . getAttributeValue ( attributePath ... | Extract the value of the given attributePath from the given entry . |
8,999 | final void initInvocationTarget ( ) throws Exception { Member previousTargetMember = targetMember ; T target = getInvocationTarget ( ) ; if ( target == null ) { remote = false ; throw newTargetNullException ( ) ; } targetMember = toTargetMember ( target ) ; if ( targetMember != null ) { targetAddress = targetMember . g... | Initializes the invocation target . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.