name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
hbase_ReplicationPeerManager_isStringEquals_rdh
/** * For replication peer cluster key or endpoint class, null and empty string is same. So here * don't use {@link StringUtils#equals(CharSequence, CharSequence)} directly. */ private boolean isStringEquals(String s1, String s2) { if (StringUtils.isBlank(s1)) { return StringUtils.isBlank(s2); } ...
3.26
hbase_ReplicationPeerManager_checkNamespacesAndTableCfsConfigConflict_rdh
/** * Set a namespace in the peer config means that all tables in this namespace will be replicated * to the peer cluster. * <ol> * <li>If peer config already has a namespace, then not allow set any table of this namespace to * the peer config.</li> * <li>If peer config already has a table, then not allow set thi...
3.26
hbase_ReplicationPeerManager_migrateQueuesFromZk_rdh
/** * Submit the migration tasks to the given {@code executor}. */ CompletableFuture<?> migrateQueuesFromZk(ZKWatcher zookeeper, ExecutorService executor) {// the replication queue table creation is asynchronous and will be triggered by addPeer, so // here we need to manually initialize it since we will not cal...
3.26
hbase_ReplicationPeerManager_preUpdatePeerConfig_rdh
/** * Return the old peer description. Can never be null. */ ReplicationPeerDescription preUpdatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws DoNotRetryIOException { checkPeerConfig(peerConfig); ReplicationPeerDescription desc = checkPeerExists(peerId); ReplicationPeerConfig oldPeerConfig = de...
3.26
hbase_ReplicationPeerManager_preTransitPeerSyncReplicationState_rdh
/** * Returns the old desciption of the peer */ ReplicationPeerDescription preTransitPeerSyncReplicationState(String peerId, SyncReplicationState state) throws DoNotRetryIOException { ReplicationPeerDescription desc = checkPeerExists(peerId); SyncReplicationState fromState = desc.getSyncReplicationState(); EnumSet<Sy...
3.26
pulsar_EventLoopUtil_getClientSocketChannelClass_rdh
/** * Return a SocketChannel class suitable for the given EventLoopGroup implementation. * * @param eventLoopGroup * @return */ public static Class<? extends SocketChannel> getClientSocketChannelClass(EventLoopGroup eventLoopGroup) { if (eventLoopGroup instanceof IOUringEventLoopGroup) { return IOUring...
3.26
pulsar_EventLoopUtil_shutdownGracefully_rdh
/** * Shutdowns the EventLoopGroup gracefully. Returns a {@link CompletableFuture} * * @param eventLoopGroup * the event loop to shutdown * @return CompletableFuture that completes when the shutdown has completed */ public static CompletableFuture<Void> shutdownGracefully(EventLo...
3.26
pulsar_EventLoopUtil_newEventLoopGroup_rdh
/** * * @return an EventLoopGroup suitable for the current platform */ public static EventLoopGroup newEventLoopGroup(int nThreads, boolean enableBusyWait, ThreadFactory threadFactory) { if (Epoll.isAvailable()) { String enableIoUring = System.getProperty(ENABLE_IO_URING); // By default, io_urin...
3.26
pulsar_OffloaderUtils_getOffloaderFactory_rdh
/** * Extract the Pulsar offloader class from a offloader archive. * * @param narPath * nar package path * @return the offloader class name * @throws IOException * when fail to retrieve the pulsar offloader class */ static Pair<NarClassLoader, LedgerOffloaderFactory> getOffloaderFactory(String narPath, Stri...
3.26
pulsar_Transactions_getPendingAckStatsAsync_rdh
/** * Get transaction pending ack stats. * * @param topic * the topic of this transaction pending ack stats * @param subName * the subscription name of this transaction pending ack stats * @return the stats of transaction pending ack. */ default CompletableFuture<TransactionPendingAckStats> getPendingAckSta...
3.26
pulsar_Transactions_getTransactionBufferStats_rdh
/** * Get transaction buffer stats. * * @param topic * the topic of getting transaction buffer stats * @return the stats of transaction buffer in topic. */ default TransactionBufferStats getTransactionBufferStats(String topic) throws PulsarAdminException { return getTransactionBufferStats(topic, false, f...
3.26
pulsar_Transactions_m0_rdh
/** * Get transaction pending ack stats. * * @param topic * the topic of this transaction pending ack stats * @param subName * the subscription name of this transaction pending ack stats * @return the stats of transaction pending ack. */ default TransactionPendingAckStats m0(String topic, String subName) t...
3.26
pulsar_ResourceQuota_substract_rdh
/** * Substract quota. * * @param quota * <code>ResourceQuota</code> to substract */ public void substract(ResourceQuota quota) { this.msgRateIn -= quota.msgRateIn; this.msgRateOut -= quota.msgRateOut; this.bandwidthIn -= quota.bandwidthIn; this.bandwidthOut -= quota.bandwidthOut; this.memor...
3.26
pulsar_ResourceQuota_add_rdh
/** * Add quota. * * @param quota * <code>ResourceQuota</code> to add */ public void add(ResourceQuota quota) {this.msgRateIn += quota.msgRateIn;this.msgRateOut += quota.msgRateOut; this.bandwidthIn += quota.bandwidthIn; this.bandwidthOut += quota.bandwidthOut; this.memory += quota.memory; }
3.26
pulsar_LedgerMetadataUtils_buildBaseManagedLedgerMetadata_rdh
/** * Build base metadata for every ManagedLedger. * * @param name * the name of the ledger * @return an immutable map which describes a ManagedLedger */ static Map<String, byte[]> buildBaseManagedLedgerMetadata(String name) { return Map.of(METADATA_PROPERTY_APPLICATION, METADATA_PROPERTY_APPLICATION_PULSAR, M...
3.26
pulsar_LedgerMetadataUtils_buildMetadataForSchema_rdh
/** * Build additional metadata for a Schema. * * @param schemaId * id of the schema * @return an immutable map which describes the schema */ public static Map<String, byte[]> buildMetadataForSchema(String schemaId) { return Map.of(METADATA_PROPERTY_APPLICATION, METADATA_PROPERTY_APPLICATION_PULSAR, METADATA_PR...
3.26
pulsar_LedgerMetadataUtils_buildMetadataForDelayedIndexBucket_rdh
/** * Build additional metadata for a delayed message index bucket. * * @param bucketKey * key of the delayed message bucket * @param topicName * name of the topic * @param cursorName * name of the cursor * @return an immutable map which describes the schema */ public static Map<String, byte[]> buildMet...
3.26
pulsar_LedgerMetadataUtils_buildAdditionalMetadataForCursor_rdh
/** * Build additional metadata for a Cursor. * * @param name * the name of the cursor * @return an immutable map which describes the cursor * @see #buildBaseManagedLedgerMetadata(java.lang.String) */ static Map<String, byte[]> buildAdditionalMetadataForCursor(String name) { return Map.of(METADATA_PROPERTY_C...
3.26
pulsar_LedgerMetadataUtils_buildMetadataForCompactedLedger_rdh
/** * Build additional metadata for a CompactedLedger. * * @param compactedTopic * reference to the compacted topic. * @param compactedToMessageId * last mesasgeId. * @return an immutable map which describes the compacted ledger */ public static Map<String, byte[]> buildMetadataForCompactedLedger(String com...
3.26
pulsar_OverloadShedder_findBundlesForUnloading_rdh
/** * Attempt to shed some bundles off every broker which is overloaded. * * @param loadData * The load data to used to make the unloading decision. * @param conf * The service configuration. * @return A map from bundles to unload to the brokers on which they are loaded. */ @Override public Multimap<String,...
3.26
pulsar_LinuxBrokerHostUsageImpl_getTotalCpuUsageForEntireHost_rdh
/** * Reads first line of /proc/stat to get total cpu usage. * * <pre> * cpu user nice system idle iowait irq softirq steal guest guest_nice * cpu 317808 128 58637 2503692 7634 0 13472 0 0 0 * </pre> * * Line is split in "words", filtering the first. The sum of all numbers give th...
3.26
pulsar_SchemaReader_setSchemaInfoProvider_rdh
/** * Set schema info provider, this method support multi version reader. * * @param schemaInfoProvider * the stream of message */ default void setSchemaInfoProvider(SchemaInfoProvider schemaInfoProvider) { }
3.26
pulsar_SchemaReader_m0_rdh
/** * Returns the underling Schema if possible. * * @return the schema, or an empty Optional if it is not possible to access it */ default Optional<Object> m0() { return Optional.empty(); }
3.26
pulsar_SchemaReader_read_rdh
/** * serialize bytes convert pojo. * * @param inputStream * the stream of message * @param schemaVersion * the schema version of message * @return the serialized object */ default T read(InputStream inputStream, byte[] schemaVersion) { return read(inputStream); }
3.26
pulsar_PulsarClient_create_rdh
/** * Create a new PulsarClient object. * * @param serviceUrl * the url of the Pulsar endpoint to be used * @param conf * the client configuration * @return a new pulsar client object * @throws PulsarClientException.InvalidServiceURL * if the serviceUrl is invalid * @deprecated use {@link #builder()} to...
3.26
pulsar_ResourceUsage_compareTo_rdh
/** * this may be wrong since we are comparing available and not the usage. * * @param o * @return */ public int compareTo(ResourceUsage o) { double required = o.limit - o.usage; double available = limit - usage; return Double.compare(available, required); }
3.26
pulsar_AuthenticationProviderSasl_authRoleFromHttpRequest_rdh
/** * Returns null if authentication has not completed. * Return auth role if authentication has completed, and httpRequest's role token contains the authRole */ public String authRoleFromHttpRequest(HttpServletRequest httpRequest) throws AuthenticationException {String tokenStr = httpRequest.getHeader(SASL_AUTH_ROL...
3.26
pulsar_AuthenticationProviderSasl_authenticateHttpRequest_rdh
/** * Passed in request, set response, according to request. * and return whether we should do following chain.doFilter or not. */ @Override public boolean authenticateHttpRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { AuthenticationState v14 = ...
3.26
pulsar_AuthenticationProviderSasl_getAuthState_rdh
// return authState if it is in cache. private AuthenticationState getAuthState(HttpServletRequest request) { String id = request.getHeader(SASL_STATE_SERVER); if (id == null) { return null; } try { return authStates.getIfPresent(Long.parseLong(id)); } catch (NumberFormatException e)...
3.26
pulsar_PulsarLedgerUnderreplicationManager_listLedgersToRereplicate_rdh
/** * Get a list of all the underreplicated ledgers which have been * marked for rereplication, filtered by the predicate on the replicas list. * * <p>Replicas list of an underreplicated ledger is the list of the bookies which are part of * th...
3.26
pulsar_PulsarLedgerUnderreplicationManager_isLedgerBeingReplicated_rdh
/** * Check whether the ledger is being replicated by any bookie. */ @Override public boolean isLedgerBeingReplicated(long ledgerId) throws ReplicationException { try { return store.exists(getUrLedgerLockPath(f0, ledgerId)).get(BLOCKING_CALL_TIMEOUT, MILLISECONDS); } catch (Exception e) { thr...
3.26
pulsar_Runnables_catchingAndLoggingThrowables_rdh
/** * Wraps a Runnable so that throwables are caught and logged when a Runnable is run. * * The main usecase for this method is to be used in * {@link java.util.concurrent.ScheduledExecutorService#scheduleAtFixedRate(Runnable, long, long, TimeUnit)} * calls to ensure that the scheduled task doesn't get cancelled a...
3.26
pulsar_KerberosName_toString_rdh
/** * Put the name back together from the parts. */ @Override public String toString() { StringBuilder result = new StringBuilder(); result.append(serviceName); if (hostName != null) { result.append('/'); result.append(hostName); } if (realm != null) { result.append('@')...
3.26
pulsar_KerberosName_getRealm_rdh
/** * Get the realm of the name. * * @return the realm of the name, may be null */ public String getRealm() { return realm; }
3.26
pulsar_KerberosName_getServiceName_rdh
/** * Get the first component of the name. * * @return the first section of the Kerberos principal name */ public String getServiceName() { return serviceName; }
3.26
pulsar_KerberosName_m0_rdh
/** * Get the configured default realm. * * @return the default realm from the krb5.conf */ public String m0() { return defaultRealm;}
3.26
pulsar_KerberosName_getShortName_rdh
/** * Get the translation of the principal name into an operating system * user name. * * @return the short name * @throws IOException */ public String getShortName() throws IOException { String[] v19; if (hostName == null) { // if it is already simple, just return it if (realm == null) { ...
3.26
pulsar_KerberosName_replaceParameters_rdh
/** * Replace the numbered parameters of the form $n where n is from 1 to * the length of params. Normal text is copied directly and $n is replaced * by the corresponding parameter. * * @param format * the string to replace parameters again * @param params * the list of parameters * @return the generated s...
3.26
pulsar_KerberosName_replaceSubstitution_rdh
/** * Replace the matches of the from pattern in the base string with the value * of the to string. * * @param base * the string to transform * @param from * the pattern to look for in the base string * @param to * the string to replace matches of the pattern with * @param repeat * whether the substi...
3.26
pulsar_KerberosName_apply_rdh
/** * Try to apply this rule to the given name represented as a parameter * array. * * @param params * first element is the realm, second and later elements are * are the components of the name "a/b@FOO" -> {"FOO", "a", "b"} * @return the short name if this rule applies or null * @throws IOException * th...
3.26
pulsar_KerberosName_getHostName_rdh
/** * Get the second component of the name. * * @return the second section of the Kerberos principal name, and may be null */public String getHostName() { return hostName; }
3.26
pulsar_KerberosName_setConfiguration_rdh
/** * Set the static configuration to get the rules. * * @throws IOException */ public static void setConfiguration() throws IOException { String ruleString = System.getProperty("zookeeper.security.auth_to_local", "DEFAULT"); rules = m1(ruleString); }
3.26
pulsar_ThreadLeakDetectorListener_extractRunnableTarget_rdh
// use reflection to extract the Runnable target from a thread so that we can detect threads created by // Testcontainers based on the Runnable's class name. private static Runnable extractRunnableTarget(Thread thread) { if (THREAD_TARGET_FIELD == null) { return null; } Runnable target = null; t...
3.26
pulsar_ContextImpl_tryGetConsumer_rdh
// returns null if consumer not found private Consumer<?> tryGetConsumer(String topic, int partition) { if (partition == 0) { // maybe a non-partitioned topic Consumer<?> consumer = topicConsumers.get(TopicName.get(topic)); if (consumer != null) { return consumer; } ...
3.26
pulsar_AbstractMetrics_populateDimensionMap_rdh
/** * Helper to manage populating topics map. * * @param ledgersByDimensionMap * @param metrics * @param ledger */ protected void populateDimensionMap(Map<Metrics, List<ManagedLedgerImpl>> ledgersByDimensionMap, Metrics metrics, ManagedLedgerImpl l...
3.26
pulsar_AbstractMetrics_getManagedLedgerCacheStats_rdh
/** * Returns the managed ledger cache statistics from ML factory. * * @return */ protected ManagedLedgerFactoryMXBean getManagedLedgerCacheStats() { return ((ManagedLedgerFactoryImpl) (f0.getManagedLedgerFactory())).getCacheStats(); }
3.26
pulsar_AbstractMetrics_getManagedLedgers_rdh
/** * Returns managed ledgers map from ML factory. * * @return */ protected Map<String, ManagedLedgerImpl> getManagedLedgers() { return ((ManagedLedgerFactoryImpl) (f0.getManagedLedgerFactory())).getManagedLedgers(); }
3.26
pulsar_AbstractMetrics_createMetrics_rdh
/** * Creates a metrics with empty immutable dimension. * <p> * Use this for metrics that doesn't need any dimension - i.e global metrics * * @return */ protected Metrics createMetrics() { return createMetrics(new HashMap<String, String>()); }
3.26
pulsar_AbstractMetrics_createMetricsByDimension_rdh
/** * Creates a dimension key for replication metrics. * * @param namespace * @param fromClusterName * @param toClusterName * @return */ protected Metrics createMetricsByDimension(String namespace, String fromClusterName, String toClusterName) { Map<String, String> dimensionMap = new HashMap<>(); dimens...
3.26
pulsar_PulsarRegistrationClient_updatedBookies_rdh
/** * This method will receive metadata store notifications and then update the * local cache in background sequentially. */ private void updatedBookies(Notification n) { // make the notification callback run sequential in background. final String path = n.getPath(); if ((...
3.26
pulsar_PulsarRegistrationClient_getBookiesThenFreshCache_rdh
/** * * @throws IllegalArgumentException * if parameter path is null or empty. */ private CompletableFuture<Versioned<Set<BookieId>>> getBookiesThenFreshCache(String path) { if ((path == null) || path.isEmpty()) { return failedFuture(new IllegalArgumentException("parameter [path] can not be null or em...
3.26
pulsar_Message_getReaderSchema_rdh
/** * Get the schema associated to the message. * Please note that this schema is usually equal to the Schema you passed * during the construction of the Consumer or the Reader. * But if you are consuming the topic using the GenericObject interface * this method will return the schema associated with the message. ...
3.26
pulsar_TieredStorageConfiguration_getConfigProperty_rdh
/** * Used to find a specific configuration property other than * one of the predefined ones. This allows for any number of * provider specific, or new properties to added in the future. * * @param propertyName * @return */ public String getConfigProperty(String propertyName) { return configProperties.get(proper...
3.26
pulsar_ProxyExtensionsUtils_searchForExtensions_rdh
/** * Search and load the available extensions. * * @param extensionsDirectory * the directory where all the extensions are stored * @return a collection of extensions * @throws IOException * when fail to load the available extensions from the provided directory. */ public static ExtensionsDefinitions searc...
3.26
pulsar_ProxyExtensionsUtils_getProxyExtensionDefinition_rdh
/** * Retrieve the extension definition from the provided handler nar package. * * @param narPath * the path to the extension NAR package * @return the extension definition * @throws IOException * when fail to load the extension or get the definition */ public static ProxyExtensionDefinition getProxyExtensi...
3.26
pulsar_ProxyExtensionsUtils_load_rdh
/** * Load the extension according to the handler definition. * * @param metadata * the extension definition. * @return */ static ProxyExtensionWithClassLoader load(ProxyExtensionMetadata metadata, String narExtractionDirectory) throws IOException { final File narFile = metadata.getArchivePath().toAbsolute...
3.26
pulsar_TopicSchema_getSchemaTypeOrDefault_rdh
/** * If the topic is already created, we should be able to fetch the schema type (avro, json, ...). */ private SchemaType getSchemaTypeOrDefault(String topic, Class<?> clazz) { if (GenericObject.class.isAssignableFrom(clazz)) { return SchemaType.AUTO_CONSUME; } else if ((byt...
3.26
pulsar_WorkerStatsApiV2Resource_clientAppId_rdh
/** * * @deprecated use {@link AuthenticationParameters} instead */@Deprecated public String clientAppId() { return httpRequest != null ? ((String) (httpRequest.getAttribute(AuthenticationFilter.AuthenticatedRoleAttributeName))) : null; }
3.26
pulsar_FileUtils_deleteFile_rdh
/** * Deletes the given file. If the given file exists but could not be deleted * this will be printed as a warning to the given logger * * @param file * to delete * @param logger * to notify * @param attempts * indicates how many times an attempt to delete should be * made * @return true if given fi...
3.26
pulsar_FileUtils_deleteFilesInDirectory_rdh
/** * Deletes all files (not directories) in the given directory (recursive) * that match the given filename filter. If any file cannot be deleted then * this is printed at warn to the given logger. * * @param directory * to delete contents of * @param filter * if null then no filter is used * @param logge...
3.26
pulsar_AutoConsumeSchema_fetchSchemaIfNeeded_rdh
/** * It may happen that the schema is not loaded but we need it, for instance in order to call getSchemaInfo() * We cannot call this method in getSchemaInfo, because getSchemaInfo is called in many * places and we will introduce lots of deadlocks. */ public void fetchSchemaIfNeeded(SchemaVe...
3.26
pulsar_PositionAckSetUtil_compareToWithAckSet_rdh
// This method is compare two position which position is bigger than another one. // When the ledgerId and entryId in this position is same to another one and two position all have ack set, it will // compare the ack set next bit index is bigger than another one. public static int compareToWithAckSet(PositionImpl curr...
3.26
pulsar_PositionAckSetUtil_andAckSet_rdh
// This method is do `and` operation for ack set public static long[] andAckSet(long[] firstAckSet, long[] secondAckSet) { BitSetRecyclable thisAckSet = BitSetRecyclable.valueOf(firstAckSet); BitSetRecyclable otherAckSet = BitSetRecyclable.valueOf(secondAckSet); thisAckSet.and(otherAckSet); long[] ackS...
3.26
pulsar_PositionAckSetUtil_m0_rdh
// This method is to compare two ack set whether overlap or not public static boolean m0(long[] currentAckSet, long[] otherAckSet) { if ((currentAckSet == null) || (otherAckSet == null)) { return false; } BitSetRecyclable currentBitSet = BitSetRecyclable.valueOf(currentAckSet); BitSetRecy...
3.26
pulsar_InMemoryDelayedDeliveryTracker_hasMessageAvailable_rdh
/** * Return true if there's at least a message that is scheduled to be delivered already. */ @Override public boolean hasMessageAvailable() { boolean hasMessageAvailable = (!priorityQueue.isEmpty()) && (priorityQueue.peekN1() <= getCutoffTime()); if (!hasMessageAvailable) { updateTimer(); } ...
3.26
pulsar_InMemoryDelayedDeliveryTracker_m0_rdh
/** * Get a set of position of messages that have already reached. */ @Override public NavigableSet<PositionImpl> m0(int maxMessages) { int n = maxMessages; NavigableSet<PositionImpl> positions = new TreeSet<>(); long cutoffTime = getCutoffTime(); while ((n > 0) && (!priorityQueue.isEmpty())) { ...
3.26
pulsar_InMemoryDelayedDeliveryTracker_checkAndUpdateHighest_rdh
/** * Check that new delivery time comes after the current highest, or at * least within a single tick time interval of 1 second. */ private void checkAndUpdateHighest(long deliverAt) { if (deliverAt < (f0 - tickTimeMillis)) { messagesHaveFixedDelay = false; }f0 = Math.max(f0, deliverAt); }
3.26
pulsar_RestException_getExceptionData_rdh
/** * Exception used to provide better error messages to clients of the REST API. */@SuppressWarnings("serial")public class RestException extends WebApplicationException { static String getExceptionData(Throwable t) { StringWriter writer = new StringWriter(); writer.append("\n --- An unexpected ...
3.26
pulsar_BytesSchemaVersion_toString_rdh
/** * Write a printable representation of a byte array. Non-printable * characters are hex escaped in the format \\x%02X, eg: * \x00 \x05 etc. * * <p>This function is brought from org.apache.hadoop.hbase.util.Bytes * ...
3.26
pulsar_BytesSchemaVersion_get_rdh
/** * Get the data from the Bytes. * * @return The underlying byte array */ public byte[] get() { return this.bytes; }
3.26
pulsar_BytesSchemaVersion_hashCode_rdh
/** * The hashcode is cached except for the case where it is computed as 0, in which * case we compute the hashcode on every call. * * @return the hashcode */ @Override public int hashCode() { if (hashCode == 0) { hashCode = Arrays.hashCode(bytes); } return hashCode; }
3.26
pulsar_AuthenticationUtil_create_rdh
/** * Create an instance of the Authentication-Plugin. * * @param authPluginClassName * name of the Authentication-Plugin you want to use * @param authParams * map which represents parameters for the Authentication-Plugin * @return instance of the Authentication-Plugin * @throws UnsupportedAuthenticationExc...
3.26
pulsar_Record_getPartitionId_rdh
/** * Retrieves the partition information if any of the record. * * @return The partition id where the */ default Optional<String> getPartitionId() { return Optional.empty(); }
3.26
pulsar_Record_getPartitionIndex_rdh
/** * Retrieves the partition index if any of the record. * * @return The partition index */ default Optional<Integer> getPartitionIndex() { return Optional.empty(); }
3.26
pulsar_Record_getEventTime_rdh
/** * Retrieves the event time of the record from the source. * * @return millis since epoch */ default Optional<Long> getEventTime() { return Optional.empty(); }
3.26
pulsar_Record_getRecordSequence_rdh
/** * Retrieves the sequence of the record from a source partition. * * @return Sequence Id associated with the record */default Optional<Long> getRecordSequence() { return Optional.empty(); }
3.26
pulsar_Record_getTopicName_rdh
/** * If the record originated from a topic, report the topic name. */ default Optional<String> getTopicName() {return Optional.empty(); }
3.26
pulsar_KeyValueSchemaInfo_encodeKeyValueSchemaInfo_rdh
/** * Encode key & value into schema into a KeyValue schema. * * @param schemaName * the final schema name * @param keySchemaInfo * the key schema info * @param valueSchemaInfo * the value schema info * @param keyValueEncodingType * the encoding type to encode and decode key value pair * @return the ...
3.26
pulsar_KeyValueSchemaInfo_decodeKeyValueSchemaInfo_rdh
/** * Decode the key/value schema info to get key schema info and value schema info. * * @param schemaInfo * key/value schema info. * @return the pair of key schema info and value schema info */ public static KeyValue<SchemaInfo, SchemaInfo> decode...
3.26
pulsar_KeyValueSchemaInfo_decodeKeyValueEncodingType_rdh
/** * Decode the kv encoding type from the schema info. * * @param schemaInfo * the schema info * @return the kv encoding type */ public static KeyValueEncodingType decodeKeyValueEncodingType(SchemaInfo schemaInfo) { checkArgument(SchemaType.KEY_VALUE == schemaInfo.getType(), "Not a KeyValue schema"); S...
3.26
pulsar_ShadowReplicator_getShadowReplicatorName_rdh
/** * Cursor name fot this shadow replicator. * * @param replicatorPrefix * @param shadowTopic * @return */ public static String getShadowReplicatorName(String replicatorPrefix, String shadowTopic) { return (replicatorPrefix + "-") + Codec.encode(shadowTopic); }
3.26
pulsar_WindowFunction_process_rdh
/** * Process the input. * * @return the output */ T process(Collection<Record<X>> input, WindowContext context) throws Exception { }
3.26
pulsar_SafeCollectionUtils_longArrayToList_rdh
/** * Safe collection utils. */public class SafeCollectionUtils { public static List<Long> longArrayToList(long[] array) { return (array == null) || (array.length == 0) ? Collections.emptyList() : Arrays.stream(array).boxed().collect(Collectors.toList()); }
3.26
pulsar_SchemaDefinitionImpl_getAlwaysAllowNull_rdh
/** * get schema whether always allow null or not. * * @return schema always null or not */ public boolean getAlwaysAllowNull() { return alwaysAllowNull; }
3.26
pulsar_SchemaDefinitionImpl_getPojo_rdh
/** * Get pojo schema definition. * * @return pojo class */ @Overridepublic Class<T> getPojo() { return pojo; }
3.26
pulsar_SchemaDefinitionImpl_getProperties_rdh
/** * Get schema class. * * @return schema class */public Map<String, String> getProperties() { return Collections.unmodifiableMap(properties); }
3.26
pulsar_PublicSuffixMatcher_matches_rdh
/** * Tests whether the given domain matches any of entry from the public suffix list. * * @param domain * @param expectedType * expected domain type or {@code null} if any. * @return {@code true} if the given domain matches any of the public suffixes. * @since 4.5 */ public boolean matches(final String domai...
3.26
pulsar_PublicSuffixMatcher_getDomainRoot_rdh
/** * Returns registrable part of the domain for the given domain name or {@code null} * if given domain represents a public suffix. * * @param domain * @param expectedType * expected domain type or {@code null} if any. * @return domain root * @since 4.5 */ public ...
3.26
pulsar_RangeCache_put_rdh
/** * Insert. * * @param key * @param value * ref counted value with at least 1 ref to pass on the cache * @return whether the entry was inserted in the cache */ public boolean put(Key key, Value value) { // retain value so that it's not released before we put it in the cache and calculate the weight v...
3.26
pulsar_RangeCache_evictLeastAccessedEntries_rdh
/** * * @param minSize * @return a pair containing the number of entries evicted and their total size */ public Pair<Integer, Long> evictLeastAccessedEntries(long minSize) { checkArgument(minSize > 0); long removedSize = 0; int removedEntries = 0; while (removedSize < minSize) { Map.Entry...
3.26
pulsar_RangeCache_evictLEntriesBeforeTimestamp_rdh
/** * * @param maxTimestamp * the max timestamp of the entries to be evicted * @return the tota */ public Pair<Integer, Long> evictLEntriesBeforeTimestamp(long maxTimestamp) { long removedSize = 0; int removedCount = 0; while (true) { Map.Entry<Key, Value> entry = entries.firstEntry(); ...
3.26
pulsar_RangeCache_getRange_rdh
/** * * @param first * the first key in the range * @param last * the last key in the range (inclusive) * @return a collections of the value found in cache */public Collection<Value> getRange(Key first, Key last) { List<Value> values = new ArrayList();// Return the values of the entries found in cache ...
3.26
pulsar_RangeCache_removeRange_rdh
/** * * @param first * @param last * @param lastInclusive * @return an pair of ints, containing the number of removed entries and the total size */ public Pair<Integer, Long> removeRange(Key first, Key last, boolean lastInclusive) { Map<Key, Value> subMap = entries.subMap(first, true, last, lastInclusive)...
3.26
pulsar_OffloadIndexBlockBuilder_create_rdh
/** * create an OffloadIndexBlockBuilder. */ static OffloadIndexBlockBuilder create() { return new OffloadIndexBlockV2BuilderImpl(); }
3.26
pulsar_ShutdownUtil_triggerImmediateForcefulShutdown_rdh
/** * Triggers an immediate forceful shutdown of the current process using 1 as the status code. * * @see Runtime#halt(int) */ public static void triggerImmediateForcefulShutdown() { triggerImmediateForcefulShutdown(1); }
3.26
pulsar_NettyFutureUtil_toCompletableFuture_rdh
/** * Converts a Netty {@link Future} to {@link CompletableFuture}. * * @param future * Netty future * @param <V> * value type * @return converted future instance */ public static <V> CompletableFuture<V> toCompletableFuture(Future<V> future) { Objects.require...
3.26
pulsar_NettyFutureUtil_toCompletableFutureVoid_rdh
/** * Converts a Netty {@link Future} to {@link CompletableFuture} with Void type. * * @param future * Netty future * @return converted future instance */ public static CompletableFuture<Void> toCompletableFutureVoid(Future<?> future) { Objects.requireNonNull(future, "future cannot be null"); CompletableFuture<...
3.26
pulsar_ProtocolHandlerUtils_getProtocolHandlerDefinition_rdh
/** * Retrieve the protocol handler definition from the provided handler nar package. * * @param narPath * the path to the protocol handler NAR package * @return the protocol handler definition * @throws IOException * when fail to load the protocol handler or get the definition */ public static ProtocolHand...
3.26
pulsar_ProtocolHandlerUtils_searchForHandlers_rdh
/** * Search and load the available protocol handlers. * * @param handlersDirectory * the directory where all the protocol handlers are stored * @return a collection of protocol handlers * @throws IOException * when fail to load the available protocol handlers from the provided directory. */ public static P...
3.26
pulsar_ProtocolHandlerUtils_load_rdh
/** * Load the protocol handler according to the handler definition. * * @param metadata * the protocol handler definition. * @return */ static ProtocolHandlerWithClassLoader load(ProtocolHandlerMetadata metadata, String narExtractionDirectory) throws IOException { final File narFile = metadata.getArchivePa...
3.26