method2testcases stringlengths 118 6.63k |
|---|
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public int size() { int size = 0; if (root==null){ return 0; } if (root.getLeft()==null && root.getRight()==null){ return 1; } if (root.getLeft()!=null){ size+= 1+size(root.getLeft()); } if (root.getRight()!=null){ size+= 1+size(root.getRight()); } r... |
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public K min() { opsCount++; if (root==null){ return null; } else { return min(root,root.key); } } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @Override void add(K key, V da... |
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public K max() { opsCount++; if (root==null){ return null; } else { return max(root,root.key); } } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @Override void add(K key, V da... |
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public V find(K key) { opsCount++; if (root==null){ return null; } else if (key.compareTo(root.key)==0){ return root.data; } else if (key.compareTo(root.key)<0){ return find(root.getLeft(),key); } else{ return find(root.getRight(),key); } } AVLTreeIm... |
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public int height() { if (root==null){ return -1; } else { return root.getHeight(); } } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @Override void add(K key, V data); @Overr... |
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public K root() { if (root==null){ return null; } else{ return root.key; } } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @Override void add(K key, V data); @Override boolean... |
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public List<K> preorderTraversal() { List<K> keyList = new ArrayList<K>(); preorderTraversal(root,keyList); return keyList; } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @Ov... |
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public List<K> postorderTraversal() { List<K> keyList = new ArrayList<K>(); postorderTraversal(root,keyList); return keyList; } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @... |
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public List<K> inorderTraversal() { List<K> keyList = new ArrayList<K>(); inorderTraversal(root,keyList); return keyList; } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @Over... |
### Question:
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public List<K> levelorderTraversal() { List<K> keyList = new ArrayList<K>(); return levelorderTraversal(root,keyList); } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @Overrid... |
### Question:
SparseArray2DImpl implements ISparseArray2D<T> { @Override public List<T> getRowFor(int row) throws ArrayIndexOutOfBoundsException { if (row>this.row || row<0){ throw new ArrayIndexOutOfBoundsException(); } ArrayList<T> list = new ArrayList<T>(); IndexNode current = rowLinkedList.head; while (current!=nul... |
### Question:
SparseArray2DImpl implements ISparseArray2D<T> { @Override public void putAt(int row, int col, T value) throws ArrayIndexOutOfBoundsException { if (row>this.row || col>column){ throw new ArrayIndexOutOfBoundsException(); } else{ IndexNode rowNode = checkForIndex(rowLinkedList,row); IndexNode colNode = che... |
### Question:
SparseArray2DImpl implements ISparseArray2D<T> { @Override public T removeAt(int row, int col) throws ArrayIndexOutOfBoundsException { if (row>this.row || row<1 || col>column || col<1){ throw new ArrayIndexOutOfBoundsException(); } else if (isEmpty()==true){ return null; } else{ T returnValue = removeFrom... |
### Question:
CircularArraySequence implements Sequence { @Override public void append(Object element) { if (backingArray[rear] != null && rear!=backingArray.length-1){ backingArray[rear+1] = (T)element; rear+=1; fillCount +=1; if (fullCheck()==true){ regrow(); } } else if(backingArray[rear] !=null && rear==backingArra... |
### Question:
CircularArraySequence implements Sequence { @Override public Sequence<T> concat(Sequence seq) { CircularArraySequence<T> sequence1 = new CircularArraySequence<T>(this); CircularArraySequence<T> sequence2 = new CircularArraySequence<T>((CircularArraySequence<T>)seq); boolean halt = false; int index = seque... |
### Question:
CircularArraySequence implements Sequence { @Override public Sequence front() { CircularArraySequence<T> tempSequence = new CircularArraySequence<T>(this); boolean halt = false; int index = front; while (halt == false){ if (index == backingArray.length){ index = 0; } if (index == rear){ halt = true; } if(... |
### Question:
CircularArraySequence implements Sequence { @Override public Object head() { CircularArraySequence<T> tempSequence = new CircularArraySequence<T>(this); T firstObj = null; if (front == 0 || backingArray[front]==null){ if (backingArray[front]==null){ firstObj = null; } else{ firstObj = tempSequence.backing... |
### Question:
CircularArraySequence implements Sequence { @Override public boolean isEmpty() { if (fillCount>0){ return false; } return true; } CircularArraySequence(int size); CircularArraySequence(CircularArraySequence<T> seq); @Override Object head(); @Override Object last(); @Override Sequence front(); @Override S... |
### Question:
SemiStructureTokenizer extends Tokenizer { private void setStructireInfo(Reader input) { SemistructuredFormulaParser formulaParser = new SemistructuredFormulaParser(input); try { ChemSubStructure structure = formulaParser.parse(); Stack<DFSStackEntry> stack = new Stack<DFSStackEntry>(); stack.push(new DFS... |
### Question:
SemiStructureTokenizer extends Tokenizer { @Override final public boolean incrementToken() throws IOException { if (currentEntry == null) { currentEntry = currentIterator.next(); currentCount = 0; String result = String.format("%s_%d", currentEntry.getKey(), currentCount); termAtt.setEmpty().append(result... |
### Question:
OperationJoin { public OperationJoin setOperations(Operation... ops) { if (ops.length == 0) { throw new IllegalArgumentException("At least one operation to join expected"); } if (this.operationIterator != null) { throw new IllegalStateException(ERROR_MSG_OPERATIONS_ALREADY_SET); } for (Operation op : ops)... |
### Question:
FactoryService extends StatelessService { protected String buildDefaultChildSelfLink() { return getHost().nextUUID(); } FactoryService(Class<? extends ServiceDocument> childServiceDocumentType); static FactoryService create(Class<? extends Service> childServiceType,
ServiceOption... options); ... |
### Question:
QueryTaskClientHelper { public QueryTaskClientHelper<T> setBaseUri(URI baseUri) { assertNotNull(baseUri, "'baseUri' must not be null."); this.baseUri = baseUri; return this; } private QueryTaskClientHelper(Class<T> type); static QueryTaskClientHelper<T> create(Class<T> type); QueryTaskClientHelper<T> set... |
### Question:
QueryTaskClientHelper { public QueryTaskClientHelper<T> setFactoryPath(String factoryPath) { assertNotNull(factoryPath, "'factoryPath' must not be null."); this.factoryPath = factoryPath; return this; } private QueryTaskClientHelper(Class<T> type); static QueryTaskClientHelper<T> create(Class<T> type); Q... |
### Question:
QueryTaskClientHelper { public static <T extends ServiceDocument> QueryTaskClientHelper<T> create(Class<T> type) { return new QueryTaskClientHelper<T>(type); } private QueryTaskClientHelper(Class<T> type); static QueryTaskClientHelper<T> create(Class<T> type); QueryTaskClientHelper<T> setDocumentLink(Str... |
### Question:
SynchronizationTaskService extends TaskService<SynchronizationTaskService.State> { public static SynchronizationTaskService create(Supplier<Service> childServiceInstantiator) { if (childServiceInstantiator.get() == null) { throw new IllegalArgumentException( "childServiceInstantiator created null child se... |
### Question:
OperationProcessingChain { public static OperationProcessingChain create(Filter... filters) { OperationProcessingChain opProcessingChain = new OperationProcessingChain(); for (Filter filter : filters) { filter.init(); opProcessingChain.filters.add(filter); } return opProcessingChain; } private OperationP... |
### Question:
NettyHttpServiceClient implements ServiceClient { @Override public void send(Operation op) { sendRequest(op); } static ServiceClient create(String userAgent,
ExecutorService executor,
ScheduledExecutorService scheduledExecutor); static ServiceClient create(String userAgent,
... |
### Question:
BasicAuthenticationService extends StatelessService { protected long getExpirationTime(AuthenticationRequest authRequest) { long expirationTimeSeconds = authRequest.sessionExpirationSeconds != null ? authRequest.sessionExpirationSeconds : AUTH_TOKEN_EXPIRATION_SECONDS; if (this.UPPER_SESSION_LIMIT_SECONDS... |
### Question:
ServiceDocument { public void copyTo(ServiceDocument target) { target.documentEpoch = this.documentEpoch; target.documentDescription = this.documentDescription; target.documentOwner = this.documentOwner; target.documentSourceLink = this.documentSourceLink; target.documentVersion = this.documentVersion; ta... |
### Question:
ServiceDocument { public static boolean equals(ServiceDocumentDescription description, ServiceDocument currentDocument, ServiceDocument newDocument) { if (currentDocument == null || newDocument == null) { throw new IllegalArgumentException( "Null Service documents cannot be checked for equality."); } try ... |
### Question:
MixAll { public static boolean compareAndIncreaseOnly(final AtomicLong target, final long value) { long prev = target.get(); while (value > prev) { boolean updated = target.compareAndSet(prev, value); if (updated) return true; prev = target.get(); } return false; } static String getWSAddr(); static Strin... |
### Question:
MixAll { public static void string2File(final String str, final String fileName) throws IOException { String tmpFile = fileName + ".tmp"; string2FileNotSafe(str, tmpFile); String bakFile = fileName + ".bak"; String prevContent = file2String(fileName); if (prevContent != null) { string2FileNotSafe(prevCont... |
### Question:
CommandUtil { public static Set<String> fetchMasterAddrByClusterName(final MQAdminExt adminExt, final String clusterName) throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingSendRequestException, MQBrokerException { Set<String> masterSet = new HashSet<String>(); Cluste... |
### Question:
CommandUtil { public static Set<String> fetchBrokerNameByClusterName(final MQAdminExt adminExt, final String clusterName) throws Exception { ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clus... |
### Question:
Validators { public static void checkTopic(String topic) throws MQClientException { if (UtilAll.isBlank(topic)) { throw new MQClientException("The specified topic is blank", null); } if (!regularExpressionMatcher(topic, PATTERN)) { throw new MQClientException(String.format( "The specified topic[%s] contai... |
### Question:
MQClientInstance { public boolean registerProducer(final String group, final DefaultMQProducerImpl producer) { if (null == group || null == producer) { return false; } MQProducerInner prev = this.producerTable.putIfAbsent(group, producer); if (prev != null) { log.warn("the producer group[{}] exist already... |
### Question:
MQClientInstance { public boolean registerConsumer(final String group, final MQConsumerInner consumer) { if (null == group || null == consumer) { return false; } MQConsumerInner prev = this.consumerTable.putIfAbsent(group, consumer); if (prev != null) { log.warn("the consumer group[" + group + "] exist al... |
### Question:
MQClientInstance { public boolean registerAdminExt(final String group, final MQAdminExtInner admin) { if (null == group || null == admin) { return false; } MQAdminExtInner prev = this.adminExtTable.putIfAbsent(group, admin); if (prev != null) { log.warn("the admin group[{}] exist already.", group); return... |
### Question:
RemotingCommand { public static byte[] markProtocolType(int source, SerializeType type) { byte[] result = new byte[4]; result[0] = type.getCode(); result[1] = (byte) ((source >> 16) & 0xFF); result[2] = (byte) ((source >> 8) & 0xFF); result[3] = (byte) (source & 0xFF); return result; } protected Remoting... |
### Question:
RemotingCommand { public static RemotingCommand createResponseCommand(Class<? extends CommandCustomHeader> classHeader) { return createResponseCommand(RemotingSysResponseCode.SYSTEM_ERROR, "not set any response code", classHeader); } protected RemotingCommand(); static RemotingCommand createRequestComman... |
### Question:
RouteInfoManager { public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); } R... |
### Question:
RouteInfoManager { public byte[] getAllTopicList() { TopicList topicList = new TopicList(); try { try { this.lock.readLock().lockInterruptibly(); topicList.getTopicList().addAll(this.topicQueueTable.keySet()); } finally { this.lock.readLock().unlock(); } } catch (Exception e) { log.error("getAllTopicList ... |
### Question:
RouteInfoManager { public int wipeWritePermOfBrokerByLock(final String brokerName) { try { try { this.lock.writeLock().lockInterruptibly(); return wipeWritePermOfBroker(brokerName); } finally { this.lock.writeLock().unlock(); } } catch (Exception e) { log.error("wipeWritePermOfBrokerByLock Exception", e);... |
### Question:
RouteInfoManager { public TopicRouteData pickupTopicRouteData(final String topic) { TopicRouteData topicRouteData = new TopicRouteData(); boolean foundQueueData = false; boolean foundBrokerData = false; Set<String> brokerNameSet = new HashSet<String>(); List<BrokerData> brokerDataList = new LinkedList<Bro... |
### Question:
RouteInfoManager { public byte[] getSystemTopicList() { TopicList topicList = new TopicList(); try { try { this.lock.readLock().lockInterruptibly(); for (Map.Entry<String, Set<String>> entry : clusterAddrTable.entrySet()) { topicList.getTopicList().add(entry.getKey()); topicList.getTopicList().addAll(entr... |
### Question:
RouteInfoManager { public byte[] getTopicsByCluster(String cluster) { TopicList topicList = new TopicList(); try { try { this.lock.readLock().lockInterruptibly(); Set<String> brokerNameSet = this.clusterAddrTable.get(cluster); for (String brokerName : brokerNameSet) { Iterator<Entry<String, List<QueueData... |
### Question:
RouteInfoManager { public byte[] getUnitTopics() { TopicList topicList = new TopicList(); try { try { this.lock.readLock().lockInterruptibly(); Iterator<Entry<String, List<QueueData>>> topicTableIt = this.topicQueueTable.entrySet().iterator(); while (topicTableIt.hasNext()) { Entry<String, List<QueueData>... |
### Question:
RouteInfoManager { public byte[] getHasUnitSubTopicList() { TopicList topicList = new TopicList(); try { try { this.lock.readLock().lockInterruptibly(); Iterator<Entry<String, List<QueueData>>> topicTableIt = this.topicQueueTable.entrySet().iterator(); while (topicTableIt.hasNext()) { Entry<String, List<Q... |
### Question:
RouteInfoManager { public byte[] getHasUnitSubUnUnitTopicList() { TopicList topicList = new TopicList(); try { try { this.lock.readLock().lockInterruptibly(); Iterator<Entry<String, List<QueueData>>> topicTableIt = this.topicQueueTable.entrySet().iterator(); while (topicTableIt.hasNext()) { Entry<String, ... |
### Question:
KVConfigManager { public void putKVConfig(final String namespace, final String key, final String value) { try { this.lock.writeLock().lockInterruptibly(); try { HashMap<String, String> kvTable = this.configTable.get(namespace); if (null == kvTable) { kvTable = new HashMap<String, String>(); this.configTab... |
### Question:
DefaultPromise implements Promise<V> { @Override public boolean isCancelled() { return state.isCancelledState(); } DefaultPromise(); @Override boolean cancel(final boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); @Override V get(); @Override V get(final long tim... |
### Question:
DefaultPromise implements Promise<V> { @Override public boolean isDone() { return state.isDoneState(); } DefaultPromise(); @Override boolean cancel(final boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); @Override V get(); @Override V get(final long timeout); @Ov... |
### Question:
DefaultPromise implements Promise<V> { @Override public V get() { return result; } DefaultPromise(); @Override boolean cancel(final boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); @Override V get(); @Override V get(final long timeout); @Override boolean set(fin... |
### Question:
DefaultPromise implements Promise<V> { @Override public void addListener(final PromiseListener<V> listener) { if (listener == null) { throw new NullPointerException("FutureListener is null"); } boolean notifyNow = false; synchronized (lock) { if (!isDoing()) { notifyNow = true; } else { if (promiseListene... |
### Question:
DefaultPromise implements Promise<V> { @Override public Throwable getThrowable() { return exception; } DefaultPromise(); @Override boolean cancel(final boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); @Override V get(); @Override V get(final long timeout); @Over... |
### Question:
PushConsumerImpl implements PushConsumer { @Override public PushConsumer attachQueue(final String queueName, final MessageListener listener) { this.subscribeTable.put(queueName, listener); try { this.rocketmqPushConsumer.subscribe(queueName, "*"); } catch (MQClientException e) { throw new OMSRuntimeExcept... |
### Question:
LocalMessageCache implements ServiceLifecycle { long nextPullOffset(MessageQueue remoteQueue) { if (!pullOffsetTable.containsKey(remoteQueue)) { try { pullOffsetTable.putIfAbsent(remoteQueue, rocketmqPullConsumer.fetchConsumeOffset(remoteQueue, false)); } catch (MQClientException e) { log.error("A error o... |
### Question:
LocalMessageCache implements ServiceLifecycle { void submitConsumeRequest(ConsumeRequest consumeRequest) { try { consumeRequestCache.put(consumeRequest); } catch (InterruptedException ignore) { } } LocalMessageCache(final DefaultMQPullConsumer rocketmqPullConsumer, final ClientConfig clientConfig); @Overr... |
### Question:
PullConsumerImpl implements PullConsumer { @Override public Message poll() { MessageExt rmqMsg = localMessageCache.poll(); return rmqMsg == null ? null : OMSUtil.msgConvert(rmqMsg); } PullConsumerImpl(final String queueName, final KeyValue properties); @Override KeyValue properties(); @Override Message po... |
### Question:
SequenceProducerImpl extends AbstractOMSProducer implements SequenceProducer { @Override public synchronized void rollback() { msgCacheQueue.clear(); } SequenceProducerImpl(final KeyValue properties); @Override KeyValue properties(); @Override void send(final Message message); @Override void send(final Me... |
### Question:
ProducerImpl extends AbstractOMSProducer implements Producer { @Override public SendResult send(final Message message) { return send(message, this.rocketmqProducer.getSendMsgTimeout()); } ProducerImpl(final KeyValue properties); @Override KeyValue properties(); @Override SendResult send(final Message mess... |
### Question:
BeanUtils { public static <T> T populate(final Properties properties, final Class<T> clazz) { T obj = null; try { obj = clazz.newInstance(); return populate(properties, obj); } catch (Throwable e) { log.warn("Error occurs !", e); } return obj; } static T populate(final Properties properties, final Class<... |
### Question:
GetBrokerConfigCommand implements SubCommand { @Override public void execute(final CommandLine commandLine, final Options options, final RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(Syste... |
### Question:
BrokerConsumeStatsSubCommad implements SubCommand { @Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTime... |
### Question:
SendMsgStatusCommand implements SubCommand { @Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException { final DefaultMQProducer producer = new DefaultMQProducer("PID_SMSC", rpcHook); producer.setInstanceName("PID_SMSC_" + System.currentTimeMillis(... |
### Question:
ConsumerStatusSubCommand implements SubCommand { @Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMil... |
### Question:
GetNamesrvConfigCommand implements SubCommand { @Override public void execute(final CommandLine commandLine, final Options options, final RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(Syst... |
### Question:
UpdateTopicPermSubCommand implements SubCommand { @Override public void execute(final CommandLine commandLine, final Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.c... |
### Question:
TopicRouteSubCommand implements SubCommand { @Override public void execute(final CommandLine commandLine, final Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.curren... |
### Question:
TopicClusterSubCommand implements SubCommand { @Override public void execute(final CommandLine commandLine, final Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.curr... |
### Question:
TopicStatusSubCommand implements SubCommand { @Override public void execute(final CommandLine commandLine, final Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.curre... |
### Question:
UpdateOrderConfCommand implements SubCommand { @Override public void execute(final CommandLine commandLine, final Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.curr... |
### Question:
ConsumerFilterManager extends ConfigManager { public void register(final String consumerGroup, final Collection<SubscriptionData> subList) { for (SubscriptionData subscriptionData : subList) { register( subscriptionData.getTopic(), consumerGroup, subscriptionData.getSubString(), subscriptionData.getExpres... |
### Question:
ConsumerFilterManager extends ConfigManager { public void unRegister(final String consumerGroup) { for (String topic : filterDataByTopic.keySet()) { this.filterDataByTopic.get(topic).unRegister(consumerGroup); } } ConsumerFilterManager(); ConsumerFilterManager(BrokerController brokerController); static C... |
### Question:
ConsumerFilterManager extends ConfigManager { public ConsumerFilterData get(final String topic, final String consumerGroup) { if (!this.filterDataByTopic.containsKey(topic)) { return null; } if (this.filterDataByTopic.get(topic).getGroupFilterData().isEmpty()) { return null; } return this.filterDataByTopi... |
### Question:
ProducerManager { public void scanNotActiveChannel() { try { if (this.groupChannelLock.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) { try { for (final Map.Entry<String, HashMap<Channel, ClientChannelInfo>> entry : this.groupChannelTable .entrySet()) { final String group = entry.getKey(); final Has... |
### Question:
ProducerManager { public void doChannelCloseEvent(final String remoteAddr, final Channel channel) { if (channel != null) { try { if (this.groupChannelLock.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) { try { for (final Map.Entry<String, HashMap<Channel, ClientChannelInfo>> entry : this.groupChanne... |
### Question:
ProducerManager { public void registerProducer(final String group, final ClientChannelInfo clientChannelInfo) { try { ClientChannelInfo clientChannelInfoFound = null; if (this.groupChannelLock.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) { try { HashMap<Channel, ClientChannelInfo> channelTable = t... |
### Question:
ProducerManager { public void unregisterProducer(final String group, final ClientChannelInfo clientChannelInfo) { try { if (this.groupChannelLock.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) { try { HashMap<Channel, ClientChannelInfo> channelTable = this.groupChannelTable.get(group); if (null != c... |
### Question:
SendMessageProcessor extends AbstractSendMessageProcessor implements NettyRequestProcessor { @Override public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { SendMessageContext mqtraceContext; switch (request.getCode()) { case RequestCod... |
### Question:
ClientManageProcessor implements NettyRequestProcessor { @Override public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { switch (request.getCode()) { case RequestCode.HEART_BEAT: return this.heartBeat(ctx, request); case RequestCode.UNR... |
### Question:
BrokerStartup { private static void properties2SystemEnv(Properties properties) { if (properties == null) { return; } String rmqAddressServerDomain = properties.getProperty("rmqAddressServerDomain", MixAll.WS_DOMAIN_NAME); String rmqAddressServerSubGroup = properties.getProperty("rmqAddressServerSubGroup"... |
### Question:
MappedFile extends ReferenceResource { public SelectMappedBufferResult selectMappedBuffer(int pos, int size) { int readPosition = getReadPosition(); if ((pos + size) <= readPosition) { if (this.hold()) { ByteBuffer byteBuffer = this.mappedByteBuffer.slice(); byteBuffer.position(pos); ByteBuffer byteBuffer... |
### Question:
ConsumeQueueExt { public long put(final CqExtUnit cqExtUnit) { final int retryTimes = 3; try { int size = cqExtUnit.calcUnitSize(); if (size > CqExtUnit.MAX_EXT_UNIT_SIZE) { log.error("Size of cq ext unit is greater than {}, {}", CqExtUnit.MAX_EXT_UNIT_SIZE, cqExtUnit); return 1; } if (this.mappedFileQueu... |
### Question:
ConsumeQueueExt { public CqExtUnit get(final long address) { CqExtUnit cqExtUnit = new CqExtUnit(); if (get(address, cqExtUnit)) { return cqExtUnit; } return null; } ConsumeQueueExt(final String topic,
final int queueId,
final String storePath,
... |
### Question:
IndexFile { public boolean putKey(final String key, final long phyOffset, final long storeTimestamp) { if (this.indexHeader.getIndexCount() < this.indexNum) { int keyHash = indexKeyHashMethod(key); int slotPos = keyHash % this.hashSlotNum; int absSlotPos = IndexHeader.INDEX_HEADER_SIZE + slotPos * hashSlo... |
### Question:
IndexFile { public void selectPhyOffset(final List<Long> phyOffsets, final String key, final int maxNum, final long begin, final long end, boolean lock) { if (this.mappedFile.hold()) { int keyHash = indexKeyHashMethod(key); int slotPos = keyHash % this.hashSlotNum; int absSlotPos = IndexHeader.INDEX_HEADE... |
### Question:
FilterAPI { public static SubscriptionData buildSubscriptionData(final String consumerGroup, String topic, String subString) throws Exception { SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString(subString); if (null == subString || s... |
### Question:
FilterAPI { public static SubscriptionData build(final String topic, final String subString, final String type) throws Exception { if (ExpressionType.TAG.equals(type) || type == null) { return buildSubscriptionData(null, topic, subString); } if (subString == null || subString.length() < 1) { throw new Ill... |
### Question:
DataVersion extends RemotingSerializable { @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final DataVersion that = (DataVersion) o; if (timestamp != that.timestamp) { return false; } if (counter != null && that.count... |
### Question:
UtilAll { public static String currentStackTrace() { StringBuilder sb = new StringBuilder(); StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); for (StackTraceElement ste : stackTrace) { sb.append("\n\t"); sb.append(ste.toString()); } return sb.toString(); } static int getPid(); sta... |
### Question:
UtilAll { public static int getPid() { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String name = runtime.getName(); try { return Integer.parseInt(name.substring(0, name.indexOf('@'))); } catch (Exception e) { return -1; } } static int getPid(); static String currentStackTrace(); static ... |
### Question:
UtilAll { public static double getDiskPartitionSpaceUsedPercent(final String path) { if (null == path || path.isEmpty()) return -1; try { File file = new File(path); if (!file.exists()) return -1; long totalSpace = file.getTotalSpace(); if (totalSpace > 0) { long freeSpace = file.getFreeSpace(); long used... |
### Question:
UtilAll { public static boolean isBlank(String str) { int strLen; if (str == null || (strLen = str.length()) == 0) { return true; } for (int i = 0; i < strLen; i++) { if (!Character.isWhitespace(str.charAt(i))) { return false; } } return true; } static int getPid(); static String currentStackTrace(); sta... |
### Question:
MixAll { public static String brokerVIPChannel(final boolean isChange, final String brokerAddr) { if (isChange) { String[] ipAndPort = brokerAddr.split(":"); String brokerAddrNew = ipAndPort[0] + ":" + (Integer.parseInt(ipAndPort[1]) - 2); return brokerAddrNew; } else { return brokerAddr; } } static Stri... |
### Question:
CommandUtil { public static Map<String, List<String>> fetchMasterAndSlaveDistinguish( final MQAdminExt adminExt, final String clusterName) throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingSendRequestException, MQBrokerException { Map<String, List<String>> masterAndS... |
### Question:
Condition implements Internal<Condition<S, T>, T> { public S invoke(Action action) { if (isSourceChainUpdateAccepted()) Invoker.invoke(action); return sourceProxy.owner(); } private Condition(S source, Predicate<T> predicate, boolean negateExpression); S then(Consumer<T> action); S invoke(Action action);... |
### Question:
Condition implements Internal<Condition<S, T>, T> { public <R> Optional<R> thenMap(Function<T, R> mapper) { if (isSourceChainUpdateAccepted()) { return new Optional<>(Invoker.invoke(mapper, sourceProxy.getItem()), sourceProxy.getConfiguration()); } else { return new Optional<>(null, sourceProxy.getConfigu... |
### Question:
Condition implements Internal<Condition<S, T>, T> { public <R> Optional<R> thenTo(@NonNull R item) { if (isSourceChainUpdateAccepted()) { return new Optional<>(item, sourceProxy.getConfiguration()); } else { return new Optional<>(null, sourceProxy.getConfiguration()); } } private Condition(S source, Pred... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.