Skip to content

Commit

Permalink
Merge pull request #2 from Hippo/development
Browse files Browse the repository at this point in the history
Numerous improvements
  • Loading branch information
Hippo authored Nov 22, 2020
2 parents 200fddf + 7cfc101 commit 4a9911a
Show file tree
Hide file tree
Showing 58 changed files with 449 additions and 420 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
*/
plugins {
id 'java'
id 'maven'
id 'maven-publish'
}

group 'com.github.Hippah'
version '5.1.0'
group 'rip.hippo'
version '5.1.1'

sourceCompatibility = 1.8

Expand All @@ -30,8 +29,9 @@ repositories {
}

dependencies {
compile group: 'org.ow2.asm', name: 'asm', version: '7.1'
compile group: 'org.ow2.asm', name: 'asm-tree', version: '7.1'
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'org.ow2.asm', name: 'asm', version: '9.0'
compile group: 'org.ow2.asm', name: 'asm-tree', version: '9.0'
}

publishing {
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
21 changes: 3 additions & 18 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -64,29 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
*
*/

package me.hippo.api.lwjeb.annotation;
package rip.hippo.lwjeb.annotation;


import me.hippo.api.lwjeb.filter.MessageFilter;
import me.hippo.api.lwjeb.message.handler.MessageHandler;
import rip.hippo.lwjeb.filter.MessageFilter;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.function.Predicate;

/**
* @author Hippo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package me.hippo.api.lwjeb.annotation;
package rip.hippo.lwjeb.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package me.hippo.api.lwjeb.annotation;
package rip.hippo.lwjeb.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*
*/

package me.hippo.api.lwjeb.bus;
package rip.hippo.lwjeb.bus;

import me.hippo.api.lwjeb.bus.publish.AsynchronousPublishMessageBus;
import me.hippo.api.lwjeb.bus.subscribe.SubscribeMessageBus;
import me.hippo.api.lwjeb.configuration.BusConfigurations;
import me.hippo.api.lwjeb.configuration.config.impl.AsynchronousPublicationConfiguration;
import me.hippo.api.lwjeb.configuration.config.impl.BusConfiguration;
import me.hippo.api.lwjeb.configuration.config.impl.ExceptionHandlingConfiguration;
import me.hippo.api.lwjeb.message.result.MessagePublicationResult;
import rip.hippo.lwjeb.bus.publish.AsynchronousPublishMessageBus;
import rip.hippo.lwjeb.bus.subscribe.SubscribeMessageBus;
import rip.hippo.lwjeb.configuration.BusConfigurations;
import rip.hippo.lwjeb.configuration.config.impl.AsynchronousPublicationConfiguration;
import rip.hippo.lwjeb.configuration.config.impl.BusConfiguration;
import rip.hippo.lwjeb.configuration.config.impl.ExceptionHandlingConfiguration;
import rip.hippo.lwjeb.message.result.MessagePublicationResult;

import java.util.*;
import java.util.concurrent.*;
Expand Down Expand Up @@ -108,7 +108,8 @@ public void setupDispatchers() {
}
}
});
thread.setName(String.format("(%s) Dispatch - %d", getIdentifier(), i));
thread.setName(String.format("(%s) Dispatch - %d", busConfiguration.getIdentifier(), i));
thread.setDaemon(asynchronousPublicationConfiguration.useDaemonThreads());
thread.start();
dispatchers.add(thread);
}
Expand Down Expand Up @@ -148,7 +149,7 @@ public void shutdown(int delay, TimeUnit timeUnit) {
for (Thread dispatcher : dispatchers) {
dispatcher.interrupt();
}
}, String.format("(%s) Shutdown", getIdentifier())).start();
}, String.format("(%s) Shutdown", busConfiguration.getIdentifier())).start();
}, delay, timeUnit);
scheduledExecutorService.shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*
*/

package me.hippo.api.lwjeb.bus;
package rip.hippo.lwjeb.bus;

import me.hippo.api.lwjeb.configuration.BusConfigurations;
import rip.hippo.lwjeb.configuration.BusConfigurations;

/**
* @author Hippo
Expand All @@ -34,13 +34,4 @@ public interface MessageBus {
* @return
*/
BusConfigurations getConfigurations();

/**
* Gets the identifier, you can use this to identify multiple different busses.
*
* @return The identifier.
*/
default String getIdentifier() {
return "LWJEB";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*
*/

package me.hippo.api.lwjeb.bus;
package rip.hippo.lwjeb.bus;

import me.hippo.api.lwjeb.configuration.BusConfigurations;
import me.hippo.api.lwjeb.configuration.config.impl.BusPubSubConfiguration;
import me.hippo.api.lwjeb.message.publish.MessagePublisher;
import me.hippo.api.lwjeb.message.result.MessagePublicationResult;
import me.hippo.api.lwjeb.subscribe.ListenerSubscriber;
import rip.hippo.lwjeb.configuration.BusConfigurations;
import rip.hippo.lwjeb.configuration.config.impl.BusPubSubConfiguration;
import rip.hippo.lwjeb.message.publish.MessagePublisher;
import rip.hippo.lwjeb.message.result.MessagePublicationResult;
import rip.hippo.lwjeb.subscribe.ListenerSubscriber;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*
*/

package me.hippo.api.lwjeb.bus.publish;
package rip.hippo.lwjeb.bus.publish;


import me.hippo.api.lwjeb.message.result.MessagePublicationResult;
import rip.hippo.lwjeb.message.result.MessagePublicationResult;

import java.util.concurrent.TimeUnit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*
*/

package me.hippo.api.lwjeb.bus.publish;
package rip.hippo.lwjeb.bus.publish;

import me.hippo.api.lwjeb.bus.MessageBus;
import me.hippo.api.lwjeb.message.publish.MessagePublisher;
import rip.hippo.lwjeb.bus.MessageBus;
import rip.hippo.lwjeb.message.publish.MessagePublisher;

/**
* @author Hippo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*
*/

package me.hippo.api.lwjeb.bus.subscribe;
package rip.hippo.lwjeb.bus.subscribe;

import me.hippo.api.lwjeb.bus.MessageBus;
import me.hippo.api.lwjeb.subscribe.ListenerSubscriber;
import rip.hippo.lwjeb.bus.MessageBus;
import rip.hippo.lwjeb.subscribe.ListenerSubscriber;

/**
* @author Hippo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
*
*/

package me.hippo.api.lwjeb.configuration;
package rip.hippo.lwjeb.configuration;


import me.hippo.api.lwjeb.configuration.config.Configuration;
import me.hippo.api.lwjeb.configuration.config.impl.*;
import me.hippo.api.lwjeb.configuration.exception.BusConfigurationException;
import rip.hippo.lwjeb.configuration.config.Configuration;
import rip.hippo.lwjeb.configuration.exception.BusConfigurationException;
import rip.hippo.lwjeb.configuration.config.impl.AsynchronousPublicationConfiguration;
import rip.hippo.lwjeb.configuration.config.impl.BusConfiguration;
import rip.hippo.lwjeb.configuration.config.impl.BusPubSubConfiguration;
import rip.hippo.lwjeb.configuration.config.impl.ExceptionHandlingConfiguration;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package me.hippo.api.lwjeb.configuration.config;
package rip.hippo.lwjeb.configuration.config;

/**
* @author Hippo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*
*/

package me.hippo.api.lwjeb.configuration.config.impl;
package rip.hippo.lwjeb.configuration.config.impl;

import me.hippo.api.lwjeb.configuration.config.Configuration;
import rip.hippo.lwjeb.configuration.config.Configuration;

/**
* @author Hippo
Expand All @@ -38,6 +38,11 @@ public final class AsynchronousPublicationConfiguration implements Configuration
*/
private boolean suppressDispatcherInterrupt;

/**
* Weather to use daemon threads.
*/
private boolean daemonThreads;

/**
* Gets the default configuration.
*
Expand All @@ -55,6 +60,7 @@ public AsynchronousPublicationConfiguration provideDefault() {
AsynchronousPublicationConfiguration configuration = new AsynchronousPublicationConfiguration();
configuration.setDispatcherCount(3);
configuration.setSuppressDispatcherInterrupt(true);
configuration.setDaemonThreads(false);
return configuration;
}

Expand Down Expand Up @@ -97,4 +103,22 @@ public boolean isSuppressDispatcherInterrupt() {
public void setSuppressDispatcherInterrupt(boolean suppressDispatcherInterrupt) {
this.suppressDispatcherInterrupt = suppressDispatcherInterrupt;
}

/**
* Gets weather to use daemon threads.
*
* @return If the threads should be daemon.
*/
public boolean useDaemonThreads() {
return daemonThreads;
}

/**
* Sets weather the bus should be use daemon threads.
*
* @param daemonThreads If they should use daemon threads.
*/
public void setDaemonThreads(boolean daemonThreads) {
this.daemonThreads = daemonThreads;
}
}
Loading

0 comments on commit 4a9911a

Please sign in to comment.