name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
pulsar_ConsumerConfiguration_setCryptoKeyReader_rdh
/** * Sets a {@link CryptoKeyReader}. * * @param cryptoKeyReader * CryptoKeyReader object */ public ConsumerConfiguration setCryptoKeyReader(CryptoKeyReader cryptoKeyReader) { Objects.requireNonNull(cryptoKeyReader); conf.setCryptoKeyReader(cryptoKeyReader); return this; }
3.26
pulsar_ConsumerConfiguration_setConsumerEventListener_rdh
/** * Sets a {@link ConsumerEventListener} for the consumer. * * <p> * The consumer group listener is used for receiving consumer state change in a consumer group for failover * subscription. Application can then react to the consumer state changes. * * <p> * This change is experimental. It is subject to change...
3.26
pulsar_ConsumerConfiguration_getMaxTotalReceiverQueueSizeAcrossPartitions_rdh
/** * * @return the configured max total receiver queue size across partitions */ public int getMaxTotalReceiverQueueSizeAcrossPartitions() { return conf.getMaxTotalReceiverQueueSizeAcrossPartitions(); }
3.26
pulsar_ConsumerConfiguration_getCryptoKeyReader_rdh
/** * * @return the CryptoKeyReader */ public CryptoKeyReader getCryptoKeyReader() { return conf.getCryptoKeyReader(); }
3.26
pulsar_ConsumerConfiguration_getMessageListener_rdh
/** * * @return the configured {@link MessageListener} for the consumer */public MessageListener<byte[]> getMessageListener() { return messageListener; }
3.26
pulsar_ConsumerConfiguration_setProperty_rdh
/** * Set a name/value property with this consumer. * * @param key * @param value * @return */ public ConsumerConfiguration setProperty(String key, String value) { checkArgument(key != null); checkArgument(value != null); conf.getProperties().put(key, value); return this; }
3.26
pulsar_ConsumerConfiguration_getReceiverQueueSize_rdh
/** * * @return the configure receiver queue size value */ public int getReceiverQueueSize() { return conf.getReceiverQueueSize(); }
3.26
pulsar_ConsumerConfiguration_getAckTimeoutRedeliveryBackoff_rdh
/** * * @return the configured {@link RedeliveryBackoff} for the consumer */ public RedeliveryBackoff getAckTimeoutRedeliveryBackoff() { return conf.getAckTimeoutRedeliveryBackoff(); }
3.26
pulsar_ConsumerConfiguration_getSubscriptionInitialPosition_rdh
/** * * @return the configured {@link subscriptionInitialPosition} for the consumer */ public SubscriptionInitialPosition getSubscriptionInitialPosition() {return conf.getSubscriptionInitialPosition(); }
3.26
pulsar_ConsumerConfiguration_m0_rdh
/** * * @return this configured {@link ConsumerEventListener} for the consumer. * @see #setConsumerEventListener(ConsumerEventListener) * @since 2.0 */ public ConsumerEventListener m0() { return conf.getConsumerEventListener(); }
3.26
pulsar_ConsumerConfiguration_m1_rdh
/** * If enabled, the consumer will read messages from the compacted topic rather than reading the full message backlog * of the topic. This means that, if the topic has been compacted, the consumer will only see the latest value for * each key in the topic, up until the point in the topic message backlog that has b...
3.26
pulsar_ConsumerConfiguration_getCryptoFailureAction_rdh
/** * * @return The ConsumerCryptoFailureAction */ public ConsumerCryptoFailureAction getCryptoFailureAction() { return conf.getCryptoFailureAction(); }
3.26
pulsar_ConsumerConfiguration_setConsumerName_rdh
/** * Set the consumer name. * * @param consumerName */ public ConsumerConfiguration setConsumerName(String consumerName) { checkArgument((consumerName != null) && (!consumerName.equals(""))); conf.setConsumerName(consumerName); return this; }
3.26
pulsar_ConsumerConfiguration_setNegativeAckRedeliveryBackoff_rdh
/** * * @param negativeAckRedeliveryBackoff * the negative ack redelivery backoff policy. * Default value is: MultiplierRedeliveryBackoff * @return the {@link ConsumerConfiguration} */ public ConsumerConfiguration setNegativeAckRedeliveryBackoff(RedeliveryBackoff negativeAckRedeliveryBackoff) { conf.setNe...
3.26
pulsar_ConsumerConfiguration_setReceiverQueueSize_rdh
/** * Sets the size of the consumer receive queue. * <p> * The consumer receive queue controls how many messages can be accumulated by the {@link Consumer} before the * application calls {@link Consumer#receive()}. Using a higher value could potentially increase the consumer * throughput at the expense of bigger m...
3.26
pulsar_ConsumerConfiguration_setSubscriptionInitialPosition_rdh
/** * * @param subscriptionInitialPosition * the initial position at which to set * set cursor when subscribing to the topic first time * Default is {@value InitialPosition.Latest} */ public ConsumerConfiguration setSubscriptionInitialPosition(SubscriptionInitialPosition subscriptionInitialPosition) { ...
3.26
pulsar_ConsumerConfiguration_setAckTimeoutRedeliveryBackoff_rdh
/** * * @param ackTimeoutRedeliveryBackoff * redelivery backoff policy for ack timeout. * Default value is: MultiplierRedeliveryBackoff * @return the {@link ConsumerConfiguration} */ public ConsumerConfiguration setAckTimeoutRedeliveryBackoff(RedeliveryBackoff ackTimeoutRedeliveryBackoff) { conf.setAckTim...
3.26
pulsar_ConsumerConfiguration_getConsumerName_rdh
/** * * @return the consumer name */ public String getConsumerName() { return conf.getConsumerName(); }
3.26
pulsar_MessageAcknowledger_acknowledgeAsync_rdh
/** * The asynchronous version of {@link #acknowledge(MessageId)}. */default CompletableFuture<Void> acknowledgeAsync(MessageId messageId) { return acknowledgeAsync(messageId, null); }
3.26
pulsar_TransactionMetadataStoreProvider_newProvider_rdh
/** * Construct a provider from the provided class. * * @param providerClassName * the provider class name. * @return an instance of transaction metadata store provider. */ static TransactionMetadataStoreProvider newProvider(String providerClassName) throws IOException { Class<?> providerClass; try { ...
3.26
pulsar_AuthenticationFactory_TLS_rdh
// CHECKSTYLE.OFF: MethodName /** * Create an authentication provider for TLS based authentication. * * @param certFilePath * the path to the TLS client public key * @param keyFilePath * the path to the TLS client private key * @return the Authentication object initialized with the TLS credentials */ public...
3.26
pulsar_AuthenticationFactory_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_AuthenticationFactory_token_rdh
/** * Create an authentication provider for token based authentication. * * @param tokenSupplier * a supplier of the client auth token * @return the Authentication object initialized with the token credentials */ public static Authentication token(Supplier<String> tokenSupplier) { return DefaultImplementation...
3.26
pulsar_ProxyService_shutdownEventLoop_rdh
// Shutdown the event loop. // If graceful is true, will wait for the current requests to be completed, up to 15 seconds. // Graceful shutdown can be disabled by setting the gracefulShutdown flag to false. This is used in tests // to speed up the shutdown process. private Future<?> shutdownEventLoop(EventLoopGroup even...
3.26
pulsar_KubernetesSecretsProviderConfigurator_configureKubernetesRuntimeSecretsProvider_rdh
// Kubernetes secrets can be exposed as volume mounts or as // environment variables in the pods. We are currently using the // environment variables way. Essentially the secretName/secretPath // is attached as secretRef to the environment variables // of a pod and kubernetes magically makes the secret pointed to by th...
3.26
pulsar_KubernetesSecretsProviderConfigurator_doAdmissionChecks_rdh
// The secret object should be of type Map<String, String> and it should contain "id" and "key" @Override public void doAdmissionChecks(AppsV1Api appsV1Api, CoreV1Api coreV1Api, String jobNamespace, String jobName, Function.FunctionDetails functionDetails) { if (!StringUtils.isEmpty(functionDetails.getSecretsMap())...
3.26
pulsar_BrokerLoadData_updateSystemResourceUsage_rdh
// Update resource usage given each individual usage. private void updateSystemResourceUsage(final ResourceUsage cpu, final ResourceUsage memory, final ResourceUsage directMemory, final ResourceUsage bandwidthIn, final ResourceUsage bandwidthOut) {this.cpu = cpu; this.memory = memory; this.directMemory = direct...
3.26
pulsar_BrokerLoadData_update_rdh
/** * Using another BrokerLoadData, update this. * * @param other * BrokerLoadData to update from. */ public void update(final BrokerLoadData other) { updateSystemResourceUsage(other.cpu, other.memory, other.directMemory, other.bandwidthIn, other.f0); msgThroughputIn = other.msgThroughputIn; msgThrou...
3.26
pulsar_TopKBundles_update_rdh
/** * Update the topK bundles from the input bundleStats. * * @param bundleStats * bundle stats. * @param topk * top k bundle stats to select. */ public void update(Map<String, NamespaceBundleStats> bundleStats, int topk) { arr.clear(); try { var isLoadBalancerSheddingBundlesWithPoliciesEnabl...
3.26
pulsar_TxnMetaImpl_addProducedPartitions_rdh
/** * Add the list partitions that the transaction produces to. * * @param partitions * the list of partitions that the txn produces to * @return the transaction itself. * @throws InvalidTxnStatusException */ @Override public synchronized TxnMetaImpl addProducedPartitions(List<String> partitions) throws Inval...
3.26
pulsar_TxnMetaImpl_addAckedPartitions_rdh
/** * Remove the list partitions that the transaction acknowledges to. * * @param partitions * the list of partitions that the txn acknowledges to * @return the transaction itself. * @throws InvalidTxnStatusException */ @Override public synchronized TxnMetaImpl addAckedPartitions(List<TransactionSubscription> ...
3.26
pulsar_TxnMetaImpl_checkTxnStatus_rdh
/** * Check if the transaction is in an expected status. * * @param expectedStatus */ private synchronized void checkTxnStatus(TxnStatus expectedStatus) throws InvalidTxnStatusException { if (this.txnStatus != expectedStatus) { throw new InvalidTxnStatusException(txnID, expectedStatus, txnStatus); }...
3.26
pulsar_TxnMetaImpl_updateTxnStatus_rdh
/** * Update the transaction stats from the <tt>newStatus</tt> only when * the current status is the expected <tt>expectedStatus</tt>. * * @param newStatus * the new transaction status * @param expectedStatus * the expected transaction status * @return the transaction itself. * @throws InvalidTxnStatusExce...
3.26
pulsar_TxnMetaImpl_status_rdh
/** * Return the current status of the transaction. * * @return current status of the transaction. */ @Override public synchronized TxnStatus status() { return txnStatus; }
3.26
pulsar_AuthenticationDataCommand_hasDataFromCommand_rdh
/* Command */ @Override public boolean hasDataFromCommand() { return authData != null; }
3.26
pulsar_AuthenticationDataCommand_hasDataFromTls_rdh
/* TLS */ @Override public boolean hasDataFromTls() { return sslSession != null; }
3.26
pulsar_AuthenticationDataCommand_hasDataFromPeer_rdh
/* Peer */ @Override public boolean hasDataFromPeer() { return remoteAddress != null; }
3.26
pulsar_DLInputStream_read_rdh
/** * When reading the end of a stream, it will throw an EndOfStream exception. So we can use this to * check if we read to the end. * * @param outputStream * the data write to * @param readFuture * a future that wait to read complete * @param num * how many entrie...
3.26
pulsar_DLInputStream_readAsync_rdh
/** * Read data to output stream. * * @param outputStream * the data write to * @return */ CompletableFuture<DLInputStream> readAsync(OutputStream outputStream) { CompletableFuture<Void> outputFuture = new CompletableFuture<>(); read(outputStream, outputFuture, 10); return outputFuture.thenAppl...
3.26
pulsar_RecordSchemaBuilderImpl_splitName_rdh
/** * Split a full dotted-syntax name into a namespace and a single-component name. */ private static String[] splitName(String fullName) { String[] result = new String[2]; int indexLastDot = fullName.lastIndexOf('.'); if (indexLastDot >= 0) { result[0] = fullName.substring(0, indexLastDot); ...
3.26
pulsar_ClusterDataImpl_checkPropertiesIfPresent_rdh
/** * Check cluster data properties by rule, if some property is illegal, it will throw * {@link IllegalArgumentException}. * * @throws IllegalArgumentException * exist illegal property. */ public void checkPropertiesIfPresent() throws IllegalArgumentException { URIPreconditions.checkURIIfPresent(getServiceUrl(...
3.26
pulsar_Commands_peekAndCopyMessageMetadata_rdh
/** * Peek the message metadata from the buffer and return a deep copy of the metadata. * * If you want to hold multiple {@link MessageMetadata} instances from multiple buffers, you must call this method * rather than {@link Commands#peekMessageMetadata(ByteBuf, String, long)}, which returns a thread local referenc...
3.26
pulsar_Commands_readChecksum_rdh
/** * Read the checksum and advance the reader index in the buffer. * * <p>Note: This method assume the checksum presence was already verified before. */ public static int readChecksum(ByteBuf buffer) { buffer.skipBytes(2);// skip magic bytes return buffer.readInt(); }
3.26
pulsar_Commands_newTxn_rdh
// ---- transaction related ---- public static ByteBuf newTxn(long tcId, long requestId, long ttlSeconds) { BaseCommand cmd = localCmd(Type.NEW_TXN); cmd.setNewTxn().setTcId(tcId).setRequestId(requestId).setTxnTtlSeconds(ttlSeconds); return m5(cmd); }
3.26
pulsar_BaseResource_requestAsync_rdh
// do the authentication stage, and once authentication completed return a Builder public CompletableFuture<Builder> requestAsync(final WebTarget target) { CompletableFuture<Builder> builderFuture = new CompletableFuture<>(); CompletableFuture<Map<String, String>> authFuture = new CompletableFuture<>(); try...
3.26
pulsar_AdminResource_checkTopicExistsAsync_rdh
/** * Check the exists topics contains the given topic. * Since there are topic partitions and non-partitioned topics in Pulsar, must ensure both partitions * and non-partitioned topics are not duplicated. So, if compare with a partition name, we should compare * to the partitioned name of this partition. * * @pa...
3.26
pulsar_AdminResource_validateAdminAccessForTenant_rdh
// This is a stub method for Mockito @Override protected void validateAdminAccessForTenant(String property) { super.validateAdminAccessForTenant(property); }
3.26
pulsar_AdminResource_validatePoliciesReadOnlyAccess_rdh
/** * Checks whether the broker is allowed to do read-write operations based on the existence of a node in * configuration metadata-store. * * @throws WebApplicationException * if broker has a read only access if broker is not connected to the configuration metadata-store */ public void validatePoliciesReadOnl...
3.26
pulsar_AdminResource_domain_rdh
/** * Get the domain of the topic (whether it's persistent or non-persistent). */ protected String domain() { if (uri.getPath().startsWith("persistent/")) { return "persistent"; } else if (uri.getPath().startsWith("non-persistent/")) { return "non-persistent"; } else { throw ne...
3.26
pulsar_AdminResource_isRedirectException_rdh
/** * Check current exception whether is redirect exception. * * @param ex * The throwable. * @return Whether is redirect exception */ protected static boolean isRedirectException(Throwable ex) { Throwable realCause = FutureUtil.unwrapCompletionException(ex); return (realCause instanceof WebApplicationException...
3.26
pulsar_AdminResource_validateBundleOwnership_rdh
// This is a stub method for Mockito @Overrideprotected void validateBundleOwnership(String property, String cluster, String namespace, boolean authoritative, boolean readOnly, NamespaceBundle bundle) { super.validateBundleOwnership(property, cluster, namespace, authoritative, readOnly, bundle); }
3.26
pulsar_AwsCredentialProviderPlugin_getV2CredentialsProvider_rdh
/** * Returns a V2 credential provider for use with the v2 SDK. * * Defaults to an implementation that pulls credentials from a v1 provider */ default AwsCredentialsProvider getV2CredentialsProvider() { // make a small wrapper to forward requests to v1, this allows // for this interface to not "break" for i...
3.26
pulsar_BrokerInterceptorUtils_getBrokerInterceptorDefinition_rdh
/** * Retrieve the broker interceptor definition from the provided handler nar package. * * @param narPath * the path to the broker interceptor NAR package * @return the broker interceptor definition * @throws IOException * when fail to load the broker interceptor or get the definition */ public BrokerInter...
3.26
pulsar_BrokerInterceptorUtils_searchForInterceptors_rdh
/** * Search and load the available broker interceptors. * * @param interceptorsDirectory * the directory where all the broker interceptors are stored * @return a collection of broker interceptors * @throws IOException * when fail to load the available broker interceptors from the provided directory. */ pub...
3.26
pulsar_BrokerInterceptorUtils_load_rdh
/** * Load the broker interceptors according to the interceptor definition. * * @param metadata * the broker interceptors definition. */ BrokerInterceptorWithClassLoader load(BrokerInterceptorMetadata metadata, String narExtractionDirectory) throws IOException { final File narFile = metadata.getArchivePath...
3.26
pulsar_BlockAwareSegmentInputStreamImpl_calculateBlockSize_rdh
// Calculate the block size after uploaded `entryBytesAlreadyWritten` bytes public static int calculateBlockSize(int maxBlockSize, ReadHandle readHandle, long firstEntryToWrite, long entryBytesAlreadyWritten) { return ((int) (Math.min(maxBlockSize, ((((readHandle.getLastAddConfirmed() - firstEntryToWrite) + 1) * f...
3.26
pulsar_BlockAwareSegmentInputStreamImpl_readEntries_rdh
// read ledger entries. private int readEntries() throws IOException { checkState(bytesReadOffset >= DataBlockHeaderImpl.getDataStartOffset()); checkState(bytesReadOffset < blockSize); // once reach the end of entry buffer, read more, if there is more if (((bytesReadOffset ...
3.26
pulsar_PulsarFieldValueProviders_timeValueProvider_rdh
/** * FieldValueProvider for Time (Data, Timestamp etc.) with indicate Null instead of longValueProvider. */ public static FieldValueProvider timeValueProvider(long millis, boolean isNull) { return new FieldValueProvider() { @Override public long getLong() { return millis * T...
3.26
pulsar_TopicsImpl_validateTopic_rdh
/* returns topic name with encoded Local Name */ private TopicName validateTopic(String topic) { // Parsing will throw exception if name is not valid return TopicName.get(topic); }
3.26
pulsar_ProducerStats_getPartitionStats_rdh
/** * * @return stats for each partition if topic is partitioned topic */ default Map<String, ProducerStats> getPartitionStats() { return Collections.emptyMap(); }
3.26
pulsar_TxnBatchedPositionImpl_compareTo_rdh
/** * It's exactly the same as {@link PositionImpl},to make sure that when compare to the "markDeletePosition", it * looks like {@link PositionImpl}. {@link #batchSize} and {@link #batchIndex} should not be involved in calculate, * just like {@link PositionImpl#ackSet} is not involved in calculate. * Note: In {@lin...
3.26
pulsar_TxnBatchedPositionImpl_setAckSetByIndex_rdh
/** * Build the attribute ackSet to that {@link #batchIndex} is false and others is true. */ public void setAckSetByIndex() { if (batchSize == 1) { return; } BitSetRecyclable bitSetRecyclable = BitSetRecyclable.create(); bitSetRecyclable.set(0, batchSize, true); bitSetRecyclable.clear(batc...
3.26
pulsar_TxnBatchedPositionImpl_hashCode_rdh
/** * It's exactly the same as {@link PositionImpl},make sure that when {@link TxnBatchedPositionImpl} used as the key * of map same as {@link PositionImpl}. {@link #batchSize} and {@link #batchIndex} should not be involved in * calculate, just like {@link PositionImpl#ackSet} is not involved in calculate. * Note: ...
3.26
pulsar_TxnBatchedPositionImpl_equals_rdh
/** * It's exactly the same as {@link PositionImpl},make sure that when {@link TxnBatchedPositionImpl} used as the key * of map same as {@link PositionImpl}. {@link #batchSize} and {@link #batchIndex} should not be involved in * calculate, just like {@link PositionImpl#ackSet} is not involved in calculate. * Note: ...
3.26
pulsar_ConcurrentOpenHashSet_forEach_rdh
/** * Iterate over all the elements in the set and apply the provided function. * <p> * <b>Warning: Do Not Guarantee Thread-Safety.</b> * * @param processor * the function to apply to each element */ public void forEach(Consumer<? super V> processor) { for (int i = 0; i < sections.length; i++) { ...
3.26
pulsar_ConcurrentOpenHashSet_values_rdh
/** * * @return a new list of all values (makes a copy) */ public List<V> values() { List<V> values = new ArrayList<>(); forEach(value -> values.add(value)); return values; }
3.26
pulsar_ProducerResponse_getSchemaVersion_rdh
// Shadow the default getter generated by lombok. In broker, if the schema version is an empty byte array, it means // the topic doesn't have schema. public byte[] getSchemaVersion() { if ((schemaVersion != null) && (schemaVersion.length != 0)) { return schemaVersion; } else { return null; }...
3.26
pulsar_BlobStoreBackedInputStreamImpl_refillBufferIfNeeded_rdh
/** * Refill the buffered input if it is empty. * * @return true if there are bytes to read, false otherwise */ private boolean refillBufferIfNeeded() throws IOException { if (buffer.readableBytes() == 0) {if (cursor >= objectLen) { return false; } long startRange = cur...
3.26
pulsar_AvroRecordBuilderImpl_set_rdh
/** * Sets the value of a field. * * @param index * the field to set. * @param value * the value to set. * @return a reference to the RecordBuilder. */ protected GenericRecordBuilder set(int index, Object value) { if (value instanceof GenericRecord) { if (value instanceof GenericAvroRecord) { ...
3.26
pulsar_AvroRecordBuilderImpl_clear_rdh
/** * Clears the value of the given field. * * @param index * the index of the field to clear. * @return a reference to the RecordBuilder. */ protected GenericRecordBuilder clear(int index) { avroRecordBuilder.clear(genericSchema.getAvroSchema().getFields().get(index)); return this; }
3.26
pulsar_Context_getCurrentRecord_rdh
/** * Access the record associated with the current input value. * * @return the current record */ Record<?> getCurrentRecord() { }
3.26
pulsar_Context_newOutputRecordBuilder_rdh
/** * Creates a FunctionRecordBuilder initialized with values from this Context. * It can be used in Functions to prepare a Record to return with default values taken from the Context and the * input Record. * * @param schema * provide a way to convert between serialized data and domain objects * @param <X> *...
3.26
pulsar_EnumValuesDataProvider_toDataProviderArray_rdh
/* Converts all values of an Enum class to a TestNG DataProvider object array */ public static Object[][] toDataProviderArray(Class<? extends Enum<?>> enumClass) { Enum<?>[] enumValues = enumClass.getEnumConstants(); return Stream.of(enumValues).map(enumValue -> new Object[]{ enumValue }).collect(Collectors.toL...
3.26
pulsar_LoadSimulationController_handleCopy_rdh
// Handle the command line arguments associated with the copy command. private void handleCopy(final ShellArguments arguments) throws Exception { final List<String> commandArguments = arguments.commandArguments; // Copy accepts 3 application arguments: Tenant name, source ZooKeeper and target ZooKeeper connect strings....
3.26
pulsar_LoadSimulationController_writeProducerOptions_rdh
// Write options that are common to modifying and creating topics. private void writeProducerOptions(final DataOutputStream outputStream, final ShellArguments arguments, final String topic) throws Exception { if (!arguments.rangeString.isEmpty()) { // If --rand-rate was specified, extrac...
3.26
pulsar_LoadSimulationController_handleChange_rdh
// Handle the command line arguments associated with the change command. private void handleChange(final ShellArguments arguments) throws Exception { final List<String> v30 = arguments.commandArguments; // Change expects three application arguments: tenant name, namespace name, and topic name. if (checkAppArgs(v30.size...
3.26
pulsar_LoadSimulationController_initializeBundleData_rdh
// Initialize a BundleData from a resource quota and configurations and modify the quota accordingly. private BundleData initializeBundleData(final ResourceQuota quota, final ShellArguments arguments) { final double messageRate = (quota.getMsgRateIn() + quota.getMsgRateOut()) / 2; final int messageSize = ((in...
3.26
pulsar_LoadSimulationController_handleStream_rdh
// Handle the command line arguments associated with the stream command. private void handleStream(final ShellArguments arguments) throws Exception { final List<String> commandArguments = arguments.commandArguments; // Stream accepts 1 application argument: ZooKeeper connect string. if (checkAppArgs(commandArguments.si...
3.26
pulsar_LoadSimulationController_change_rdh
// Change producer settings for a given topic and JCommander arguments. private void change(final ShellArguments arguments, final String topic, final int client) throws Exception { outputStreams[client].write(LoadSimulationClient.CHANGE_COMMAND);writeProducerOptions(outputStreams[client], arguments, topic); outputStr...
3.26
pulsar_LoadSimulationController_changeOrCreate_rdh
// Change an existing topic, or create it if it does not exist. private int changeOrCreate(final ShellArguments arguments, final String topic) throws Exception { final int client = find(topic); if (client == (-1)) { trade(arguments, topic, random.nextInt(clients.length)); } else { change(arguments, topic, c...
3.26
pulsar_LoadSimulationController_trade_rdh
// Trade using the arguments parsed via JCommander and the topic name. private synchronized void trade(final ShellArguments arguments, final String topic, final int client) throws Exception { // Decide which client to send to randomly to preserve statelessness of // the controller. outputStreams[client].write(LoadSimu...
3.26
pulsar_LoadSimulationController_read_rdh
/** * Read the user-submitted arguments as commands to send to clients. * * @param args * Arguments split on whitespace from user input. */ private void read(final String[] args) { // Don't attempt to process blank input. if ((args.length > 0) && (!((args.length == 1) && args[0].isEmpty()))) { final ShellArgu...
3.26
pulsar_LoadSimulationController_run_rdh
/** * Create a shell for the user to send commands to clients. */ public void run() throws Exception { BufferedReader inReader = new BufferedReader(new InputStreamReader(System.in)); while (true) { // Print the very simple prompt. System.out.println(); System.out.print("> "); read(inReader.readLine().split("\\s+"))...
3.26
pulsar_LoadSimulationController_process_rdh
// Update the message rate information for the bundles in a recently changed load report. public synchronized void process(final WatchedEvent event) { try { // Get the load report and put this back as a watch. final LoadReport loadReport = ObjectMapperFactory.getMapper().getObjectMapper().readValu...
3.26
pulsar_LoadSimulationController_checkAppArgs_rdh
// Check that the expected number of application arguments matches the // actual number of application arguments. private boolean checkAppArgs(final int numAppArgs, final int numRequired) { if (numAppArgs != numRequired) { log.info("ERROR: Wrong number of application arguments (found {}, required {})", ...
3.26
pulsar_LoadSimulationController_handleGroupTrade_rdh
// Handle the command line arguments associated with the group trade command. private void handleGroupTrade(final ShellArguments arguments) throws Exception { final List<String> commandArguments = arguments.commandArguments;// Group trade expects 3 application arguments: tenant name, group name, // and number of namesp...
3.26
pulsar_LoadSimulationController_main_rdh
/** * Start a controller with command line arguments. * * @param args * Arguments to pass in. */ public static void main(String[] args) throws Exception { final MainArguments v107 = new MainArguments(); final JCommander jc = new JCommander(v107); jc.setProgramName("pulsar-perf simulation-controller"); try { jc.p...
3.26
pulsar_LoadSimulationController_handleGroupStop_rdh
// Handle the command line arguments associated with the group stop command. private void handleGroupStop(final ShellArguments arguments) throws Exception { final List<String> v88 = arguments.commandArguments; // Group stop requires two application arguments: tenant name and group // name. if (checkAppArgs(v88.size() ...
3.26
pulsar_LoadSimulationController_getResourceQuotas_rdh
// on the children if there are any, or getting the data from this ZNode otherwise. private void getResourceQuotas(final String path, final ZooKeeper zkClient, final Map<String, ResourceQuota>[] threadLocalMaps) throws Exception { final List<String> children = zkClient.getChildren(path, false); if (children.i...
3.26
pulsar_LoadSimulationController_handleTrade_rdh
// Handle the command line arguments associated with the trade command. private void handleTrade(final ShellArguments arguments) throws Exception { final List<String> commandArguments = arguments.commandArguments; // Trade expects three application arguments: tenant, namespace, and // topic. if (checkAppArgs(commandA...
3.26
pulsar_LoadSimulationController_changeIfExists_rdh
// Find a topic and change it if it exists. private int changeIfExists(final ShellArguments arguments, final String topic) throws Exception { final int client = find(topic); if (client != (-1)) { change(arguments, topic, client); }return client; }
3.26
pulsar_LoadSimulationController_m0_rdh
// Handle the command line arguments associated with the stop command. private void m0(final ShellArguments arguments) throws Exception { final List<String> commandArguments = arguments.commandArguments; // Stop expects three application arguments: tenant name, namespace // name, and topic name. if (checkAppArgs(comma...
3.26
pulsar_LoadSimulationController_find_rdh
// Attempt to find a topic on the clients. private int find(final String topic) throws Exception { int clientWithTopic = -1;for (int i = 0; i < clients.length; ++i) { outputStreams[i].write(LoadSimulationClient.FIND_COMMAND); outputStreams[i].writeUTF(topic); } for (int i = 0; i < clients.length; ++i) { ...
3.26
pulsar_SessionEvent_isConnected_rdh
/** * Check whether the state represents a connected or not-connected state. */ public boolean isConnected() { switch (this) { case Reconnected : case SessionReestablished : return true; case ConnectionLost : case SessionLost : default : return fals...
3.26
pulsar_Dispatcher_trackDelayedDelivery_rdh
/** * Check with dispatcher if the message should be added to the delayed delivery tracker. * Return true if the message should be delayed and ignored at this point. */ default boolean trackDelayedDelivery(long ledgerId, long entryId, MessageMetadata msgMetadata) { return false; }
3.26
pulsar_NonPersistentTopic_close_rdh
/** * Close this topic - close all producers and subscriptions associated with this topic. * * @param disconnectClients * disconnect clients * @param closeWithoutWaitingClientDisconnect * don't wait for client disconnect and forcefully close managed-ledg...
3.26
pulsar_NonPersistentTopic_checkBacklogQuotaExceeded_rdh
/** * * @return quota exceeded status for blocking producer creation */@Override public CompletableFuture<Void> checkBacklogQuotaExceeded(String producerName, BacklogQuotaType backlogQuotaType) {// No-op return CompletableFuture.completedFuture(null); }
3.26
pulsar_NonPersistentTopic_deleteForcefully_rdh
/** * Forcefully close all producers/consumers/replicators and deletes the topic. * * @return */ @Override public CompletableFuture<Void> deleteForcefully() { return delete(false, true); }
3.26
pulsar_ResourceQuotaCalculatorImpl_needToReportLocalUsage_rdh
// Return true if a report needs to be sent for the current round; false if it can be suppressed for this round. @Override public boolean needToReportLocalUsage(long currentBytesUsed, long lastReportedBytes, long currentMessagesUsed, long lastReportedMessages, long lastReportTimeMSecsSinceEpoch) { // If we are ab...
3.26
pulsar_ManagedCursorImpl_skipNonRecoverableLedger_rdh
/** * Manually acknowledge all entries in the lost ledger. * - Since this is an uncommon event, we focus on maintainability. So we do not modify * {@link #individualDeletedMessages} and {@link #batchDeletedIndexes}, but call * {@link #asyncDelete(Position, AsyncCallbacks.DeleteCallback, Object)}. * - This meth...
3.26