name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
pulsar_AuthorizationProvider_removePermissionsAsync_rdh | /**
* Remove authorization-action permissions on a topic.
*
* @param topicName
* @return CompletableFuture<Void>
*/
default CompletableFuture<Void> removePermissionsAsync(TopicName topicName) {
return CompletableFuture.completedFuture(null);
} | 3.26 |
pulsar_AuthorizationProvider_allowNamespaceOperationAsync_rdh | /**
* Check if a given <tt>role</tt> is allowed to execute a given <tt>operation</tt> on the namespace.
*
* @param namespaceName
* namespace name
* @param role
* role name
* @param operation
* namespace operation
* @param authData
* authenticated data
* @return a completable future represents check r... | 3.26 |
pulsar_AuthorizationProvider_initialize_rdh | /**
* Perform initialization for the authorization provider.
*
* @param conf
* broker config object
* @param pulsarResources
* Resources component for access to metadata
* @throws IOException
* if the initialization fails
*/
default void
initialize(ServiceConfiguration conf, PulsarResources pulsarResourc... | 3.26 |
pulsar_AuthorizationProvider_allowTenantOperationAsync_rdh | /**
* Check if a given <tt>role</tt> is allowed to execute a given <tt>operation</tt> on the tenant.
*
* @param tenantName
* tenant name
* @param role
* role name
* @param operation
* tenant operation
* @param authData
* authenticated data of the role
* @return a completable future represents check r... | 3.26 |
pulsar_AuthorizationProvider_revokePermissionAsync_rdh | /**
* Revoke authorization-action permission on a topic to the given client.
*
* @param topicName
* @param role
* @return CompletableFuture<Void>
*/
default CompletableFuture<Void> revokePermissionAsync(TopicName topicName, String
role) {
return FutureUtil.failedFuture(new IllegalStateException(String.format(... | 3.26 |
pulsar_AuthorizationProvider_allowTopicPolicyOperation_rdh | /**
*
* @deprecated - will be removed after 2.12. Use async variant.
*/
@Deprecated
default Boolean allowTopicPolicyOperation(TopicName topicName, String role, PolicyName policy, PolicyOperation operation, AuthenticationDataSource authData) {
try {
return allowTopicPolicyOperationAsync(topicName, role, policy,... | 3.26 |
pulsar_AuthorizationProvider_allowTopicOperation_rdh | /**
*
* @deprecated - will be removed after 2.12. Use async variant.
*/
@Deprecated
default Boolean allowTopicOperation(TopicName topicName, String role, TopicOperation operation, AuthenticationDataSource authData) {
try {
return allowTopicOperationAsync(topicName, role,... | 3.26 |
pulsar_AuthorizationProvider_allowTopicPolicyOperationAsync_rdh | /**
* Check if a given <tt>role</tt> is allowed to execute a given topic <tt>operation</tt> on topic's <tt>policy</tt>.
*
* @param topic
* topic name
* @param role
* role name
* @param operation
* topic operation
* @param authData
* authenticated data
* @return CompletableFuture<Boolean>
*/
default ... | 3.26 |
pulsar_SecurityUtil_loginKerberos_rdh | /**
* Initializes UserGroupInformation with the given Configuration and performs the login for the
* given principal and keytab. All logins should happen through this class to ensure other threads
* are not concurrently modifying UserGroupInformation.
* <p/>
*
* @param config
* the configuration instance
* ... | 3.26 |
pulsar_SecurityUtil_isSecurityEnabled_rdh | /**
* Initializes UserGroupInformation with the given Configuration and returns
* UserGroupInformation.isSecurityEnabled().
* All checks for isSecurityEnabled() should happen through this method.
*
* @param config
* the given configuration
* @return true if kerberos is enabled o... | 3.26 |
pulsar_SecurityUtil_loginSimple_rdh | /**
* Initializes UserGroupInformation with the given Configuration and
* returns UserGroupInformation.getLoginUser(). All logins should happen
* through this class to ensure other threads are not concurrently
* modifying UserGroupInformation.
*
* @param config
* the configuration instance
* @return the UGI f... | 3.26 |
pulsar_MessageCryptoBc_createIESParameterSpec_rdh | // required since Bouncycastle 1.72 when using ECIES, it is required to pass in an IESParameterSpec
public static IESParameterSpec createIESParameterSpec() {
// the IESParameterSpec to use was discovered by debugging BouncyCastle 1.69 and running the
// test org.apache.pulsar.client.api.SimpleProducerConsumerTest#testC... | 3.26 |
pulsar_ManagedCursorContainer_add_rdh | /**
* Add a cursor to the container. The cursor will be optionally tracked for the slowest reader when
* a position is passed as the second argument. It is expected that the position is updated with
* {@link #cursorUpdated(ManagedCursor, Position)} method when the position changes.
*
* @param cursor
* cursor to... | 3.26 |
pulsar_ManagedCursorContainer_m0_rdh | /**
* Check whether there are any cursors.
*
* @return true is there are no cursors and false if there are
*/
public boolean m0() {
long stamp = f0.tryOptimisticRead();
boolean isEmpty = cursors.isEmpty();
if (!f0.validate(stamp)) {
// Fallback to read lock
stamp = f0.readLock();
try {
isEmpty = cursors.isEmpty... | 3.26 |
pulsar_ManagedCursorContainer_hasDurableCursors_rdh | /**
* Check whether that are any durable cursors.
*
* @return true if there are durable cursors and false if there are not
*/
public boolean hasDurableCursors() {
long stamp = f0.tryOptimisticRead();
int count
= durableCursorCount;
if (!f0.validate(stamp)) {
// Fallback to read lock
stamp = f0.readLock();
try {
... | 3.26 |
pulsar_ManagedCursorContainer_siftDown_rdh | /**
* Push the item down towards the bottom of the tree (the highest reading position).
*/
private void siftDown(final Item item) {
while (true) {
Item j = null;
Item right = getRight(item);
if ((right != null) && (right.position.compareTo(item.position) < 0)) {
Item left = getLeft(item);
... | 3.26 |
pulsar_ManagedCursorContainer_getSlowestReaderPosition_rdh | /**
* Get the slowest reader position for the cursors that are ordered.
*
* @return the slowest reader position
*/
public PositionImpl getSlowestReaderPosition() {
long stamp = f0.readLock();
try {
return heap.isEmpty() ? null : heap.get(0).position;
}
finally {
f0.unlockRead(stamp);
}
} | 3.26 |
pulsar_ManagedCursorContainer_swap_rdh | /**
* Swap two items in the heap.
*/
private void swap(Item item1, Item item2) {
int idx1 = item1.idx;
int idx2 = item2.idx;
heap.set(idx2, item1);
heap.set(idx1, item2);
// Update the indexes too
item1.idx = idx2;
item2.idx = idx1;
} | 3.26 |
pulsar_ManagedCursorContainer_siftUp_rdh | // //////////////////////
/**
* Push the item up towards the root of the tree (the lowest reading position).
*/
private void siftUp(Item item) {
Item parent = getParent(item);
while ((item.idx > 0) && (parent.position.compareTo(item.position) > 0))
{
swap(item, parent);
parent = getParent(item);
}
} | 3.26 |
pulsar_PulsarSaslServer_getAuthorizationID_rdh | /**
* Reports the authorization ID in effect for the client of this
* session.
* This method can only be called if isComplete() returns true.
*
* @return The authorization ID of the client.
* @exception IllegalStateException
* if this authentication session has not completed
*/
public String getAuthorizationI... | 3.26 |
pulsar_ProxyExtensions_extension_rdh | /**
* Return the handler for the provided <tt>extension</tt>.
*
* @param extension
* the extension to use
* @return the extension to handle the provided extension
*/
public ProxyExtension extension(String extension)... | 3.26 |
pulsar_ProxyExtensions_load_rdh | /**
* Load the extensions for the given <tt>extensions</tt> list.
*
* @param conf
* the pulsar broker service configuration
* @return the collection of extensions
*/
public static ProxyExtensions load(ProxyConfiguration conf) throws IOException {
ExtensionsDefinitions definitions =
ProxyExtensionsUtil... | 3.26 |
pulsar_ByteBufPair_coalesce_rdh | /**
*
* @return a single buffer with the content of both individual buffers
*/
@VisibleForTesting
public static ByteBuf coalesce(ByteBufPair pair) {
ByteBuf b = Unpooled.buffer(pair.readableBytes());
b.writeBytes(pair.b1, pair.b1.readerIndex(), pair.b1.readableBytes());
b.writeBytes(pair.b2, pair.b2.rea... | 3.26 |
pulsar_ByteBufPair_m0_rdh | /**
* Get a new {@link ByteBufPair} from the pool and assign 2 buffers to it.
*
* <p>The buffers b1 and b2 lifecycles are now managed by the ByteBufPair:
* when the {@link ByteBufPair} is deallocated, b1 and b2 will be released as well.
*
* @param b1
* @param b2
* @return */
public static ByteBufPair m0(ByteBu... | 3.26 |
pulsar_TlsHostnameVerifier_normaliseAddress_rdh | /* Normalize IPv6 or DNS name. */
static String normaliseAddress(final String hostname) {
if (hostname == null) { return hostname;
}
try {
final InetAddress inetAddress = InetAddress.getByName(hostname);
return inetAddress.getHostAddress();
} catch (final UnknownHostException unexpected) {
// Should not hap... | 3.26 |
pulsar_CmdRead_run_rdh | /**
* Run the read command.
*
* @return 0 for success, < 0 otherwise
*/
public int run() throws PulsarClientException, IOException {
if (mainOptions.size() != 1) {
throw new ParameterException("Please provide one and only one topic name.");
}
if (this.numMessagesToRead < 0) {
throw new P... | 3.26 |
pulsar_SaslAuthenticationDataProvider_authenticate_rdh | // create token that evaluated by client, and will send to server.
@Override
public AuthData authenticate(AuthData commandData) throws AuthenticationException {
// init
if (Arrays.equals(commandData.getBytes(), AuthData.INIT_AUTH_DATA_BYTES)) {
if (pulsarSaslClient.hasInitialResponse()) {
r... | 3.26 |
pulsar_Authentication_authenticationStage_rdh | /**
* An authentication Stage.
* when authentication complete, passed-in authFuture will contains authentication related http request headers.
*/
default void authenticationStage(String requestUrl, AuthenticationDataProvider authData, Map<String, String>
previousResHeaders, CompletableFuture<Map<String, String>> aut... | 3.26 |
pulsar_Authentication_getAuthData_rdh | /**
* Get/Create an authentication data provider which provides the data that this client will be sent to the broker.
* Some authentication method need to auth between each client channel. So it need the broker, who it will talk to.
*
* @param brokerHostName
* target broker host name
* @return The authenticatio... | 3.26 |
pulsar_Authentication_newRequestHeader_rdh | /**
* Add an authenticationStage that will complete along with authFuture.
*/
default Set<Entry<String, String>> newRequestHeader(String hostName, AuthenticationDataProvider authData, Map<String, String> previousResHeaders) throws Exception {
return authData.getHttpHeaders... | 3.26 |
pulsar_PerformanceBaseArguments_parseCLI_rdh | /**
* Parse the command line args.
*
* @param cmdName
* used for the help message
* @param args
* String[] of CLI args
* @throws ParameterException
* If there is a problem parsing the arguments
*/
public void parseCLI(String cmdName, String[] args) {
JCommander jc = new JCommander(this);
jc.setP... | 3.26 |
pulsar_PerformanceBaseArguments_validate_rdh | /**
* Validate the CLI arguments. Default implementation provides validation for the common arguments.
* Each subclass should call super.validate() and provide validation code specific to the sub-command.
*
* @throws Exception
*/public void validate() throws Exception {
if ((confFile != null) && (!confFile.is... | 3.26 |
pulsar_MetadataStore_getDefaultMetadataCacheConfig_rdh | /**
* Returns the default metadata cache config.
*
* @return default metadata cache config
*/
default MetadataCacheConfig getDefaultMetadataCacheConfig() {
return MetadataCacheConfig.builder().build();
} | 3.26 |
pulsar_MetadataStore_sync_rdh | /**
* Ensure that the next value read from the local client will be up-to-date with the latest version of the value
* as it can be seen by all the other clients.
*
* @param path
* @return a handle to the operation
*/
default CompletableFuture<Void> sync(String path) {
return CompletableFuture.completedFuture... | 3.26 |
pulsar_MetadataStore_getMetadataCache_rdh | /**
* Create a metadata cache that uses a particular serde object.
*
* @param <T>
* @param serde
* the custom serialization/deserialization object
* @return the metadata cache object
*/
default <T> MetadataCache<T> getMetadataCache(MetadataSerde<T> serde) {
return getMetadataCache(serde, getDefaultMetadat... | 3.26 |
pulsar_FunctionApiResource_clientAppId_rdh | /**
*
* @deprecated use {@link #authParams()} instead.
*/
@Deprecated
public String clientAppId() {
return httpRequest != null ? ((String) (httpRequest.getAttribute(AuthenticationFilter.AuthenticatedRoleAttributeName))) : null;
} | 3.26 |
pulsar_FunctionApiResource_clientAuthData_rdh | /**
*
* @deprecated use {@link #authParams()} instead.
*/
@Deprecated
public AuthenticationDataSource clientAuthData() {
return ((AuthenticationDataSource) (httpRequest.getAttribute(AuthenticationFilter.AuthenticatedDataAttributeName)));
} | 3.26 |
pulsar_ConsumerInterceptor_onPartitionsChange_rdh | /**
* This method is called when partitions of the topic (partitioned-topic) changes.
*
* @param topicName
* topic name
* @param partitions
* new updated number of partitions
*/
default void onPartitionsChange(String topicName,
int partitions) {
} | 3.26 |
pulsar_SchemaDefinition_builder_rdh | /**
* Interface for schema definition.
*/@InterfaceAudience.Public
@InterfaceStability.Stablepublic interface SchemaDefinition<T> {
/**
* Get a new builder instance that can used to configure and build a {@link SchemaDefinition} instance.
*
* @return the {@link SchemaDefinition}
*/
static ... | 3.26 |
pulsar_MongoSourceConfig_setSyncType_rdh | /**
*
* @param syncTypeStr
* Sync type string.
*/
private void setSyncType(String syncTypeStr) {
// if syncType is not set, the default sync type is used
if (StringUtils.isEmpty(syncTypeStr)) {
this.syncType = DEFAULT_SYNC_TYPE;
return;
}
// if syncType is set but not correct, an e... | 3.26 |
pulsar_ManagedCursorMetrics_aggregate_rdh | /**
* Aggregation by namespace, ledger, cursor.
*
* @return List<Metrics>
*/
private List<Metrics> aggregate() {
f0.clear();
for (Map.Entry<String, ManagedLedgerImpl> e : getManagedLedgers().entrySet()) {
String ledgerName = e.getKey();
ManagedLedgerImpl ledger = e.getValue();
Strin... | 3.26 |
pulsar_BucketDelayedDeliveryTrackerFactory_cleanResidualSnapshots_rdh | /**
* Clean up residual snapshot data.
* If tracker has not been created or has been closed, then we can't clean up the snapshot with `tracker.clear`,
* this method can clean up the residual snapshots without creating a tracker.
*/
public CompletableFuture<Void> cleanResidualSnapshots(ManagedCursor cursor) {
Ma... | 3.26 |
pulsar_MetadataStoreExtended_getMetadataEventSynchronizer_rdh | /**
* Get {@link MetadataEventSynchronizer} to notify and synchronize metadata events.
*
* @return */
default Optional<MetadataEventSynchronizer> getMetadataEventSynchronizer() {return Optional.empty();
} | 3.26 |
pulsar_MetadataStoreExtended_handleMetadataEvent_rdh | /**
* Handles a metadata synchronizer event.
*
* @param event
* @return completed future when the event is handled
*/default CompletableFuture<Void> handleMetadataEvent(MetadataEvent event) {
return CompletableFuture.completedFuture(null);
} | 3.26 |
pulsar_StreamingDataBlockHeaderImpl_fromStream_rdh | // Construct DataBlockHeader from InputStream, which contains `HEADER_MAX_SIZE` bytes readable.
public static StreamingDataBlockHeaderImpl fromStream(InputStream stream) throws IOException {
CountingInputStream countingStream = new CountingInputStream(stream);
DataInputStream dis = new DataInputStream(counting... | 3.26 |
pulsar_StreamingDataBlockHeaderImpl_toStream_rdh | /**
* Get the content of the data block header as InputStream.
* Read out in format:
* [ magic_word -- int ][ block_len -- int ][ first_entry_id -- long] [padding zeros]
*/
@Override
public InputStream toStream() {
ByteBuf out = PulsarByteBufAllocator.DEFAULT.buffer(HEADER_MAX_SIZE, HEADER_MAX_SIZE);
ou... | 3.26 |
pulsar_AdditionalServlets_load_rdh | /**
* Load the additional servlet for the given <tt>servlet name</tt> list.
*
* @param conf
* the pulsar service configuration
* @return the collection of additional servlet
*/
public static AdditionalServlets load(PulsarConfiguration conf) throws IOException {
String additionalServletDirectory = conf.getPr... | 3.26 |
pulsar_ConsumerBase_isValidConsumerEpoch_rdh | // If message consumer epoch is smaller than consumer epoch present that
// it has been sent to the client before the user calls redeliverUnacknowledgedMessages, this message is invalid.
// so we should release this message and receive again
protected boolean isValidConsumerEpoch(MessageImpl<T> message) {
if ((((getSub... | 3.26 |
pulsar_ConsumerBase_trackUnAckedMsgIfNoListener_rdh | // if listener is not null, we will track unAcked msg in callMessageListener
protected void trackUnAckedMsgIfNoListener(MessageId messageId, int redeliveryCount) {
if (listener == null)
{
unAckedMessageTracker.add(messageId, redeliveryCount);
}
} | 3.26 |
pulsar_ConsumerStats_getPartitionStats_rdh | /**
*
* @return stats for each partition if topic is partitioned topic
*/
default Map<String, ConsumerStats> getPartitionStats() {
return Collections.emptyMap();
} | 3.26 |
pulsar_BKCluster_startBKCluster_rdh | /**
* Start cluster. Also, starts the auto recovery process for each bookie, if
* isAutoRecoveryEnabled is true.
*
* @throws Exception
*/
private void startBKCluster(int numBookies) throws Exception {
PulsarRegistrationManager rm = new PulsarRegistrationManager(store, "/ledgers", baseConf);rm.initNewCluster();
ba... | 3.26 |
pulsar_BKCluster_stopBKCluster_rdh | /**
* Stop cluster. Also, stops all the auto recovery processes for the bookie
* cluster, if isAutoRecoveryEnabled is true.
*
* @throws Exception
*/
protected void stopBKCluster() throws Exception {
bookieComponents.forEach(LifecycleComponentStack::close);
bookieComponents.clear();} | 3.26 |
pulsar_BKCluster_startBookie_rdh | /**
* Helper method to startup a bookie server using a configuration object.
* Also, starts the auto recovery process if isAutoRecoveryEnabled is true.
*
* @param conf
* Server Configuration Object
*/
protected LifecycleComponentStack startBookie(ServerConfiguration conf) throws Exception {
LifecycleCompon... | 3.26 |
pulsar_BKCluster_startNewBookie_rdh | /**
* Helper method to startup a new bookie server with the indicated port
* number. Also, starts the auto recovery process, if the
* isAutoRecoveryEnabled is set true.
*
* @param index
* Bookie index
* @throws IOException
*/
public int startNewBookie(int index) throws Exception {
ServerConfiguration conf... | 3.26 |
pulsar_TopicList_minus_rdh | // get topics, which are contained in list1, and not in list2
public static Set<String> minus(Collection<String> list1, Collection<String> list2) {
HashSet<String> s1 = new HashSet<>(list1);
s1.removeAll(list2);return
s1;
} | 3.26 |
pulsar_TopicList_filterTopics_rdh | // get topics that match 'topicsPattern' from original topics list
// return result should contain only topic names, without partition part
public static List<String> filterTopics(List<String> original, String regex) {
Pattern topicsPattern = Pattern.compile(regex);
return filterTopics(original, topicsPattern)... | 3.26 |
pulsar_BrokerVersionFilter_filterAsync_rdh | /**
* From the given set of available broker candidates, filter those old brokers using the version numbers.
*
* @param brokers
* The currently available brokers that have not already been filtered.
* @param context
* The load manager context.
*/
@Override
public CompletableFuture<Map<String, BrokerLookupDat... | 3.26 |
pulsar_BrokerVersionFilter_getLatestVersionNumber_rdh | /**
* Get the most recent broker version number from the broker lookup data of all the running brokers.
* The version number is from the build artifact in the pom and got added to the package when it was built by Maven
*
* @param brokerMap
* The BrokerId -> BrokerLookupData Map.
* @r... | 3.26 |
pulsar_AuthenticationProvider_authenticateHttpRequestAsync_rdh | /**
* Validate the authentication for the given credentials with the specified authentication data.
*
* <p>Implementations of this method MUST modify the request by adding the {@link AuthenticatedRoleAttributeName}
* and the {@link AuthenticatedDataAttributeName} attributes.</p>
*
* <p>Warning: the calling thread... | 3.26 |
pulsar_AuthenticationProvider_newAuthState_rdh | /**
* Create an authentication data State use passed in AuthenticationDataSource.
*/
default AuthenticationState newAuthState(AuthData authData, SocketAddress remoteAddress, SSLSession sslSession) throws AuthenticationException {
return new OneStageAuthenticationState(authData, remoteAddress, sslSession, this);
}... | 3.26 |
pulsar_AuthenticationProvider_authenticate_rdh | /**
* Validate the authentication for the given credentials with the specified authentication data.
* This method is useful in one stage authn, if you're not doing one stage or if you're providing
* your own state implementation for one stage authn, it should throw an exception.
*
* @param authData
* provider s... | 3.26 |
pulsar_AuthenticationProvider_authenticateHttpRequest_rdh | /**
* Set response, according to passed in request.
* and return whether we should do following chain.doFilter or not.
*
* <p>Implementations of this method MUST modify the request by adding the {@link AuthenticatedRoleAttributeName}
* and the {@link AuthenticatedDataAttributeName} attributes.</p>
*
* @return Se... | 3.26 |
pulsar_MetadataStoreFactory_create_rdh | /**
* Create a new {@link MetadataStore} instance based on the given configuration.
*
* @param metadataURL
* the metadataStore URL
* @param metadataStoreConfig
* the configuration object
* @return a new {@link MetadataStore} instance
* @throws IOException
* if the metadata store initialization fails
*/
... | 3.26 |
pulsar_PulsarConnectorUtils_createInstance_rdh | /**
* Create an instance of <code>userClassName</code> using provided <code>classLoader</code>.
* This instance should implement the provided interface <code>xface</code>.
*
* @param userClassName
* user class name
* @param xface
* the interface that the reflected instance should implement
* @param classLoa... | 3.26 |
pulsar_TopicStatsImpl_add_rdh | // if the stats are added for the 1st time, we will need to make a copy of these stats and add it to the current
// stats. This stat addition is not thread-safe.
public TopicStatsImpl add(TopicStats ts) {
TopicStatsImpl stats = ((TopicStatsImpl) (ts));
this.count++;
this.msgRateIn += stats.msgRateIn;
th... | 3.26 |
pulsar_BrokerInterceptor_beforeSendMessage_rdh | /**
* Intercept messages before sending them to the consumers.
*
* @param subscription
* pulsar subscription
* @param entry
* entry
* @param ackSet
* entry ack bitset. it is either <tt>null</tt> or an array of long-based bitsets.
* @param msgMetadata
* message metadata. The message metadata will be re... | 3.26 |
pulsar_BrokerInterceptor_onMessagePublish_rdh | /**
* Intercept message when broker receive a send request.
*
* @param headersAndPayload
* entry's header and payload
* @param publishContext
* Publish Context
*/
default void onMessagePublish(Producer producer, ByteBuf headersAndPayload, Topic.PublishContext publishContext) {
} | 3.26 |
pulsar_BrokerInterceptor_producerCreated_rdh | /**
* Called by the broker when a new connection is created.
*/default
void producerCreated(ServerCnx cnx, Producer producer, Map<String, String> metadata) {
} | 3.26 |
pulsar_BrokerInterceptor_messageProduced_rdh | /**
* Intercept after a message is produced.
*
* @param cnx
* client Connection
* @param producer
* Producer object
* @param publishContext
* Publish Context
*/
default void messageProduced(ServerCnx cnx, Producer producer, long startTimeNs, long ledgerId, long entryId, Topic.PublishContext publishContex... | 3.26 |
pulsar_BrokerInterceptor_consumerCreated_rdh | /**
* Intercept after a consumer is created.
*
* @param cnx
* client Connection
* @param consumer
* Consumer object
* @param metadata
* A map of metadata
*/
default void consumerCreated(ServerCnx cnx, Consumer consume... | 3.26 |
pulsar_BrokerInterceptor_messageDispatched_rdh | /**
* Intercept after a message is dispatched to consumer.
*
* @param cnx
* client Connection
* @param consumer
* Consumer object
* @param ledgerId
* Ledger ID
* @param entryId
* Entry ID
* @param headersAndPayload
* Data
*/
default void messageDispatched(ServerCnx cnx, Consumer consumer, long le... | 3.26 |
pulsar_BrokerInterceptor_txnOpened_rdh | /**
* Intercept when a transaction begins.
*
* @param tcId
* Transaction Coordinator Id
* @param txnID
* Transaction ID
*/
default void txnOpened(long tcId, String txnID) {
} | 3.26 |
pulsar_BrokerInterceptor_consumerClosed_rdh | /**
* Called by the broker when a consumer is closed.
*
* @param cnx
* client Connection
* @param consumer
* Consumer object
* @param metadata
* A map of metadata
*/
default void consumerClosed(ServerCnx cnx, Consumer consumer, Map<String, String> metadata) {
} | 3.26 |
pulsar_BrokerInterceptor_onFilter_rdh | /**
* The interception of web processing, as same as `Filter.onFilter`.
* So In this method, we must call `chain.doFilter` to continue the chain.
*/
default void onFilter(ServletRequest request, ServletResponse
response, FilterChain chain) throws IOException, ServletException {
// Just continue the chain by defa... | 3.26 |
pulsar_BrokerInterceptor_onConnectionCreated_rdh | /**
* Called by the broker when a new connection is created.
*/
default void onConnectionCreated(ServerCnx cnx) {} | 3.26 |
pulsar_BrokerInterceptor_m0_rdh | /**
* Intercept when a transaction ends.
*
* @param txnID
* Transaction ID
* @param txnAction
* Transaction Action
*/
default void m0(String txnID, long txnAction) {
} | 3.26 |
pulsar_ReaderInterceptor_onPartitionsChange_rdh | /**
* This method is called when partitions of the topic (partitioned-topic) changes.
*
* @param topicName
* topic name
* @param partitions
* new updated number of partitions
*/
default void onPartitionsChange(String topicName, int partitions) {
} | 3.26 |
pulsar_PulsarJsonRowDecoder_decodeRow_rdh | /**
* decode ByteBuf by {@link org.apache.pulsar.client.api.schema.GenericSchema}.
*
* @param byteBuf
* @return */
@Override
public Optional<Map<DecoderColumnHandle, FieldValueProvider>>
decodeRow(ByteBuf
byteBuf) {
GenericJsonRecord record = ((GenericJsonRecord) (genericJsonSchema.decode(byteBuf)));
JsonN... | 3.26 |
pulsar_PortManager_m0_rdh | /**
* Returns whether the port was released successfully.
*
* @return whether the release is successful.
*/
public static synchronized boolean m0(int lockedPort) {
return PORTS.remove(lockedPort);
} | 3.26 |
pulsar_NonDurableCursorImpl_recover_rdh | // / Overridden methods from ManagedCursorImpl. Void implementation to skip cursor persistence
@Override
void recover(final VoidCallback callback) {
// / No-Op
} | 3.26 |
pulsar_Metrics_create_rdh | /**
* Creates a metrics object with the dimensions map immutable.
*
* @param dimensionMap
* @return */
public static Metrics create(Map<String, String> dimensionMap) {
// make the dimensions map unmodifiable and immutable;
Map<String, String> map = new TreeMap<>();
map.putAll(dimensionMap);
return... | 3.26 |
pulsar_BrokerMonitor_start_rdh | /**
* Start the broker monitoring procedure.
*/
public void start() {
try {final BrokerWatcher brokerWatcher = new BrokerWatcher(zkClient);
brokerWatcher.updateBrokers(BROKER_ROOT);
while (true) {
Thread.sleep(GLOBAL_STAT... | 3.26 |
pulsar_BrokerMonitor_main_rdh | /**
* Run a monitor from command line arguments.
*
* @param args
* Arguments for the monitor.
*/
public static void main(String[]
args) throws Exception {
final Arguments arguments = new Arguments();
final JCommander jc = new JCommander(arguments);
jc.setProgramName("pulsar-perf monitor-brokers");
... | 3.26 |
pulsar_BrokerMonitor_printLoadReport_rdh | // Print the load report in a tabular form for a broker running SimpleLoadManagerImpl.
private synchronized void printLoadReport(final
String broker, final LoadReport loadReport) {
f1.put(broker, loadReport);
// Initialize the constant rows.
final Object[][] rows = new Object[10][];
rows[0] = COUNT_ROW... | 3.26 |
pulsar_BrokerMonitor_initRow_rdh | // Helper method to initialize rows.
private static void initRow(final Object[] row, final Object... elements) {
System.arraycopy(elements, 0, row, 1, elements.length);
} | 3.26 |
pulsar_BrokerMonitor_printBrokerData_rdh | // Print the broker data in a tabular form for a broker using ModularLoadManagerImpl.
private synchronized void printBrokerData(final String broker, final LocalBrokerData localBrokerData, final TimeAverageBrokerData timeAverageData) {
f1.put(broker, localBrokerData);
// Initialize the constant rows.
final O... | 3.26 |
pulsar_BrokerMonitor_initMessageRow_rdh | // Helper method to initialize rows which hold message data.
private static void initMessageRow(final Object[] row, final double messageRateIn, final double messageRateOut,
final double messageThroughputIn, final double messageThroughputOut) {
initRow(row, messageRateIn, messageRateOut, messageRateIn + messa... | 3.26 |
pulsar_BrokerMonitor_printData_rdh | // Decide whether this broker is running SimpleLoadManagerImpl or ModularLoadManagerImpl and then print the data
// accordingly.
private synchronized void printData(final String path) {
final String broker = brokerNameFromPath(path);
String jsonString;
try {
jsonString = new String(zkClient.getData... | 3.26 |
pulsar_BrokerMonitor_printGlobalData_rdh | // Prints out the global load data.
private void printGlobalData() {
synchronized(f1) {
// 1 header row, 1 total row, and loadData.size() rows for brokers.
Object[][] rows = new Object[f1.size() + 2][];
rows[0] = GLOBAL_HEADER;
int totalBundles = 0;
double totalThroughput = 0... | 3.26 |
pulsar_BrokerMonitor_makeMessageRow_rdh | // Take advantage of repeated labels in message rows.
private static Object[] makeMessageRow(final String firstElement) {
final List<Object> result = new ArrayList<>();
result.add(firstElement);
result.addAll(MESSAGE_FIELDS);
return result.toArray();
} | 3.26 |
pulsar_BrokerMonitor_updateBrokers_rdh | // Inform the user of any broker gains and losses and put watches on newly acquired brokers.
private synchronized void updateBrokers(final String path) {
final Set<String> newBrokers = new HashSet<>();
try {
newBrokers.addAll(zkClient.getChildren(path, this));
} catch (Exception ex) {
throw ... | 3.26 |
pulsar_BrokerMonitor_process_rdh | /**
* Print the local and historical broker data in a tabular format, and put this back as a watcher.
*
* @param event
* The watched event.
*/
public synchronized void process(final WatchedEvent event) {
try {
if (event.getType() == EventType.NodeDataChanged) {printData(event.getPath());
}
... | 3.26 |
pulsar_ConsumerConfiguration_getAckTimeoutMillis_rdh | /**
*
* @return the configured timeout in milliseconds for unacked messages.
*/
public long getAckTimeoutMillis() { return conf.getAckTimeoutMillis();
} | 3.26 |
pulsar_ConsumerConfiguration_getNegativeAckRedeliveryBackoff_rdh | /**
*
* @return the configured {@link RedeliveryBackoff} for the consumer
*/public RedeliveryBackoff getNegativeAckRedeliveryBackoff() {
return conf.getNegativeAckRedeliveryBackoff();
} | 3.26 |
pulsar_ConsumerConfiguration_setProperties_rdh | /**
* Add all the properties in the provided map.
*
* @param properties
* @return */
public ConsumerConfiguration setProperties(Map<String, String> properties) {
conf.getProperties().putAll(properties);
return this;
} | 3.26 |
pulsar_ConsumerConfiguration_setCryptoFailureAction_rdh | /**
* Sets the ConsumerCryptoFailureAction to the value specified.
*
* @param action
* consumer action
*/
public void setCryptoFailureAction(ConsumerCryptoFailureAction action) {
conf.setCryptoFailureAction(action);
} | 3.26 |
pulsar_ConsumerConfiguration_setAckTimeout_rdh | /**
* Set the timeout for unacked messages, truncated to the nearest millisecond. The timeout needs to be greater than
* 10 seconds.
*
* @param ackTimeout
* for unacked messages.
* @param timeUnit
* unit in which the timeout is provided.
* @return {@link ConsumerConfiguration}
*/
public ConsumerConfigurati... | 3.26 |
pulsar_ConsumerConfiguration_getSubscriptionType_rdh | /**
*
* @return the configured subscription type
*/
public SubscriptionType getSubscriptionType() {
return conf.getSubscriptionType();
} | 3.26 |
pulsar_ConsumerConfiguration_setMessageListener_rdh | /**
* Sets a {@link MessageListener} for the consumer
* <p>
* When a {@link MessageListener} is set, application will receive messages through it. Calls to
* {@link Consumer#receive()} will not be allowed.
*
* @param messageListener
* the listener object
*/
public ConsumerConfiguration setMessageListener(Mess... | 3.26 |
pulsar_ConsumerConfiguration_setSubscriptionType_rdh | /**
* Select the subscription type to be used when subscribing to the topic.
* <p>
* Default is {@link SubscriptionType#Exclusive}
*
* @param subscriptionType
* the subscription type value
*/
public ConsumerConfiguration
setSubscriptionType(SubscriptionType subscriptionType) {
Objects.requireNonNull(subscr... | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.