Better boot logging and performance.

Improved boot logs to get more specific performance numbers, and
eliminated some non-essential boot steps to improve performance.
This commit is contained in:
ryanhamshire 2014-09-29 16:12:32 -07:00
parent 57cd709981
commit 23e1803a81
2 changed files with 13 additions and 21 deletions

View File

@ -94,26 +94,12 @@ public abstract class DataStore
{
GriefPrevention.AddLogEntry(this.claims.size() + " total claims loaded.");
//make a list of players who own claims
Vector<UUID> playerNames = new Vector<UUID>();
for(int i = 0; i < this.claims.size(); i++)
{
Claim claim = this.claims.get(i);
//ignore admin claims
if(claim.isAdminClaim()) continue;
if(!playerNames.contains(claim.ownerID))
playerNames.add(claim.ownerID);
}
GriefPrevention.AddLogEntry(playerNames.size() + " players have staked claims.");
//load up all the messages from messages.yml
this.loadMessages();
GriefPrevention.AddLogEntry("Customizable messages loaded.");
//if converting up from an earlier schema version, write all claims back to storage using the latest format
if(this.getSchemaVersion() < this.latestSchemaVersion)
if(this.getSchemaVersion() < latestSchemaVersion)
{
GriefPrevention.AddLogEntry("Please wait. Updating data format.");
@ -121,13 +107,12 @@ public abstract class DataStore
{
this.saveClaim(claim);
}
GriefPrevention.AddLogEntry("Update finished.");
}
//collect garbage, since lots of stuff was loaded into memory and then tossed out
System.gc();
//make a note of the data store schema version
this.setSchemaVersion(this.latestSchemaVersion);
this.setSchemaVersion(latestSchemaVersion);
}
//removes cached player data from memory

View File

@ -171,7 +171,7 @@ public class GriefPrevention extends JavaPlugin
//initializes well... everything
public void onEnable()
{
AddLogEntry("Grief Prevention enabled.");
AddLogEntry("Grief Prevention boot start.");
instance = this;
@ -660,6 +660,8 @@ public class GriefPrevention extends JavaPlugin
this.config_pvp_blockedCommands.add(commands[i].trim());
}
AddLogEntry("Finished loading configuration.");
//when datastore initializes, it loads player and claim data, and posts some stats to the log
if(databaseUrl.length() > 0)
{
@ -713,6 +715,9 @@ public class GriefPrevention extends JavaPlugin
}
}
String dataMode = (this.dataStore instanceof FlatFileDataStore)?"(File Mode)":"(Database Mode)";
AddLogEntry("Finished loading data " + dataMode + ".");
//unless claim block accrual is disabled, start the recurring per 5 minute event to give claim blocks to online players
//20L ~ 1 second
if(this.config_claims_blocksAccruedPerHour > 0)
@ -779,6 +784,8 @@ public class GriefPrevention extends JavaPlugin
GriefPrevention.AddLogEntry("ERROR: Vault was unable to find a supported economy plugin. Either install a Vault-compatible economy plugin, or set both of the economy config variables to zero.");
}
}
AddLogEntry("Boot finished.");
}
//handles slash commands