Try to debug unreqwuired .changed calls
This commit is contained in:
parent
17526c3f5f
commit
84104fa03a
@ -259,6 +259,14 @@ public class MassiveCore extends MassivePlugin
|
||||
// Delete Files (at once and additionally after all plugins loaded)
|
||||
MassiveCoreTaskDeleteFiles.get().run();
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, MassiveCoreTaskDeleteFiles.get());
|
||||
|
||||
// Uneccessary call of .changed() for debug
|
||||
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MassiveCoreMConf.get().changed();
|
||||
}
|
||||
}, 200L);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,6 +132,9 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
||||
|
||||
@EditorType(TypeBooleanOn.class)
|
||||
public boolean warnOnLocalAlter = false;
|
||||
|
||||
@EditorType(TypeBooleanOn.class)
|
||||
public boolean advancedLocalPollingDebug = false;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CLEAN
|
||||
|
@ -9,7 +9,6 @@ import com.massivecraft.massivecore.comparator.ComparatorNaturalOrder;
|
||||
import com.massivecraft.massivecore.mixin.MixinModification;
|
||||
import com.massivecraft.massivecore.store.migrator.MigratorUtil;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.ReflectionUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import com.massivecraft.massivecore.xlib.gson.Gson;
|
||||
import com.massivecraft.massivecore.xlib.gson.JsonElement;
|
||||
@ -555,7 +554,13 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
|
||||
this.removeIdentifiedModificationFixed(id);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
E entity = this.getFixed(id);
|
||||
if (entity != null)
|
||||
{
|
||||
entity.setLastStackTraceChanged(null);
|
||||
}
|
||||
|
||||
return modification;
|
||||
}
|
||||
|
||||
@ -595,7 +600,7 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
|
||||
|
||||
private void checkActuallyModifiedFixed(String id)
|
||||
{
|
||||
if (!ConfServer.localPollingEnabled || !MassiveCoreMConf.get().warnOnLocalAlter) return;
|
||||
if (!MStore.isLocalPollingDebugEnabled()) return;
|
||||
|
||||
E entity = this.getFixed(id);
|
||||
boolean modified = this.examineHasLocalAlterFixed(id, entity);
|
||||
@ -607,6 +612,7 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
|
||||
String change = Txt.implode(messages, Txt.parse("<silver> | "));
|
||||
String message = Txt.parse("<b>[No Modification] %s", change);
|
||||
this.getPlugin().log(message);
|
||||
if (entity.getLastStackTraceChanged() != null) this.getPlugin().log(MUtil.getStackTraceString(entity.getLastStackTraceChanged(), true));
|
||||
}
|
||||
|
||||
protected void logModification(E entity, Modification modification)
|
||||
|
@ -1,7 +1,12 @@
|
||||
package com.massivecraft.massivecore.store;
|
||||
|
||||
import com.massivecraft.massivecore.ConfServer;
|
||||
import com.massivecraft.massivecore.MassiveCoreMConf;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.xlib.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// Self referencing generic.
|
||||
// http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206
|
||||
public class Entity<E extends Entity<E>> extends EntityInternal<E>
|
||||
@ -31,13 +36,20 @@ public class Entity<E extends Entity<E>> extends EntityInternal<E>
|
||||
private volatile transient boolean lastDefault = false;
|
||||
public boolean getLastDefault() { return this.lastDefault; }
|
||||
public void setLastDefault(boolean lastDefault) { this.lastDefault = lastDefault; }
|
||||
|
||||
|
||||
private volatile transient List<StackTraceElement> lastStackTraceChanged;
|
||||
public List<StackTraceElement> getLastStackTraceChanged() { return this.lastStackTraceChanged; }
|
||||
public void setLastStackTraceChanged(List<StackTraceElement> lastStackTraceChanged) { this.lastStackTraceChanged = lastStackTraceChanged; }
|
||||
|
||||
public void clearSyncLogFields()
|
||||
{
|
||||
this.lastRaw = null;
|
||||
this.lastMtime = 0;
|
||||
this.lastDefault = false;
|
||||
this.lastStackTraceChanged = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ATTACH AND DETACH
|
||||
@ -62,6 +74,14 @@ public class Entity<E extends Entity<E>> extends EntityInternal<E>
|
||||
// -------------------------------------------- //
|
||||
// SYNC AND IO ACTIONS
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void changed()
|
||||
{
|
||||
super.changed();
|
||||
if (!MStore.isLocalPollingDebugEnabled() || !MassiveCoreMConf.get().advancedLocalPollingDebug) return;
|
||||
this.lastStackTraceChanged = MUtil.getStackTrace();
|
||||
}
|
||||
|
||||
public Modification sync()
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.massivecore.store;
|
||||
|
||||
import com.massivecraft.massivecore.ConfServer;
|
||||
import com.massivecraft.massivecore.MassiveCoreMConf;
|
||||
import com.massivecraft.massivecore.xlib.gson.JsonElement;
|
||||
|
||||
import java.net.URI;
|
||||
@ -75,13 +76,13 @@ public class MStore
|
||||
if (uri == null) return alias;
|
||||
return resolveAlias(uri);
|
||||
}
|
||||
|
||||
|
||||
public static Db getDb(String alias)
|
||||
{
|
||||
String uri = resolveAlias(alias);
|
||||
Db db = uri2db.get(uri);
|
||||
if (db != null) return db;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
db = getDb(new URI(uri));
|
||||
@ -91,17 +92,17 @@ public class MStore
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
uri2db.put(uri, db);
|
||||
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
public static Db getDb()
|
||||
{
|
||||
return getDb(ConfServer.dburi);
|
||||
}
|
||||
|
||||
|
||||
public static Db getDb(URI uri)
|
||||
{
|
||||
String scheme = uri.getScheme();
|
||||
@ -109,5 +110,15 @@ public class MStore
|
||||
if (driver == null) return null;
|
||||
return driver.getDb(uri.toString());
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OTHER
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean isLocalPollingDebugEnabled()
|
||||
{
|
||||
return ConfServer.localPollingEnabled && MassiveCoreMConf.get().warnOnLocalAlter;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user