Wip cleaning iterators
This commit is contained in:
parent
f746615536
commit
060a00f875
|
@ -93,12 +93,12 @@ public class MultiMBassador implements IMessageBus {
|
|||
try {
|
||||
while (true) {
|
||||
IN_QUEUE.take(node);
|
||||
|
||||
switch (node.messageType) {
|
||||
case 1: publish(node.item1); continue;
|
||||
case 2: publish(node.item1, node.item2); continue;
|
||||
case 3: publish(node.item1, node.item2, node.item3); continue;
|
||||
}
|
||||
publish(node.item1);
|
||||
// switch (node.messageType) {
|
||||
// case 1: publish(node.item1); continue;
|
||||
// case 2: publish(node.item1, node.item2); continue;
|
||||
// case 3: publish(node.item1, node.item2, node.item3); continue;
|
||||
// }
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
if (!MultiMBassador.this.shuttingDown) {
|
||||
|
@ -189,7 +189,7 @@ public class MultiMBassador implements IMessageBus {
|
|||
Subscription sub;
|
||||
|
||||
// Run subscriptions
|
||||
if (subscriptions != null && !subscriptions.isEmpty()) {
|
||||
if (subscriptions != null) {
|
||||
current = subscriptions.head;
|
||||
while (current != null) {
|
||||
sub = current.getValue();
|
||||
|
@ -203,7 +203,7 @@ public class MultiMBassador implements IMessageBus {
|
|||
if (!this.forceExactMatches) {
|
||||
StrongConcurrentSetV8<Subscription> superSubscriptions = manager.getSuperSubscriptions(messageClass);
|
||||
// now get superClasses
|
||||
if (superSubscriptions != null && !superSubscriptions.isEmpty()) {
|
||||
if (superSubscriptions != null) {
|
||||
current = superSubscriptions.head;
|
||||
while (current != null) {
|
||||
sub = current.getValue();
|
||||
|
@ -286,7 +286,7 @@ public class MultiMBassador implements IMessageBus {
|
|||
Subscription sub;
|
||||
|
||||
// Run subscriptions
|
||||
if (subscriptions != null && !subscriptions.isEmpty()) {
|
||||
if (subscriptions != null) {
|
||||
current = subscriptions.head;
|
||||
while (current != null) {
|
||||
sub = current.getValue();
|
||||
|
@ -300,7 +300,7 @@ public class MultiMBassador implements IMessageBus {
|
|||
if (!this.forceExactMatches) {
|
||||
StrongConcurrentSetV8<Subscription> superSubscriptions = manager.getSuperSubscriptions(messageClass1, messageClass2);
|
||||
// now get superClasses
|
||||
if (superSubscriptions != null && !superSubscriptions.isEmpty()) {
|
||||
if (superSubscriptions != null) {
|
||||
current = superSubscriptions.head;
|
||||
while (current != null) {
|
||||
sub = current.getValue();
|
||||
|
@ -407,7 +407,7 @@ public class MultiMBassador implements IMessageBus {
|
|||
Subscription sub;
|
||||
|
||||
// Run subscriptions
|
||||
if (subscriptions != null && !subscriptions.isEmpty()) {
|
||||
if (subscriptions != null) {
|
||||
current = subscriptions.head;
|
||||
while (current != null) {
|
||||
sub = current.getValue();
|
||||
|
@ -422,7 +422,7 @@ public class MultiMBassador implements IMessageBus {
|
|||
if (!this.forceExactMatches) {
|
||||
StrongConcurrentSetV8<Subscription> superSubscriptions = manager.getSuperSubscriptions(messageClass1, messageClass2, messageClass3);
|
||||
// now get superClasses
|
||||
if (superSubscriptions != null && !superSubscriptions.isEmpty()) {
|
||||
if (superSubscriptions != null) {
|
||||
current = superSubscriptions.head;
|
||||
while (current != null) {
|
||||
sub = current.getValue();
|
||||
|
|
|
@ -401,7 +401,7 @@ public class SubscriptionManager {
|
|||
Subscription sub;
|
||||
|
||||
StrongConcurrentSetV8<Subscription> subs = local2.get(arrayVersion);
|
||||
if (subs != null && !subs.isEmpty()) {
|
||||
if (subs != null) {
|
||||
current = subs.head;
|
||||
while (current != null) {
|
||||
sub = current.getValue();
|
||||
|
@ -436,7 +436,7 @@ public class SubscriptionManager {
|
|||
StrongConcurrentSetV8<Class<?>> types = getSuperClasses(arrayVersion);
|
||||
if (types.isEmpty()) {
|
||||
local.put(varArgType, EMPTY_SUBS);
|
||||
return null;
|
||||
return EMPTY_SUBS;
|
||||
}
|
||||
|
||||
Map<Class<?>, StrongConcurrentSetV8<Subscription>> local2 = this.subscriptionsPerMessageSingle;
|
||||
|
@ -447,14 +447,14 @@ public class SubscriptionManager {
|
|||
|
||||
ISetEntry<Class<?>> current1;
|
||||
Class<?> superClass;
|
||||
current1 = types.head;
|
||||
|
||||
current1 = types.head;
|
||||
while (current1 != null) {
|
||||
superClass = current1.getValue();
|
||||
current1 = current1.next();
|
||||
|
||||
StrongConcurrentSetV8<Subscription> subs = local2.get(superClass);
|
||||
if (subs != null && !subs.isEmpty()) {
|
||||
if (subs != null) {
|
||||
current = subs.head;
|
||||
while (current != null) {
|
||||
sub = current.getValue();
|
||||
|
@ -552,6 +552,7 @@ public class SubscriptionManager {
|
|||
}
|
||||
|
||||
|
||||
// CAN NOT RETURN NULL
|
||||
// ALSO checks to see if the superClass accepts subtypes.
|
||||
public final StrongConcurrentSetV8<Subscription> getSuperSubscriptions(Class<?> superType) {
|
||||
Map<Class<?>, StrongConcurrentSetV8<Subscription>> local = this.superClassSubscriptions;
|
||||
|
@ -564,7 +565,7 @@ public class SubscriptionManager {
|
|||
StrongConcurrentSetV8<Class<?>> types = getSuperClasses(superType);
|
||||
if (types.isEmpty()) {
|
||||
local.put(superType, EMPTY_SUBS);
|
||||
return null;
|
||||
return EMPTY_SUBS;
|
||||
}
|
||||
|
||||
Map<Class<?>, StrongConcurrentSetV8<Subscription>> local2 = this.subscriptionsPerMessageSingle;
|
||||
|
@ -582,7 +583,7 @@ public class SubscriptionManager {
|
|||
current1 = current1.next();
|
||||
|
||||
StrongConcurrentSetV8<Subscription> subs = local2.get(superClass);
|
||||
if (subs != null && !subs.isEmpty()) {
|
||||
if (subs != null) {
|
||||
current = subs.head;
|
||||
while (current != null) {
|
||||
sub = current.getValue();
|
||||
|
|
|
@ -94,7 +94,7 @@ public class Subscription {
|
|||
|
||||
public int count =0;
|
||||
public int getCount() {
|
||||
return count;
|
||||
return this.count;
|
||||
}
|
||||
/**
|
||||
* @return true if there were listeners for this publication, false if there was nothing
|
||||
|
@ -113,43 +113,43 @@ public class Subscription {
|
|||
while (current != null) {
|
||||
listener = current.getValue();
|
||||
current = current.next();
|
||||
count++;
|
||||
// try {
|
||||
// invocation.invoke(listener, handler, handleIndex, message);
|
||||
// } catch (IllegalAccessException e) {
|
||||
// errorHandler.handlePublicationError(new PublicationError()
|
||||
// .setMessage("Error during invocation of message handler. " +
|
||||
// "The class or method is not accessible")
|
||||
// .setCause(e)
|
||||
// .setMethodName(handler.getMethodNames()[handleIndex])
|
||||
// .setListener(listener)
|
||||
// .setPublishedObject(message));
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// errorHandler.handlePublicationError(new PublicationError()
|
||||
// .setMessage("Error during invocation of message handler. " +
|
||||
// "Wrong arguments passed to method. Was: " + message.getClass()
|
||||
// + "Expected: " + handler.getParameterTypes()[0])
|
||||
// .setCause(e)
|
||||
// .setMethodName(handler.getMethodNames()[handleIndex])
|
||||
// .setListener(listener)
|
||||
// .setPublishedObject(message));
|
||||
// } catch (InvocationTargetException e) {
|
||||
// errorHandler.handlePublicationError(new PublicationError()
|
||||
// .setMessage("Error during invocation of message handler. " +
|
||||
// "Message handler threw exception")
|
||||
// .setCause(e)
|
||||
// .setMethodName(handler.getMethodNames()[handleIndex])
|
||||
// .setListener(listener)
|
||||
// .setPublishedObject(message));
|
||||
// } catch (Throwable e) {
|
||||
// errorHandler.handlePublicationError(new PublicationError()
|
||||
// .setMessage("Error during invocation of message handler. " +
|
||||
// "The handler code threw an exception")
|
||||
// .setCause(e)
|
||||
// .setMethodName(handler.getMethodNames()[handleIndex])
|
||||
// .setListener(listener)
|
||||
// .setPublishedObject(message));
|
||||
// }
|
||||
//count++;
|
||||
try {
|
||||
invocation.invoke(listener, handler, handleIndex, message);
|
||||
} catch (IllegalAccessException e) {
|
||||
errorHandler.handlePublicationError(new PublicationError()
|
||||
.setMessage("Error during invocation of message handler. " +
|
||||
"The class or method is not accessible")
|
||||
.setCause(e)
|
||||
.setMethodName(handler.getMethodNames()[handleIndex])
|
||||
.setListener(listener)
|
||||
.setPublishedObject(message));
|
||||
} catch (IllegalArgumentException e) {
|
||||
errorHandler.handlePublicationError(new PublicationError()
|
||||
.setMessage("Error during invocation of message handler. " +
|
||||
"Wrong arguments passed to method. Was: " + message.getClass()
|
||||
+ "Expected: " + handler.getParameterTypes()[0])
|
||||
.setCause(e)
|
||||
.setMethodName(handler.getMethodNames()[handleIndex])
|
||||
.setListener(listener)
|
||||
.setPublishedObject(message));
|
||||
} catch (InvocationTargetException e) {
|
||||
errorHandler.handlePublicationError(new PublicationError()
|
||||
.setMessage("Error during invocation of message handler. " +
|
||||
"Message handler threw exception")
|
||||
.setCause(e)
|
||||
.setMethodName(handler.getMethodNames()[handleIndex])
|
||||
.setListener(listener)
|
||||
.setPublishedObject(message));
|
||||
} catch (Throwable e) {
|
||||
errorHandler.handlePublicationError(new PublicationError()
|
||||
.setMessage("Error during invocation of message handler. " +
|
||||
"The handler code threw an exception")
|
||||
.setCause(e)
|
||||
.setMethodName(handler.getMethodNames()[handleIndex])
|
||||
.setListener(listener)
|
||||
.setPublishedObject(message));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user