jgroups: Update to version 5.0.0
This commit is contained in:
@@ -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()))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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));
|
||||||
@@ -416,44 +418,44 @@ public class PluginManager
|
|||||||
|
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
|
|
||||||
List<Plugin> scannedPlugins = new CopyOnWriteArrayList<>();
|
List<Plugin> scannedPlugins = new CopyOnWriteArrayList<>();
|
||||||
sortedPlugins.forEach(group ->
|
sortedPlugins.forEach(group ->
|
||||||
{
|
{
|
||||||
List<Future<?>> curGroup = new ArrayList<>();
|
List<Future<?>> curGroup = new ArrayList<>();
|
||||||
group.forEach(pluginClazz ->
|
group.forEach(pluginClazz ->
|
||||||
curGroup.add(executorService.submit(() ->
|
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 ->
|
|
||||||
{
|
{
|
||||||
|
Plugin plugin;
|
||||||
try
|
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);
|
loaded.getAndIncrement();
|
||||||
return scannedPlugins;
|
|
||||||
|
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
|
public boolean startPlugin(Plugin plugin) throws PluginInstantiationException
|
||||||
@@ -764,29 +766,47 @@ public class PluginManager
|
|||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case "STARTPLUGIN":
|
case "STARTPLUGIN":
|
||||||
|
|
||||||
try
|
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);
|
log.error("eh?");
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "STOPPLUGIN":
|
case "STOPPLUGIN":
|
||||||
|
|
||||||
try
|
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);
|
log.error("eh?");
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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}"
|
||||||
|
|||||||
Reference in New Issue
Block a user