Skip to content

Commit

Permalink
Only launch the auto-starter thread when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ME1312 committed Jan 30, 2019
1 parent 2bf26a1 commit d81e93b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Settings:
Version: '2.11.2a+'
Override-Bungee-Commands: true
Run-On-Launch-Timeout: 0
UPnP:
Forward-Proxy: true
Forward-SubData: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,14 +520,14 @@ public void reload() throws IOException {
System.out.println("SubServers > " + ((plugins > 0)?plugins+" Plugin"+((plugins == 1)?"":"s")+", ":"") + ((proxies > 1)?proxies+" Proxies, ":"") + hosts + " Host"+((hosts == 1)?"":"s")+", " + servers + " Server"+((servers == 1)?"":"s")+", and " + subservers + " SubServer"+((subservers == 1)?"":"s")+" "+((status)?"re":"")+"loaded in " + new DecimalFormat("0.000").format((Calendar.getInstance().getTime().getTime() - begin) / 1000D) + "s");

long scd = TimeUnit.SECONDS.toMillis(config.get().getSection("Settings").getLong("Run-On-Launch-Timeout", 0L));
for (Host host : api.getHosts().values()) {
new Thread(() -> {
if (autorun.size() > 0) for (Host host : api.getHosts().values()) {
List<String> ar = new LinkedList<String>();
for (String name : autorun) if (host.getSubServer(name) != null) ar.add(name);
if (ar.size() > 0) new Thread(() -> {
try {
while (running && begin == resetDate && !host.isAvailable()) {
Thread.sleep(250);
}
List<String> ar = new LinkedList<String>();
ar.addAll(autorun);
long init = Calendar.getInstance().getTime().getTime();
while (running && begin == resetDate && ar.size() > 0) {
SubServer server = host.getSubServer(ar.get(0));
Expand Down

0 comments on commit d81e93b

Please sign in to comment.