本文整理汇总了Java中org.apache.cassandra.utils.ResourceWatcher类的典型用法代码示例。如果您正苦于以下问题:Java ResourceWatcher类的具体用法?Java ResourceWatcher怎么用?Java ResourceWatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceWatcher类属于org.apache.cassandra.utils包,在下文中一共展示了ResourceWatcher类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PropertyFileSnitch
import org.apache.cassandra.utils.ResourceWatcher; //导入依赖的package包/类
public PropertyFileSnitch() throws ConfigurationException
{
reloadConfiguration();
try
{
FBUtilities.resourceToFile(SNITCH_PROPERTIES_FILENAME);
Runnable runnable = new WrappedRunnable()
{
protected void runMayThrow() throws ConfigurationException
{
reloadConfiguration();
}
};
ResourceWatcher.watch(SNITCH_PROPERTIES_FILENAME, runnable, 60 * 1000);
}
catch (ConfigurationException ex)
{
logger.error("{} found, but does not look like a plain file. Will not watch it for changes", SNITCH_PROPERTIES_FILENAME);
}
}
示例2: PropertyFileSnitch
import org.apache.cassandra.utils.ResourceWatcher; //导入依赖的package包/类
public PropertyFileSnitch() throws ConfigurationException
{
reloadConfiguration();
try
{
FBUtilities.resourceToFile(SNITCH_PROPERTIES_FILENAME);
Runnable runnable = new WrappedRunnable()
{
protected void runMayThrow() throws ConfigurationException
{
reloadConfiguration();
}
};
ResourceWatcher.watch(SNITCH_PROPERTIES_FILENAME, runnable, 60 * 1000);
}
catch (ConfigurationException ex)
{
logger.debug(SNITCH_PROPERTIES_FILENAME + " found, but does not look like a plain file. Will not watch it for changes");
}
}
示例3: PropertyFileSnitch
import org.apache.cassandra.utils.ResourceWatcher; //导入依赖的package包/类
public PropertyFileSnitch(int refreshPeriodInSeconds) throws ConfigurationException
{
reloadConfiguration(false);
try
{
FBUtilities.resourceToFile(SNITCH_PROPERTIES_FILENAME);
Runnable runnable = new WrappedRunnable()
{
protected void runMayThrow() throws ConfigurationException
{
reloadConfiguration(true);
}
};
ResourceWatcher.watch(SNITCH_PROPERTIES_FILENAME, runnable, refreshPeriodInSeconds * 1000);
}
catch (ConfigurationException ex)
{
logger.error("{} found, but does not look like a plain file. Will not watch it for changes", SNITCH_PROPERTIES_FILENAME);
}
}
示例4: PropertyFileSnitch
import org.apache.cassandra.utils.ResourceWatcher; //导入依赖的package包/类
public PropertyFileSnitch() throws ConfigurationException
{
reloadConfiguration();
try
{
FBUtilities.resourceToFile(SNITCH_PROPERTIES_FILENAME);
Runnable runnable = new WrappedRunnable()
{
protected void runMayThrow() throws ConfigurationException
{
reloadConfiguration();
}
};
ResourceWatcher.watch(SNITCH_PROPERTIES_FILENAME, runnable, 60 * 1000);
}
catch (ConfigurationException ex)
{
logger.debug("{} found, but does not look like a plain file. Will not watch it for changes", SNITCH_PROPERTIES_FILENAME);
}
}
示例5: PropertyFileSnitch
import org.apache.cassandra.utils.ResourceWatcher; //导入依赖的package包/类
public PropertyFileSnitch() throws ConfigurationException
{
reloadConfiguration();
try
{
FBUtilities.resourceToFile(RACK_PROPERTY_FILENAME);
Runnable runnable = new WrappedRunnable()
{
protected void runMayThrow() throws ConfigurationException
{
reloadConfiguration();
}
};
ResourceWatcher.watch(RACK_PROPERTY_FILENAME, runnable, 60 * 1000);
}
catch (ConfigurationException ex)
{
logger.debug(RACK_PROPERTY_FILENAME + " found, but does not look like a plain file. Will not watch it for changes");
}
}
示例6: GossipingPropertyFileSnitch
import org.apache.cassandra.utils.ResourceWatcher; //导入依赖的package包/类
public GossipingPropertyFileSnitch(int refreshPeriodInSeconds) throws ConfigurationException
{
snitchHelperReference = new AtomicReference<ReconnectableSnitchHelper>();
reloadConfiguration();
try
{
psnitch = new PropertyFileSnitch();
logger.info("Loaded {} for compatibility", PropertyFileSnitch.SNITCH_PROPERTIES_FILENAME);
}
catch (ConfigurationException e)
{
logger.info("Unable to load {}; compatibility mode disabled", PropertyFileSnitch.SNITCH_PROPERTIES_FILENAME);
}
try
{
FBUtilities.resourceToFile(SnitchProperties.RACKDC_PROPERTY_FILENAME);
Runnable runnable = new WrappedRunnable()
{
protected void runMayThrow() throws ConfigurationException
{
reloadConfiguration();
}
};
ResourceWatcher.watch(SnitchProperties.RACKDC_PROPERTY_FILENAME, runnable, refreshPeriodInSeconds * 1000);
}
catch (ConfigurationException ex)
{
logger.error("{} found, but does not look like a plain file. Will not watch it for changes", SnitchProperties.RACKDC_PROPERTY_FILENAME);
}
}
示例7: YamlFileNetworkTopologySnitch
import org.apache.cassandra.utils.ResourceWatcher; //导入依赖的package包/类
/**
* Constructor.
*
* @param topologyConfigFilename
* name of the topology configuration file
* @throws ConfigurationException
* on failure
*/
YamlFileNetworkTopologySnitch(final String topologyConfigFilename)
throws ConfigurationException
{
logger.warn("YamlFileNetworkTopologySnitch is deprecated; switch to GossipingPropertyFileSnitch instead");
this.topologyConfigFilename = topologyConfigFilename;
loadTopologyConfiguration();
try
{
/*
* Check if the topology configuration file is a plain file.
*/
FBUtilities.resourceToFile(topologyConfigFilename);
final Runnable runnable = new WrappedRunnable()
{
/**
* Loads the topology.
*/
protected void runMayThrow() throws ConfigurationException
{
loadTopologyConfiguration();
}
};
ResourceWatcher.watch(topologyConfigFilename, runnable,
CHECK_PERIOD_IN_MS);
}
catch (final ConfigurationException e)
{
logger.debug(
"{} found, but does not look like a plain file. Will not watch it for changes",
topologyConfigFilename);
}
}
示例8: YamlFileNetworkTopologySnitch
import org.apache.cassandra.utils.ResourceWatcher; //导入依赖的package包/类
/**
* Constructor.
*
* @param topologyConfigFilename
* name of the topology configuration file
* @throws ConfigurationException
* on failure
*/
YamlFileNetworkTopologySnitch(final String topologyConfigFilename)
throws ConfigurationException
{
this.topologyConfigFilename = topologyConfigFilename;
loadTopologyConfiguration();
try
{
/*
* Check if the topology configuration file is a plain file.
*/
FBUtilities.resourceToFile(topologyConfigFilename);
final Runnable runnable = new WrappedRunnable()
{
/**
* Loads the topology.
*/
protected void runMayThrow() throws ConfigurationException
{
loadTopologyConfiguration();
}
};
ResourceWatcher.watch(topologyConfigFilename, runnable,
CHECK_PERIOD_IN_MS);
}
catch (final ConfigurationException e)
{
logger.debug(
"{} found, but does not look like a plain file. Will not watch it for changes",
topologyConfigFilename);
}
}