Code cleanup

This commit is contained in:
nathan 2016-02-10 19:04:08 +01:00
parent 3e96e0d0b8
commit d230347584
10 changed files with 7 additions and 14 deletions

View File

@ -173,11 +173,11 @@ class MessageBus implements IMessageBus {
} else { } else {
if (useZeroGarbageVersionOfABQ) { if (useZeroGarbageVersionOfABQ) {
// no garbage is created, but this is slow (but faster than other messagebus implementations) // no garbage is created, but this is slow (but faster than other messagebus implementations)
asyncPublication = new AsyncABQ_noGc(numberOfThreads, errorHandler, syncPublication); asyncPublication = new AsyncABQ_noGc(numberOfThreads, errorHandler);
} }
else { else {
// garbage is created, but this is fast // garbage is created, but this is fast
asyncPublication = new AsyncABQ(numberOfThreads, errorHandler, syncPublication); asyncPublication = new AsyncABQ(numberOfThreads, errorHandler);
} }
} }
} }

View File

@ -114,7 +114,6 @@ public class ClassTree<KEY> {
* @param key the key for the new child * @param key the key for the new child
* @return the existing (or new) leaf * @return the existing (or new) leaf
*/ */
@SuppressWarnings("unchecked")
private private
ClassTree<KEY> getOrCreateLeaf(KEY key) { ClassTree<KEY> getOrCreateLeaf(KEY key) {
if (key == null) { if (key == null) {

View File

@ -22,5 +22,5 @@ import dorkbox.messagebus.common.MessageHandler;
*/ */
public public
interface SubscriptionFactory { interface SubscriptionFactory {
Subscription create(final Class<?> listenerClass, final MessageHandler handler); Subscription<?> create(final Class<?> listenerClass, final MessageHandler handler);
} }

View File

@ -34,7 +34,7 @@ class AsmFactory implements SubscriptionFactory {
@Override @Override
public public
Subscription create(final Class<?> listenerClass, final MessageHandler handler) { Subscription<?> create(final Class<?> listenerClass, final MessageHandler handler) {
// figure out what kind of references we want to use by default, as specified by MessageBus.useStrongReferencesByDefault // figure out what kind of references we want to use by default, as specified by MessageBus.useStrongReferencesByDefault
final int referenceType = handler.getReferenceType(); final int referenceType = handler.getReferenceType();
if (referenceType == MessageHandler.UNDEFINED) { if (referenceType == MessageHandler.UNDEFINED) {

View File

@ -54,7 +54,7 @@ class AsyncABQ implements Synchrony {
public public
AsyncABQ(final int numberOfThreads, final ErrorHandler errorHandler, final Synchrony syncPublication) { AsyncABQ(final int numberOfThreads, final ErrorHandler errorHandler) {
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
this.dispatchQueue = new ArrayBlockingQueue<MessageHolder>(1024); this.dispatchQueue = new ArrayBlockingQueue<MessageHolder>(1024);
@ -66,7 +66,6 @@ class AsyncABQ implements Synchrony {
public public
void run() { void run() {
final ArrayBlockingQueue<MessageHolder> IN_QUEUE = AsyncABQ.this.dispatchQueue; final ArrayBlockingQueue<MessageHolder> IN_QUEUE = AsyncABQ.this.dispatchQueue;
final Synchrony syncPublication1 = syncPublication;
final ErrorHandler errorHandler1 = errorHandler; final ErrorHandler errorHandler1 = errorHandler;
while (!AsyncABQ.this.shuttingDown) { while (!AsyncABQ.this.shuttingDown) {

View File

@ -58,7 +58,7 @@ class AsyncABQ_noGc implements Synchrony {
public public
AsyncABQ_noGc(final int numberOfThreads, final ErrorHandler errorHandler, final Synchrony syncPublication) { AsyncABQ_noGc(final int numberOfThreads, final ErrorHandler errorHandler) {
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
this.dispatchQueue = new ArrayBlockingQueue<MessageHolder>(1024); this.dispatchQueue = new ArrayBlockingQueue<MessageHolder>(1024);
@ -78,7 +78,6 @@ class AsyncABQ_noGc implements Synchrony {
final ArrayBlockingQueue<MessageHolder> IN_QUEUE = AsyncABQ_noGc.this.dispatchQueue; final ArrayBlockingQueue<MessageHolder> IN_QUEUE = AsyncABQ_noGc.this.dispatchQueue;
final ArrayBlockingQueue<MessageHolder> OUT_QUEUE = AsyncABQ_noGc.this.gcQueue; final ArrayBlockingQueue<MessageHolder> OUT_QUEUE = AsyncABQ_noGc.this.gcQueue;
final Synchrony syncPublication1 = syncPublication;
final ErrorHandler errorHandler1 = errorHandler; final ErrorHandler errorHandler1 = errorHandler;
while (!AsyncABQ_noGc.this.shuttingDown) { while (!AsyncABQ_noGc.this.shuttingDown) {

View File

@ -48,7 +48,7 @@ import java.util.concurrent.locks.LockSupport;
public final public final
class AsyncDisruptor implements Synchrony { class AsyncDisruptor implements Synchrony {
private final WorkProcessor[] workProcessors; private final WorkProcessor<MessageHolder>[] workProcessors;
private final MessageHandler[] handlers; private final MessageHandler[] handlers;
private final RingBuffer<MessageHolder> ringBuffer; private final RingBuffer<MessageHolder> ringBuffer;
private final Sequence workSequence; private final Sequence workSequence;

View File

@ -125,7 +125,6 @@ public class DeadMessageTest extends MessageBusTest{
} }
public static class DeadMessagHandler { public static class DeadMessagHandler {
@SuppressWarnings("unused")
@Handler @Handler
public void handle(DeadMessage message){ public void handle(DeadMessage message){
deadMessages.incrementAndGet(); deadMessages.incrementAndGet();

View File

@ -164,7 +164,6 @@ public class MetadataReaderTest extends AssertSupport {
} }
// a simple event listener // a simple event listener
@SuppressWarnings("unused")
public class MessageListener1 { public class MessageListener1 {
@Handler(acceptSubtypes = false) @Handler(acceptSubtypes = false)
@ -231,7 +230,6 @@ public class MetadataReaderTest extends AssertSupport {
validator.check(allHandlers); validator.check(allHandlers);
} }
@SuppressWarnings("unused")
public class MultiMessageListener1 { public class MultiMessageListener1 {
@Handler public void handleString1(String s) {} @Handler public void handleString1(String s) {}

View File

@ -82,7 +82,6 @@ public class MultiMessageTest extends MessageBusTest {
count.set(0); count.set(0);
} }
@SuppressWarnings("unused")
public static class MultiListener { public static class MultiListener {
@Handler @Handler
public void handleSync(Object o) { public void handleSync(Object o) {