本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setWorkDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setWorkDirectory方法的具体用法?Java IgniteConfiguration.setWorkDirectory怎么用?Java IgniteConfiguration.setWorkDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setWorkDirectory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configuration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public IgniteConfiguration configuration() {
if (staticCfg != null)
return staticCfg;
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setMarshaller(marshaller);
cfg.setNodeId(nodeId);
cfg.setMBeanServer(jmx);
cfg.setIgniteHome(home);
cfg.setLocalHost(locHost);
try {
cfg.setWorkDirectory(U.defaultWorkDirectory());
}
catch (IgniteCheckedException e) {
throw new IgniteException("Failed to get default work directory.", e);
}
return cfg;
}
示例2: storeToFile
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Stores {@link IgniteConfiguration} to file as xml.
*
* @param cfg Ignite Configuration.
* @param fileName A name of file where the configuration was stored.
* @param resetMarshaller Reset marshaller configuration to default.
* @param resetDiscovery Reset discovery configuration to default.
* @throws IOException If failed.
* @see #readCfgFromFileAndDeleteFile(String)
*/
public static void storeToFile(IgniteConfiguration cfg, String fileName,
boolean resetMarshaller,
boolean resetDiscovery) throws IOException, IgniteCheckedException {
try(OutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) {
IgniteConfiguration cfg0 = new IgniteConfiguration(cfg);
if (resetMarshaller)
cfg0.setMarshaller(null);
if (resetDiscovery)
cfg0.setDiscoverySpi(null);
cfg0.setWorkDirectory(U.defaultWorkDirectory());
cfg0.setMBeanServer(null);
cfg0.setGridLogger(null);
new XStream().toXML(cfg0, out);
}
}
示例3: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
int gridIndex = getTestIgniteInstanceIndex(gridName);
IgniteConfiguration cfg = super.getConfiguration(gridName);
String tmpDir = System.getProperty("java.io.tmpdir");
cfg.setWorkDirectory(Paths.get(tmpDir, "srv" + gridIndex).toString());
cfg.setDataStorageConfiguration(
new DataStorageConfiguration()
);
cfg.setCacheConfiguration(new CacheConfiguration()
.setName(DEFAULT_CACHE_NAME)
.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
.setCacheMode(CacheMode.REPLICATED));
return cfg;
}
示例4: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
if (customWorkSubDir != null)
cfg.setWorkDirectory(Paths.get(U.defaultWorkDirectory(), customWorkSubDir).toString());
cfg.setClientMode(clientMode);
cfg.setDataStorageConfiguration(
new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
.setPersistenceEnabled(true)
.setMaxSize(100 * 1024 * 1024))
);
BinaryConfiguration bCfg = new BinaryConfiguration();
BinaryTypeConfiguration binaryEnumCfg = new BinaryTypeConfiguration(EnumType.class.getName());
binaryEnumCfg.setEnum(true);
binaryEnumCfg.setEnumValues(F.asMap(EnumType.ENUM_VAL_0.name(),
EnumType.ENUM_VAL_0.ordinal(),
EnumType.ENUM_VAL_1.name(),
EnumType.ENUM_VAL_1.ordinal()));
bCfg.setTypeConfigurations(Arrays.asList(binaryEnumCfg));
cfg.setBinaryConfiguration(bCfg);
CacheKeyConfiguration dynamicMetaKeyCfg = new CacheKeyConfiguration(DYNAMIC_TYPE_NAME, DYNAMIC_INT_FIELD_NAME);
cfg.setCacheKeyConfiguration(dynamicMetaKeyCfg);
cfg.setCacheConfiguration(new CacheConfiguration()
.setName(CACHE_NAME)
.setAffinity(new RendezvousAffinityFunction())
.setCacheMode(CacheMode.REPLICATED));
return cfg;
}
示例5: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setClientMode(clientMode);
if (clientMode)
cfg.setWorkDirectory(TMP_DIR);
TcpDiscoverySpi disco = new TestTcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(REPLICATED);
ccfg.setRebalanceMode(SYNC);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
示例6: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
IgniteConfiguration resCfg = testsCfg.configurationFactory().getConfiguration(igniteInstanceName, cfg);
resCfg.setWorkDirectory(workDir.getAbsolutePath());
if (testsCfg.withClients())
resCfg.setClientMode(expectedClient(igniteInstanceName));
return resCfg;
}
示例7: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
cfg.setMarshaller(new OptimizedMarshaller());
cfg.setWorkDirectory(workDir);
if (cache) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(PARTITIONED);
ccfg.setBackups(1);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setCacheConfiguration(ccfg);
}
else
cfg.setClientMode(true);
return cfg;
}