Browse Source

Update to MBassador 1.2.4.

This release contains some performance improvements compared
to the version we were using.

Error handlers are now passed in at construction time, so
there was a small bit of refactoring required.
pull/621/head
Chris Smith 8 years ago
parent
commit
1ad67b6c3f
2 changed files with 9 additions and 11 deletions
  1. 1
    1
      build.gradle
  2. 8
    10
      src/com/dmdirc/DMDircMBassador.java

+ 1
- 1
build.gradle View File

@@ -42,7 +42,7 @@ dependencies {
42 42
     bundle group: 'com.esotericsoftware.yamlbeans', name: 'yamlbeans', version: '1.08'
43 43
     bundle group: 'net.kencochrane.raven', name: 'raven', version: '6.0.0'
44 44
     bundle group: 'com.google.guava', name:'guava', version: '18.0'
45
-    bundle group: 'net.engio', name: 'mbassador', version: '1.2.0'
45
+    bundle group: 'net.engio', name: 'mbassador', version: '1.2.4'
46 46
     bundle group: 'com.dmdirc', name: 'util', version: '+', changing: true
47 47
     bundle group: 'com.dmdirc.parser', name: 'common', version: '+', changing: true
48 48
 

+ 8
- 10
src/com/dmdirc/DMDircMBassador.java View File

@@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
30 30
 import net.engio.mbassy.bus.MBassador;
31 31
 import net.engio.mbassy.bus.config.BusConfiguration;
32 32
 import net.engio.mbassy.bus.config.Feature;
33
+import net.engio.mbassy.bus.config.IBusConfiguration;
33 34
 
34 35
 import static com.dmdirc.util.LogUtils.APP_ERROR;
35 36
 
@@ -41,21 +42,18 @@ public class DMDircMBassador extends MBassador<DMDircEvent> {
41 42
     private static final Logger LOG = LoggerFactory.getLogger(DMDircMBassador.class);
42 43
 
43 44
     public DMDircMBassador() {
44
-        super(new BusConfiguration().addFeature(Feature.SyncPubSub.Default())
45
-                .addFeature(Feature.AsynchronousHandlerInvocation.Default(1, 1)).addFeature(
45
+        this(new BusConfiguration()
46
+                .addFeature(Feature.SyncPubSub.Default())
47
+                .addFeature(Feature.AsynchronousHandlerInvocation.Default(1, 1))
48
+                .addFeature(
46 49
                         Feature.AsynchronousMessageDispatch.Default()
47 50
                                 .setNumberOfMessageDispatchers(1)));
48
-        setupErrorHandler();
49 51
     }
50 52
 
51 53
     @SuppressWarnings("TypeMayBeWeakened")
52
-    public DMDircMBassador(final BusConfiguration configuration) {
53
-        super(configuration);
54
-        setupErrorHandler();
54
+    public DMDircMBassador(final IBusConfiguration configuration) {
55
+        super(configuration.addPublicationErrorHandler(
56
+                e -> LOG.error(APP_ERROR, "Error caused by event bus handler", e.getCause())));
55 57
     }
56 58
 
57
-    private void setupErrorHandler() {
58
-        addErrorHandler(e ->
59
-                LOG.error(APP_ERROR, "Error caused by event bus handler", e.getCause()));
60
-    }
61 59
 }

Loading…
Cancel
Save