jgroups: Update to version 5.0.0
This commit is contained in:
@@ -864,7 +864,7 @@ public class ConfigManager
|
||||
|
||||
try
|
||||
{
|
||||
ConfigChanged configChanged = Util.objectFromByteBuffer(message.getBuffer());
|
||||
ConfigChanged configChanged = Util.objectFromByteBuffer(message.getObject());
|
||||
|
||||
if (!configChanged.getPath().equals(settingsFileInput.getAbsolutePath()))
|
||||
{
|
||||
|
||||
@@ -80,6 +80,7 @@ import net.runelite.client.task.Scheduler;
|
||||
import net.runelite.client.ui.RuneLiteSplashScreen;
|
||||
import net.runelite.client.util.GameEventManager;
|
||||
import net.runelite.client.util.Groups;
|
||||
import net.runelite.client.util.SwingUtil;
|
||||
import org.jgroups.Message;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
@@ -291,6 +292,7 @@ public class PluginManager
|
||||
log.warn("Unable to reset plugin configuration", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCorePlugins() throws IOException
|
||||
{
|
||||
plugins.addAll(scanAndInstantiate(getClass().getClassLoader(), PLUGIN_PACKAGE, false));
|
||||
@@ -416,44 +418,44 @@ public class PluginManager
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
List<Plugin> scannedPlugins = new CopyOnWriteArrayList<>();
|
||||
sortedPlugins.forEach(group ->
|
||||
{
|
||||
List<Future<?>> curGroup = new ArrayList<>();
|
||||
group.forEach(pluginClazz ->
|
||||
curGroup.add(executorService.submit(() ->
|
||||
{
|
||||
Plugin plugin;
|
||||
try
|
||||
{
|
||||
plugin = instantiate(scannedPlugins, (Class<Plugin>) pluginClazz);
|
||||
scannedPlugins.add(plugin);
|
||||
}
|
||||
catch (PluginInstantiationException e)
|
||||
{
|
||||
log.warn("Error instantiating plugin!", e);
|
||||
return;
|
||||
}
|
||||
|
||||
loaded.getAndIncrement();
|
||||
|
||||
RuneLiteSplashScreen.stage(.60, .65, "Loading internal plugins", loaded.get(), scannedPlugins.size());
|
||||
})));
|
||||
curGroup.forEach(future ->
|
||||
List<Plugin> scannedPlugins = new CopyOnWriteArrayList<>();
|
||||
sortedPlugins.forEach(group ->
|
||||
{
|
||||
List<Future<?>> curGroup = new ArrayList<>();
|
||||
group.forEach(pluginClazz ->
|
||||
curGroup.add(executorService.submit(() ->
|
||||
{
|
||||
Plugin plugin;
|
||||
try
|
||||
{
|
||||
future.get();
|
||||
plugin = instantiate(scannedPlugins, (Class<Plugin>) pluginClazz);
|
||||
scannedPlugins.add(plugin);
|
||||
}
|
||||
catch (InterruptedException | ExecutionException e)
|
||||
catch (PluginInstantiationException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
log.warn("Error instantiating plugin!", e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
log.info("Plugin instantiation took {}ms", System.currentTimeMillis() - start);
|
||||
return scannedPlugins;
|
||||
loaded.getAndIncrement();
|
||||
|
||||
RuneLiteSplashScreen.stage(.60, .65, "Loading internal plugins", loaded.get(), scannedPlugins.size());
|
||||
})));
|
||||
curGroup.forEach(future ->
|
||||
{
|
||||
try
|
||||
{
|
||||
future.get();
|
||||
}
|
||||
catch (InterruptedException | ExecutionException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
log.info("Plugin instantiation took {}ms", System.currentTimeMillis() - start);
|
||||
return scannedPlugins;
|
||||
}
|
||||
|
||||
public boolean startPlugin(Plugin plugin) throws PluginInstantiationException
|
||||
@@ -764,29 +766,47 @@ public class PluginManager
|
||||
switch (command)
|
||||
{
|
||||
case "STARTPLUGIN":
|
||||
|
||||
try
|
||||
{
|
||||
startPlugin(finalPlugin);
|
||||
SwingUtil.syncExec(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
startPlugin(finalPlugin);
|
||||
}
|
||||
catch (PluginInstantiationException e)
|
||||
{
|
||||
log.warn("unable to start plugin", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (PluginInstantiationException e)
|
||||
catch (InvocationTargetException | InterruptedException e)
|
||||
{
|
||||
log.warn("unable to start plugin", e);
|
||||
throw new RuntimeException(e);
|
||||
log.error("eh?");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "STOPPLUGIN":
|
||||
|
||||
try
|
||||
{
|
||||
stopPlugin(finalPlugin);
|
||||
SwingUtil.syncExec(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
stopPlugin(finalPlugin);
|
||||
}
|
||||
catch (PluginInstantiationException e)
|
||||
{
|
||||
log.warn("unable to stop plugin", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (PluginInstantiationException e)
|
||||
catch (InvocationTargetException | InterruptedException e)
|
||||
{
|
||||
log.warn("unable to stop plugin", e);
|
||||
throw new RuntimeException(e);
|
||||
log.error("eh?");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -22,13 +22,14 @@ import net.runelite.client.ui.RuneLiteSplashScreen;
|
||||
import org.jgroups.Address;
|
||||
import org.jgroups.JChannel;
|
||||
import org.jgroups.Message;
|
||||
import org.jgroups.ReceiverAdapter;
|
||||
import org.jgroups.ObjectMessage;
|
||||
import org.jgroups.Receiver;
|
||||
import org.jgroups.View;
|
||||
import org.jgroups.util.Util;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class Groups extends ReceiverAdapter
|
||||
public class Groups implements Receiver
|
||||
{
|
||||
private final OpenOSRSConfig openOSRSConfig;
|
||||
private final JChannel channel;
|
||||
@@ -38,7 +39,7 @@ public class Groups extends ReceiverAdapter
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private List<Address> members;
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private Map<String, List<Address>> messageMap = new HashMap<>();
|
||||
private final Map<String, List<Address>> messageMap = new HashMap<>();
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private final PublishSubject<Message> messageStringSubject = PublishSubject.create();
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
@@ -79,9 +80,9 @@ public class Groups extends ReceiverAdapter
|
||||
try
|
||||
{
|
||||
byte[] buffer = Util.objectToByteBuffer(configChanged);
|
||||
Message message = new Message()
|
||||
Message message = new ObjectMessage()
|
||||
.setDest(destination)
|
||||
.setBuffer(buffer);
|
||||
.setObject(buffer);
|
||||
|
||||
channel.send(message);
|
||||
}
|
||||
@@ -119,7 +120,7 @@ public class Groups extends ReceiverAdapter
|
||||
|
||||
try
|
||||
{
|
||||
channel.send(new Message(destination, command));
|
||||
channel.send(new ObjectMessage(destination, command));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<config xmlns="urn:org:jgroups"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd"
|
||||
version="4.2.4.Final">
|
||||
version="5.0.0">
|
||||
<UDP
|
||||
bind_addr="127.0.0.1"
|
||||
mcast_port="${jgroups.udp.mcast_port:45588}"
|
||||
|
||||
Reference in New Issue
Block a user