jgroups: Update to version 5.0.0

This commit is contained in:
Owain van Brakel
2020-08-28 07:50:12 +02:00
parent 926132243a
commit fa6dc721bf
4 changed files with 70 additions and 49 deletions

View File

@@ -864,7 +864,7 @@ public class ConfigManager
try try
{ {
ConfigChanged configChanged = Util.objectFromByteBuffer(message.getBuffer()); ConfigChanged configChanged = Util.objectFromByteBuffer(message.getObject());
if (!configChanged.getPath().equals(settingsFileInput.getAbsolutePath())) if (!configChanged.getPath().equals(settingsFileInput.getAbsolutePath()))
{ {

View File

@@ -80,6 +80,7 @@ import net.runelite.client.task.Scheduler;
import net.runelite.client.ui.RuneLiteSplashScreen; import net.runelite.client.ui.RuneLiteSplashScreen;
import net.runelite.client.util.GameEventManager; import net.runelite.client.util.GameEventManager;
import net.runelite.client.util.Groups; import net.runelite.client.util.Groups;
import net.runelite.client.util.SwingUtil;
import org.jgroups.Message; import org.jgroups.Message;
import org.pf4j.Extension; import org.pf4j.Extension;
@@ -291,6 +292,7 @@ public class PluginManager
log.warn("Unable to reset plugin configuration", ex); log.warn("Unable to reset plugin configuration", ex);
} }
} }
public void loadCorePlugins() throws IOException public void loadCorePlugins() throws IOException
{ {
plugins.addAll(scanAndInstantiate(getClass().getClassLoader(), PLUGIN_PACKAGE, false)); plugins.addAll(scanAndInstantiate(getClass().getClassLoader(), PLUGIN_PACKAGE, false));
@@ -764,7 +766,10 @@ public class PluginManager
switch (command) switch (command)
{ {
case "STARTPLUGIN": case "STARTPLUGIN":
try
{
SwingUtil.syncExec(() ->
{
try try
{ {
startPlugin(finalPlugin); startPlugin(finalPlugin);
@@ -774,11 +779,20 @@ public class PluginManager
log.warn("unable to start plugin", e); log.warn("unable to start plugin", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
});
}
catch (InvocationTargetException | InterruptedException e)
{
log.error("eh?");
}
break; break;
case "STOPPLUGIN": case "STOPPLUGIN":
try
{
SwingUtil.syncExec(() ->
{
try try
{ {
stopPlugin(finalPlugin); stopPlugin(finalPlugin);
@@ -788,6 +802,12 @@ public class PluginManager
log.warn("unable to stop plugin", e); log.warn("unable to stop plugin", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
});
}
catch (InvocationTargetException | InterruptedException e)
{
log.error("eh?");
}
break; break;
} }

View File

@@ -22,13 +22,14 @@ import net.runelite.client.ui.RuneLiteSplashScreen;
import org.jgroups.Address; import org.jgroups.Address;
import org.jgroups.JChannel; import org.jgroups.JChannel;
import org.jgroups.Message; import org.jgroups.Message;
import org.jgroups.ReceiverAdapter; import org.jgroups.ObjectMessage;
import org.jgroups.Receiver;
import org.jgroups.View; import org.jgroups.View;
import org.jgroups.util.Util; import org.jgroups.util.Util;
@Slf4j @Slf4j
@Singleton @Singleton
public class Groups extends ReceiverAdapter public class Groups implements Receiver
{ {
private final OpenOSRSConfig openOSRSConfig; private final OpenOSRSConfig openOSRSConfig;
private final JChannel channel; private final JChannel channel;
@@ -38,7 +39,7 @@ public class Groups extends ReceiverAdapter
@Getter(AccessLevel.PUBLIC) @Getter(AccessLevel.PUBLIC)
private List<Address> members; private List<Address> members;
@Getter(AccessLevel.PUBLIC) @Getter(AccessLevel.PUBLIC)
private Map<String, List<Address>> messageMap = new HashMap<>(); private final Map<String, List<Address>> messageMap = new HashMap<>();
@Getter(AccessLevel.PUBLIC) @Getter(AccessLevel.PUBLIC)
private final PublishSubject<Message> messageStringSubject = PublishSubject.create(); private final PublishSubject<Message> messageStringSubject = PublishSubject.create();
@Getter(AccessLevel.PUBLIC) @Getter(AccessLevel.PUBLIC)
@@ -79,9 +80,9 @@ public class Groups extends ReceiverAdapter
try try
{ {
byte[] buffer = Util.objectToByteBuffer(configChanged); byte[] buffer = Util.objectToByteBuffer(configChanged);
Message message = new Message() Message message = new ObjectMessage()
.setDest(destination) .setDest(destination)
.setBuffer(buffer); .setObject(buffer);
channel.send(message); channel.send(message);
} }
@@ -119,7 +120,7 @@ public class Groups extends ReceiverAdapter
try try
{ {
channel.send(new Message(destination, command)); channel.send(new ObjectMessage(destination, command));
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -7,7 +7,7 @@
<config xmlns="urn:org:jgroups" <config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd" xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd"
version="4.2.4.Final"> version="5.0.0">
<UDP <UDP
bind_addr="127.0.0.1" bind_addr="127.0.0.1"
mcast_port="${jgroups.udp.mcast_port:45588}" mcast_port="${jgroups.udp.mcast_port:45588}"