Skip to content

Commit

Permalink
Merge branch 'master' of gitee.com:yanhom/dynamic-tp
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhom1314 committed Jun 20, 2023
2 parents 9de66ef + 9ca6556 commit f47cef9
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class WechatNotifyConst {

private WechatNotifyConst() { }

public static final String WECHAT_WEH_HOOK = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=";
public static final String WECHAT_WEB_HOOK = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=";

public static final String WARNING_COLOR = "warning";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ void fullyUnlock() {
// }

/**
* Creates a {@code LinkedBlockingQueue} with a capacity of
* Creates a {@code VariableLinkedBlockingQueue} with a capacity of
* {@link Integer#MAX_VALUE}.
*/
public VariableLinkedBlockingQueue() {
this(Integer.MAX_VALUE);
}

/**
* Creates a {@code LinkedBlockingQueue} with the given (fixed) capacity.
* Creates a {@code VariableLinkedBlockingQueue} with the given (fixed) capacity.
*
* @param capacity the capacity of this queue
* @throws IllegalArgumentException if {@code capacity} is not greater
Expand All @@ -283,7 +283,7 @@ public VariableLinkedBlockingQueue(int capacity) {
}

/**
* Creates a {@code LinkedBlockingQueue} with a capacity of
* Creates a {@code VariableLinkedBlockingQueue} with a capacity of
* {@link Integer#MAX_VALUE}, initially containing the elements of the
* given collection,
* added in traversal order of the collection's iterator.
Expand Down Expand Up @@ -321,6 +321,7 @@ public VariableLinkedBlockingQueue(Collection<? extends E> c) {
*
* @return the number of elements in this queue
*/
@Override
public int size() {
return count.get();
}
Expand Down Expand Up @@ -353,6 +354,7 @@ public void setCapacity(int capacity) {
* because it may be the case that another thread is about to
* insert or remove an element.
*/
@Override
public int remainingCapacity() {
return capacity - count.get();
}
Expand All @@ -364,6 +366,7 @@ public int remainingCapacity() {
* @throws InterruptedException {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
*/
@Override
public void put(E e) throws InterruptedException {
if (e == null) {
throw new NullPointerException();
Expand All @@ -384,7 +387,7 @@ public void put(E e) throws InterruptedException {
* signalled if it ever changes from capacity. Similarly
* for all other uses of count in other wait guards.
*/
while (count.get() == capacity) {
while (count.get() >= capacity) {
notFull.await();
}
enqueue(node);
Expand All @@ -409,6 +412,7 @@ public void put(E e) throws InterruptedException {
* @throws InterruptedException {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
*/
@Override
public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {

Expand All @@ -421,7 +425,7 @@ public boolean offer(E e, long timeout, TimeUnit unit)
final AtomicInteger count = this.count;
putLock.lockInterruptibly();
try {
while (count.get() == capacity) {
while (count.get() >= capacity) {
if (nanos <= 0) {
return false;
}
Expand Down Expand Up @@ -452,12 +456,13 @@ public boolean offer(E e, long timeout, TimeUnit unit)
*
* @throws NullPointerException if the specified element is null
*/
@Override
public boolean offer(E e) {
if (e == null) {
throw new NullPointerException();
}
final AtomicInteger count = this.count;
if (count.get() == capacity) {
if (count.get() >= capacity) {
return false;
}
int c = -1;
Expand All @@ -481,6 +486,7 @@ public boolean offer(E e) {
return c >= 0;
}

@Override
public E take() throws InterruptedException {
E x;
int c = -1;
Expand All @@ -499,12 +505,13 @@ public E take() throws InterruptedException {
} finally {
takeLock.unlock();
}
if (c == capacity) {
if (c >= capacity) {
signalNotFull();
}
return x;
}

@Override
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
E x = null;
int c = -1;
Expand All @@ -527,12 +534,13 @@ public E poll(long timeout, TimeUnit unit) throws InterruptedException {
} finally {
takeLock.unlock();
}
if (c == capacity) {
if (c >= capacity) {
signalNotFull();
}
return x;
}

@Override
public E poll() {
final AtomicInteger count = this.count;
if (count.get() == 0) {
Expand All @@ -553,12 +561,13 @@ public E poll() {
} finally {
takeLock.unlock();
}
if (c == capacity) {
if (c >= capacity) {
signalNotFull();
}
return x;
}

@Override
public E peek() {
if (count.get() == 0) {
return null;
Expand Down Expand Up @@ -589,7 +598,7 @@ void unlink(Node<E> p, Node<E> trail) {
if (last == p) {
last = trail;
}
if (count.getAndDecrement() == capacity) {
if (count.getAndDecrement() >= capacity) {
notFull.signal();
}
}
Expand All @@ -605,6 +614,7 @@ void unlink(Node<E> p, Node<E> trail) {
* @param o element to be removed from this queue, if present
* @return {@code true} if this queue changed as a result of the call
*/
@Override
public boolean remove(Object o) {
if (o == null) {
return false;
Expand Down Expand Up @@ -633,6 +643,7 @@ public boolean remove(Object o) {
* @param o object to be checked for containment in this queue
* @return {@code true} if this queue contains the specified element
*/
@Override
public boolean contains(Object o) {
if (o == null) {
return false;
Expand Down Expand Up @@ -663,6 +674,7 @@ public boolean contains(Object o) {
*
* @return an array containing all of the elements in this queue
*/
@Override
public Object[] toArray() {
fullyLock();
try {
Expand Down Expand Up @@ -713,6 +725,7 @@ public Object[] toArray() {
* this queue
* @throws NullPointerException if the specified array is null
*/
@Override
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
fullyLock();
Expand All @@ -735,6 +748,7 @@ public <T> T[] toArray(T[] a) {
}
}

@Override
public String toString() {
fullyLock();
try {
Expand Down Expand Up @@ -763,6 +777,7 @@ public String toString() {
* Atomically removes all of the elements from this queue.
* The queue will be empty after this call returns.
*/
@Override
public void clear() {
fullyLock();
try {
Expand All @@ -772,7 +787,7 @@ public void clear() {
}
head = last;
// assert head.item == null && head.next == null;
if (count.getAndSet(0) == capacity) {
if (count.getAndSet(0) >= capacity) {
notFull.signal();
}
} finally {
Expand All @@ -786,6 +801,7 @@ public void clear() {
* @throws NullPointerException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
*/
@Override
public int drainTo(Collection<? super E> c) {
return drainTo(c, Integer.MAX_VALUE);
}
Expand All @@ -796,6 +812,7 @@ public int drainTo(Collection<? super E> c) {
* @throws NullPointerException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
*/
@Override
public int drainTo(Collection<? super E> c, int maxElements) {
if (c == null) {
throw new NullPointerException();
Expand Down Expand Up @@ -829,7 +846,7 @@ public int drainTo(Collection<? super E> c, int maxElements) {
if (i > 0) {
// assert h.item == null;
head = h;
signalNotFull = (count.getAndAdd(-i) == capacity);
signalNotFull = (count.getAndAdd(-i) >= capacity);
}
}
} finally {
Expand All @@ -849,6 +866,7 @@ public int drainTo(Collection<? super E> c, int maxElements) {
*
* @return an iterator over the elements in this queue in proper sequence
*/
@Override
public Iterator<E> iterator() {
return new Itr();
}
Expand Down Expand Up @@ -876,6 +894,7 @@ private class Itr implements Iterator<E> {
}
}

@Override
public boolean hasNext() {
return current != null;
}
Expand All @@ -900,6 +919,7 @@ private Node<E> nextNode(Node<E> p) {
}
}

@Override
public E next() {
fullyLock();
try {
Expand All @@ -916,6 +936,7 @@ public E next() {
}
}

@Override
public void remove() {
if (lastRet == null) {
throw new IllegalStateException();
Expand Down Expand Up @@ -951,10 +972,12 @@ static final class LBQSpliterator<E> implements Spliterator<E> {
this.est = queue.size();
}

@Override
public long estimateSize() {
return est;
}

@Override
public Spliterator<E> trySplit() {
Node<E> h;
final VariableLinkedBlockingQueue<E> q = this.queue;
Expand Down Expand Up @@ -993,6 +1016,7 @@ public Spliterator<E> trySplit() {
return null;
}

@Override
public void forEachRemaining(Consumer<? super E> action) {
if (action == null) {
throw new NullPointerException();
Expand Down Expand Up @@ -1025,6 +1049,7 @@ public void forEachRemaining(Consumer<? super E> action) {
}
}

@Override
public boolean tryAdvance(Consumer<? super E> action) {
if (action == null) {
throw new NullPointerException();
Expand Down Expand Up @@ -1058,6 +1083,7 @@ public boolean tryAdvance(Consumer<? super E> action) {
return false;
}

@Override
public int characteristics() {
return Spliterator.ORDERED | Spliterator.NONNULL |
Spliterator.CONCURRENT;
Expand All @@ -1079,6 +1105,7 @@ public int characteristics() {
* @return a {@code Spliterator} over the elements in this queue
* @since 1.8
*/
@Override
public Spliterator<E> spliterator() {
return new LBQSpliterator<E>(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public String platform() {
*/
@Override
public void send(NotifyPlatform platform, String text) {
String serverUrl = WechatNotifyConst.WECHAT_WEH_HOOK + platform.getUrlKey();
String serverUrl = WechatNotifyConst.WECHAT_WEB_HOOK + platform.getUrlKey();
MarkdownReq markdownReq = new MarkdownReq();
markdownReq.setMsgtype("markdown");
MarkdownReq.Markdown markdown = new MarkdownReq.Markdown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring:
name: dynamic-tp-polaris-cloud-demo
cloud:
polaris:
address: grpc://183.47.111.80:8091
address: grpc://119.91.66.223:8091
namespace: default # 设置配置中心命名空间
discovery:
enabled: true
Expand Down
15 changes: 0 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,21 +218,6 @@
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Build-Time>${maven.build.timestamp}</Build-Time>
<Built-By>yanhom</Built-By>
</manifestEntries>
</archive>
</configuration>
</plugin>

<!-- Gpg Signature -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit f47cef9

Please sign in to comment.