Async Configurables
Best for very large to massive data cluster sizes
The simplest way to make your configurable objects to load async is by annotating it with AsyncConfig. This will tell phantom to async load your config. However, you must use the onReadConfig() for when it is loaded in. Using onStart() does not guaranteeee that the config has loaded yet.
package org.phantomapi;
import org.phantomapi.clust.AsyncConfig;
import org.phantomapi.clust.ConfigurableObject;
import org.phantomapi.clust.Keyed;
import org.phantomapi.util.D;
@AsyncConfig
public class BasicConfig extends ConfigurableObject
{
@Keyed("some.key")
public boolean value = false;
public BasicConfig()
{
super("config");
}
@Override
public void onReadConfig()
{
new D("Log").s("The configuration has finished loading async");
}
}
Note that in this example, the configuration is not loaded by this object. We must load it in with a controller. This can create some confusion in knowing when the object has actually finished loading it's data. We can simply make an isLoaded() method.