add customeBlockingQueue generic type support.

pull/1036/head
hongdan.qin 3 years ago
parent c242c9159b
commit e79f5f574d

@ -22,7 +22,7 @@ import java.util.concurrent.BlockingQueue;
/** /**
* Custom blocking-queue. * Custom blocking-queue.
*/ */
public interface CustomBlockingQueue { public interface CustomBlockingQueue<T> {
/** /**
* Gets the custom blocking queue type. * Gets the custom blocking queue type.
@ -45,5 +45,5 @@ public interface CustomBlockingQueue {
* *
* @return * @return
*/ */
BlockingQueue generateBlockingQueue(); BlockingQueue<T> generateBlockingQueue();
} }

@ -0,0 +1,27 @@
package cn.hippo4j.common.spi;
import cn.hippo4j.common.executor.support.CustomBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
/**
* SPI whit generic type test.
*/
public class MyArrayBlockingQueue implements CustomBlockingQueue<Runnable> {
@Override
public Integer getType() {
return null;
}
@Override
public String getName() {
return this.getClass().getSimpleName();
}
@Override
public BlockingQueue<Runnable> generateBlockingQueue() {
return new LinkedBlockingQueue<>(20);
}
}
Loading…
Cancel
Save