Remove polling infrequency and change polling wait values.
This commit is contained in:
parent
4d0d1d7b78
commit
14e288a21a
@ -9,6 +9,7 @@ import org.bukkit.permissions.Permissible;
|
|||||||
import com.massivecraft.massivecore.store.Entity;
|
import com.massivecraft.massivecore.store.Entity;
|
||||||
import com.massivecraft.massivecore.util.MUtil;
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
import com.massivecraft.massivecore.util.PermUtil;
|
import com.massivecraft.massivecore.util.PermUtil;
|
||||||
|
import com.massivecraft.massivecore.util.TimeUnit;
|
||||||
import com.massivecraft.massivecore.xlib.mongodb.WriteConcern;
|
import com.massivecraft.massivecore.xlib.mongodb.WriteConcern;
|
||||||
|
|
||||||
public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
||||||
@ -99,9 +100,9 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
|||||||
// MSTORE CONFIGURATON
|
// MSTORE CONFIGURATON
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public volatile long millisBetweenLocalPoll = 5_000;
|
public volatile long millisBetweenLocalPoll = TimeUnit.MILLIS_PER_MINUTE * 5;
|
||||||
public volatile long millisBetweenRemotePollWithoutPusher = 5_000;
|
public volatile long millisBetweenRemotePollWithoutPusher = TimeUnit.MILLIS_PER_SECOND * 10;
|
||||||
public volatile long millisBetweenRemotePollWithPusher = 30_000;
|
public volatile long millisBetweenRemotePollWithPusher = TimeUnit.MILLIS_PER_MINUTE * 1;
|
||||||
|
|
||||||
public boolean warnOnLocalAlter = false;
|
public boolean warnOnLocalAlter = false;
|
||||||
}
|
}
|
||||||
|
@ -192,10 +192,6 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
|
|||||||
@Override public boolean isLowercasing() { return this.lowercasing; }
|
@Override public boolean isLowercasing() { return this.lowercasing; }
|
||||||
@Override public void setLowercasing(boolean lowercasing) { this.lowercasing = lowercasing; }
|
@Override public void setLowercasing(boolean lowercasing) { this.lowercasing = lowercasing; }
|
||||||
|
|
||||||
protected int localPollInfrequency = MStore.LOCAL_POLL_INFREQUENCY_DEFAULT;
|
|
||||||
@Override public int getLocalPollInfrequency() { return this.localPollInfrequency; }
|
|
||||||
@Override public void setLocalPollInfrequency(int infrequence) { this.localPollInfrequency = infrequence; }
|
|
||||||
|
|
||||||
// Should that instance be saved or not?
|
// Should that instance be saved or not?
|
||||||
// If it is default it should not be saved.
|
// If it is default it should not be saved.
|
||||||
@Override
|
@Override
|
||||||
|
@ -93,9 +93,6 @@ public interface CollInterface<E extends Entity<E>> extends Named
|
|||||||
public boolean isLowercasing();
|
public boolean isLowercasing();
|
||||||
public void setLowercasing(boolean lowercasing);
|
public void setLowercasing(boolean lowercasing);
|
||||||
|
|
||||||
public int getLocalPollInfrequency();
|
|
||||||
public void setLocalPollInfrequency(int frequency);
|
|
||||||
|
|
||||||
// A default entity will not be saved.
|
// A default entity will not be saved.
|
||||||
// This is often used together with creative collections to save disc space.
|
// This is often used together with creative collections to save disc space.
|
||||||
public boolean isDefault(E entity);
|
public boolean isDefault(E entity);
|
||||||
|
@ -17,7 +17,6 @@ public class MStore
|
|||||||
// This class also serves the purpose of containing database related constants.
|
// This class also serves the purpose of containing database related constants.
|
||||||
|
|
||||||
public static final boolean DEBUG_ENABLED = false;
|
public static final boolean DEBUG_ENABLED = false;
|
||||||
public static final int LOCAL_POLL_INFREQUENCY_DEFAULT = 10;
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// DRIVER REGISTRY
|
// DRIVER REGISTRY
|
||||||
|
@ -67,5 +67,5 @@ public abstract class ModificationPollerAbstract extends Thread
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public abstract long getMillisBetweenPoll();
|
public abstract long getMillisBetweenPoll();
|
||||||
public abstract boolean poll(Coll<?> coll, long iterationCount);
|
public abstract void poll(Coll<?> coll, long iterationCount);
|
||||||
}
|
}
|
||||||
|
@ -25,20 +25,13 @@ public class ModificationPollerLocal extends ModificationPollerAbstract
|
|||||||
@Override
|
@Override
|
||||||
public long getMillisBetweenPoll()
|
public long getMillisBetweenPoll()
|
||||||
{
|
{
|
||||||
// The user specifies how often a default coll should be polled.
|
return MassiveCoreMConf.get().millisBetweenLocalPoll;
|
||||||
// Some colls might be polled more or less frequently.
|
|
||||||
return MassiveCoreMConf.get().millisBetweenLocalPoll / MStore.LOCAL_POLL_INFREQUENCY_DEFAULT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean poll(Coll<?> coll, long iterationCount)
|
public void poll(Coll<?> coll, long iterationCount)
|
||||||
{
|
{
|
||||||
if (iterationCount % coll.getLocalPollInfrequency() == 0)
|
|
||||||
{
|
|
||||||
coll.identifyLocalModifications(Modification.UNKNOWN_LOG);
|
coll.identifyLocalModifications(Modification.UNKNOWN_LOG);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,9 @@ public class ModificationPollerRemote extends ModificationPollerAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean poll(Coll<?> coll, long iterationCount)
|
public void poll(Coll<?> coll, long iterationCount)
|
||||||
{
|
{
|
||||||
//TODO: This could probably be true.
|
|
||||||
coll.identifyRemoteModifications(Modification.UNKNOWN);
|
coll.identifyRemoteModifications(Modification.UNKNOWN);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user