Attempt to free up ram usage after every ~4000 log lines

This commit is contained in:
ME1312 2019-01-03 00:48:15 -05:00
parent c05f5131b5
commit 4d1d266807
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
10 changed files with 38 additions and 13 deletions

View File

@ -134,6 +134,9 @@ public class ExternalSubLogger extends SubLogger {
writer.println(line);
writer.flush();
}
gc++;
gc();
}
}

View File

@ -125,6 +125,9 @@ public class InternalSubLogger extends SubLogger {
writer.println(line);
writer.flush();
}
gc++;
gc();
}
}
} catch (IOException e) {} finally {

View File

@ -1,16 +1,20 @@
package net.ME1312.SubServers.Bungee.Host;
import net.ME1312.SubServers.Bungee.Library.Util;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
/**
* SubLogger Layout Class
*/
public abstract class SubLogger {
public static final int MAX_GC = Integer.getInteger("subservers.logging.max_gc", 4096);
private static boolean gc_running = false;
protected static int gc = 0;
protected static void gc() {
if (!gc_running && MAX_GC > 0 && gc >= MAX_GC) {
gc_running = true;
System.gc();
gc = 0;
gc_running = false;
}
}
/**
* Gets the Name of the task logging

View File

@ -57,7 +57,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
public final SubAPI api = new SubAPI(this);
public SubDataServer subdata = null;
public SubServer sudo = null;
public static final Version version = Version.fromString("2.13.2b");
public static final Version version = Version.fromString("2.13.2c");
public Proxy redis = null;
public boolean canSudo = false;

View File

@ -1,6 +1,6 @@
name: 'SubServers-Client-Bukkit'
main: 'net.ME1312.SubServers.Client.Bukkit.SubPlugin'
version: '2.13.2b'
version: '2.13.2c'
authors: [ME1312]
softdepend: [Vault, TitleManager]
website: 'https://github.com/ME1312/SubServers-2'

View File

@ -46,7 +46,7 @@ import java.util.concurrent.TimeUnit;
/**
* SubServers Client Plugin Class
*/
@Plugin(id = "subservers-client-sponge", name = "SubServers-Client-Sponge", authors = "ME1312", version = "2.13.2b", url = "https://github.com/ME1312/SubServers-2", description = "Access your SubServers from Anywhere")
@Plugin(id = "subservers-client-sponge", name = "SubServers-Client-Sponge", authors = "ME1312", version = "2.13.2c", url = "https://github.com/ME1312/SubServers-2", description = "Access your SubServers from Anywhere")
public final class SubPlugin {
protected NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
public YAMLConfig config;

View File

@ -20,7 +20,7 @@
<dependency>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId>
<version>18w51a</version>
<version>19w01a</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -34,7 +34,7 @@ import java.util.jar.Manifest;
/**
* SubServers.Host Main Class
*/
@Plugin(name = "SubServers.Host", version = "2.13.2b", authors = "ME1312", description = "Host SubServers from other Machines", website = "https://github.com/ME1312/SubServers-2")
@Plugin(name = "SubServers.Host", version = "2.13.2c", authors = "ME1312", description = "Host SubServers from other Machines", website = "https://github.com/ME1312/SubServers-2")
public final class ExHost {
protected NamedContainer<Long, Map<String, Map<String, String>>> lang = null;
public HashMap<String, SubCreator.ServerTemplate> templates = new HashMap<String, SubCreator.ServerTemplate>();

View File

@ -17,6 +17,7 @@ import java.util.regex.Pattern;
* Internal Process Logger Class
*/
public class SubLogger {
public static final int MAX_GC = Integer.getInteger("subservers.logging.max_gc", 4096);
protected Process process;
private Object handle;
protected final Logger logger;
@ -49,6 +50,17 @@ public class SubLogger {
this.file = file;
}
private static boolean gc_running = false;
private static int gc = 0;
private static void gc() {
if (!gc_running && MAX_GC > 0 && gc >= MAX_GC) {
gc_running = true;
System.gc();
gc = 0;
gc_running = false;
}
}
/**
* Start Logger
*/
@ -116,6 +128,9 @@ public class SubLogger {
writer.println(line);
writer.flush();
}
gc++;
gc();
}
}
} catch (IOException e) {} finally {

View File

@ -44,7 +44,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
public boolean redis = false;
public final SubAPI api = new SubAPI(this);
public SubDataClient subdata = null;
public static final Version version = Version.fromString("2.13.2b");
public static final Version version = Version.fromString("2.13.2c");
public final boolean isPatched;
public long lastReload = -1;