Remove polling infrequency and change polling wait values.

This commit is contained in:
BuildTools 2015-12-10 21:11:11 +01:00 committed by Olof Larsson
parent 4d0d1d7b78
commit 14e288a21a
7 changed files with 8 additions and 24 deletions

View File

@ -9,6 +9,7 @@ import org.bukkit.permissions.Permissible;
import com.massivecraft.massivecore.store.Entity;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.PermUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.xlib.mongodb.WriteConcern;
public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
@ -99,9 +100,9 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
// MSTORE CONFIGURATON
// -------------------------------------------- //
public volatile long millisBetweenLocalPoll = 5_000;
public volatile long millisBetweenRemotePollWithoutPusher = 5_000;
public volatile long millisBetweenRemotePollWithPusher = 30_000;
public volatile long millisBetweenLocalPoll = TimeUnit.MILLIS_PER_MINUTE * 5;
public volatile long millisBetweenRemotePollWithoutPusher = TimeUnit.MILLIS_PER_SECOND * 10;
public volatile long millisBetweenRemotePollWithPusher = TimeUnit.MILLIS_PER_MINUTE * 1;
public boolean warnOnLocalAlter = false;
}

View File

@ -192,10 +192,6 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
@Override public boolean isLowercasing() { return this.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?
// If it is default it should not be saved.
@Override

View File

@ -93,9 +93,6 @@ public interface CollInterface<E extends Entity<E>> extends Named
public boolean isLowercasing();
public void setLowercasing(boolean lowercasing);
public int getLocalPollInfrequency();
public void setLocalPollInfrequency(int frequency);
// A default entity will not be saved.
// This is often used together with creative collections to save disc space.
public boolean isDefault(E entity);

View File

@ -17,7 +17,6 @@ public class MStore
// This class also serves the purpose of containing database related constants.
public static final boolean DEBUG_ENABLED = false;
public static final int LOCAL_POLL_INFREQUENCY_DEFAULT = 10;
// -------------------------------------------- //
// DRIVER REGISTRY

View File

@ -67,5 +67,5 @@ public abstract class ModificationPollerAbstract extends Thread
// -------------------------------------------- //
public abstract long getMillisBetweenPoll();
public abstract boolean poll(Coll<?> coll, long iterationCount);
public abstract void poll(Coll<?> coll, long iterationCount);
}

View File

@ -25,20 +25,13 @@ public class ModificationPollerLocal extends ModificationPollerAbstract
@Override
public long getMillisBetweenPoll()
{
// The user specifies how often a default coll should be polled.
// Some colls might be polled more or less frequently.
return MassiveCoreMConf.get().millisBetweenLocalPoll / MStore.LOCAL_POLL_INFREQUENCY_DEFAULT;
return MassiveCoreMConf.get().millisBetweenLocalPoll;
}
@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);
return true;
}
return false;
}
}

View File

@ -39,11 +39,9 @@ public class ModificationPollerRemote extends ModificationPollerAbstract
}
@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);
return true;
}
}