diff --git a/src/main/java/dorkbox/util/messagebus/common/MessageHandler.java b/src/main/java/dorkbox/util/messagebus/common/MessageHandler.java index d10065c..4f818f8 100644 --- a/src/main/java/dorkbox/util/messagebus/common/MessageHandler.java +++ b/src/main/java/dorkbox/util/messagebus/common/MessageHandler.java @@ -3,6 +3,7 @@ package dorkbox.util.messagebus.common; import com.esotericsoftware.reflectasm.MethodAccess; import dorkbox.util.messagebus.annotations.Handler; import dorkbox.util.messagebus.annotations.Synchronized; +import dorkbox.util.messagebus.utils.ReflectionUtils; import java.lang.reflect.Method; import java.util.ArrayList; diff --git a/src/main/java/dorkbox/util/messagebus/common/thread/NamedThreadFactory.java b/src/main/java/dorkbox/util/messagebus/common/thread/NamedThreadFactory.java index 080296e..1934e1a 100644 --- a/src/main/java/dorkbox/util/messagebus/common/thread/NamedThreadFactory.java +++ b/src/main/java/dorkbox/util/messagebus/common/thread/NamedThreadFactory.java @@ -14,7 +14,7 @@ public class NamedThreadFactory implements ThreadFactory { /** * The stack size is arbitrary based on JVM implementation. Default is 0 * 8k is the size of the android stack. Depending on the version of android, this can either change, or will always be 8k - *
+ *
* To be honest, 8k is pretty reasonable for an asynchronous/event based system (32bit) or 16k (64bit) * Setting the size MAY or MAY NOT have any effect!!! *
@@ -42,12 +42,14 @@ public class NamedThreadFactory implements ThreadFactory {
if (stackSize != null) {
int value = 0;
if (stackSize.endsWith("k")) {
- stackSize = stackSize.substring(4, stackSize.length()-1);
+ stackSize = stackSize.substring(4, stackSize.length() - 1);
value = Integer.parseInt(stackSize) * 1024;
- } else if (stackSize.endsWith("m")) {
- stackSize = stackSize.substring(4, stackSize.length()-1);
+ }
+ else if (stackSize.endsWith("m")) {
+ stackSize = stackSize.substring(4, stackSize.length() - 1);
value = Integer.parseInt(stackSize) * 1024 * 1024;
- } else {
+ }
+ else {
try {
value = Integer.parseInt(stackSize.substring(4));
} catch (Exception e) {
@@ -55,7 +57,8 @@ public class NamedThreadFactory implements ThreadFactory {
}
stackSizeForThreads = value;
- } else {
+ }
+ else {
stackSizeForThreads = 8192;
}
}
@@ -81,7 +84,7 @@ public class NamedThreadFactory implements ThreadFactory {
}
public Thread newThread(String name, Runnable r) {
- // stack size is arbitrary based on JVM implementation. Default is 0
+ // stack size is arbitrary based on JVM implementation. Default is 0
// 8k is the size of the android stack. Depending on the version of android, this can either change, or will always be 8k
// To be honest, 8k is pretty reasonable for an asynchronous/event based system (32bit) or 16k (64bit)
// Setting the size MAY or MAY NOT have any effect!!!
diff --git a/src/main/java/dorkbox/util/messagebus/subscription/SubscriptionManager.java b/src/main/java/dorkbox/util/messagebus/subscription/SubscriptionManager.java
index 60d03c6..fb86b0a 100644
--- a/src/main/java/dorkbox/util/messagebus/subscription/SubscriptionManager.java
+++ b/src/main/java/dorkbox/util/messagebus/subscription/SubscriptionManager.java
@@ -1,6 +1,12 @@
package dorkbox.util.messagebus.subscription;
-import dorkbox.util.messagebus.common.*;
+import dorkbox.util.messagebus.common.ConcurrentHashMapV8;
+import dorkbox.util.messagebus.common.DeadMessage;
+import dorkbox.util.messagebus.common.HashMapTree;
+import dorkbox.util.messagebus.common.MessageHandler;
+import dorkbox.util.messagebus.utils.ClassUtils;
+import dorkbox.util.messagebus.utils.SubscriptionUtils;
+import dorkbox.util.messagebus.utils.VarArgUtils;
import java.lang.reflect.Array;
import java.util.ArrayList;
diff --git a/src/main/java/dorkbox/util/messagebus/utils/ReflectionUtils.java b/src/main/java/dorkbox/util/messagebus/utils/ReflectionUtils.java
index a24bbcc..caa7dc0 100644
--- a/src/main/java/dorkbox/util/messagebus/utils/ReflectionUtils.java
+++ b/src/main/java/dorkbox/util/messagebus/utils/ReflectionUtils.java
@@ -44,21 +44,20 @@ public class ReflectionUtils {
}
/**
- * Traverses the class hierarchy upwards, starting at the given subclass, looking
- * for an override of the given methods -> finds the bottom most override of the given
- * method if any exists
- *
- * @param overridingMethod
- * @param subclass
- * @return
- */
- public static Method getOverridingMethod( final Method overridingMethod, final Class> subclass ) {
+ * Traverses the class hierarchy upwards, starting at the given subclass, looking
+ * for an override of the given methods -> finds the bottom most override of the given
+ * method if any exists
+ *
+ * @param overridingMethod
+ * @param subclass
+ * @return
+ */
+ public static Method getOverridingMethod(final Method overridingMethod, final Class> subclass) {
Class> current = subclass;
- while ( !current.equals( overridingMethod.getDeclaringClass() ) ) {
+ while (!current.equals(overridingMethod.getDeclaringClass())) {
try {
- return current.getDeclaredMethod( overridingMethod.getName(), overridingMethod.getParameterTypes() );
- }
- catch ( NoSuchMethodException e ) {
+ return current.getDeclaredMethod(overridingMethod.getName(), overridingMethod.getParameterTypes());
+ } catch (NoSuchMethodException e) {
current = current.getSuperclass();
}
}
@@ -75,12 +74,12 @@ public class ReflectionUtils {
public static Class>[] getSuperTypes(Class> from) {
ArrayList