本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setGridLogger方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setGridLogger方法的具体用法?Java IgniteConfiguration.setGridLogger怎么用?Java IgniteConfiguration.setGridLogger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setGridLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: helloworldConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static IgniteConfiguration helloworldConfiguration() {
int cpus = Runtime.getRuntime().availableProcessors();
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("hello-world");
cfg.setClientMode(true);
cfg.setPeerClassLoadingEnabled(true);
cfg.setDeploymentMode(DeploymentMode.CONTINUOUS);
cfg.setPeerClassLoadingMissedResourcesCacheSize(200);
cfg.setPublicThreadPoolSize(4 * cpus);
cfg.setSystemThreadPoolSize(2 * cpus);
// log frequency in ms
cfg.setMetricsLogFrequency(30000);
cfg.setGridLogger(igniteLogger());
cfg.setDiscoverySpi(multicastDiscoverySpi());
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: copyDefaultsFromSource
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* @param cfg Config.
* @param srcCfg Source config.
*/
private static void copyDefaultsFromSource(IgniteConfiguration cfg, IgniteConfiguration srcCfg) {
cfg.setIgniteInstanceName(srcCfg.getIgniteInstanceName());
cfg.setGridLogger(srcCfg.getGridLogger());
cfg.setNodeId(srcCfg.getNodeId());
cfg.setIgniteHome(srcCfg.getIgniteHome());
cfg.setMBeanServer(srcCfg.getMBeanServer());
cfg.setMetricsLogFrequency(srcCfg.getMetricsLogFrequency());
cfg.setConnectorConfiguration(srcCfg.getConnectorConfiguration());
cfg.setCommunicationSpi(srcCfg.getCommunicationSpi());
cfg.setNetworkTimeout(srcCfg.getNetworkTimeout());
cfg.setDiscoverySpi(srcCfg.getDiscoverySpi());
cfg.setCheckpointSpi(srcCfg.getCheckpointSpi());
cfg.setIncludeEventTypes(srcCfg.getIncludeEventTypes());
// Specials.
((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
}
示例4: testSemaphoreClosing
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* @throws Exception If failed.
*/
public void testSemaphoreClosing() throws Exception {
IgniteConfiguration cfg;
GridStringLogger stringLogger;
stringLogger = new GridStringLogger();
cfg = optimize(getConfiguration("npeGrid"));
cfg.setGridLogger(stringLogger);
try (Ignite ignite = startGrid(cfg.getIgniteInstanceName(), cfg)) {
ignite.semaphore("semaphore", 1, true, true);
}
assertFalse(stringLogger.toString().contains(NullPointerException.class.getName()));
}
示例5: getDefaultConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Default Ignite configuration without the {#TcpDiscoveryRedisIpFinder}.
*
* @param gridName Grid name.
* @return Ignite configuration
* @throws Exception If failed.
*/
protected IgniteConfiguration getDefaultConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setGridName(gridName);
cfg.setLocalHost("127.0.0.1");
cfg.setGridLogger(new Slf4jLogger());
cfg.setNetworkTimeout(10000);
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);
if (useStrLog) {
strLog = new GridStringLogger(false, cfg.getGridLogger());
cfg.setGridLogger(strLog);
}
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
cfg.setDeploymentMode(depMode);
if (cacheEnabled) {
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setName(cacheName);
cacheCfg.setCacheMode(cacheMode);
cacheCfg.setAffinity(aff);
cacheCfg.setBackups(backups);
cacheCfg.setAtomicityMode(TRANSACTIONAL);
if (initCache != null)
initCache.apply(cacheCfg);
cfg.setCacheConfiguration(cacheCfg);
}
else
cfg.setCacheConfiguration();
return cfg;
}
示例7: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(gridName);
if (configuredConsistentId != null)
cfg.setConsistentId(configuredConsistentId);
final DataStorageConfiguration dsCfg = new DataStorageConfiguration();
if (placeStorageInTemp) {
final File tempDir = new File(System.getProperty("java.io.tmpdir"));
pstStoreCustomPath = new File(tempDir, "Store");
pstWalStoreCustomPath = new File(tempDir, "WalStore");
pstWalArchCustomPath = new File(tempDir, "WalArchive");
dsCfg.setStoragePath(pstStoreCustomPath.getAbsolutePath());
dsCfg.setWalPath(pstWalStoreCustomPath.getAbsolutePath());
dsCfg.setWalArchivePath(pstWalArchCustomPath.getAbsolutePath());
}
dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
.setMaxSize(32 * 1024 * 1024)
.setPersistenceEnabled(true));
cfg.setDataStorageConfiguration(dsCfg);
if (strLog != null)
cfg.setGridLogger(strLog);
return cfg;
}
示例8: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Creates grid configuration.
*
* @param igniteInstanceName Ignite instance name.
* @return Grid configuration.
* @throws Exception If error occurred.
*/
private static IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName(igniteInstanceName);
cfg.setGridLogger(new Log4JLogger());
cfg.setConnectorConfiguration(null);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(false);
ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500..47502"));
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
return cfg;
}
示例9: apply
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void apply(IgniteConfiguration gridCfg) {
// Remove cache duplicates, clean up the rest, etc.
IgniteConfiguration cfg = prepareConfiguration(gridCfg);
// Do nothing if no caches found.
if (cfg == null)
return;
out("Starting grids to warmup caches [gridCnt=" + gridCnt +
", caches=" + cfg.getCacheConfiguration().length + ']');
Collection<Ignite> ignites = new LinkedList<>();
String old = System.getProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER);
try {
System.setProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER, "false");
TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
for (int i = 0; i < gridCnt; i++) {
IgniteConfiguration cfg0 = new IgniteConfiguration(cfg);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
discoSpi.setLocalPort(discoveryPort);
cfg0.setDiscoverySpi(discoSpi);
cfg0.setGridLogger(new NullLogger());
cfg0.setIgniteInstanceName("ignite-warmup-grid-" + i);
ignites.add(Ignition.start(cfg0));
}
doWarmup(ignites);
}
catch (Exception e) {
throw new IgniteException(e);
}
finally {
for (Ignite ignite : ignites)
Ignition.stop(ignite.name(), false);
out("Stopped warmup grids.");
if (old == null)
old = "false";
System.setProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER, old);
}
}
示例10: apply0
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
@Override protected void apply0(IgniteConfiguration igniteCfg) {
// Validate and copy Interop configuration setting environment pointer along the way.
PlatformConfiguration interopCfg = igniteCfg.getPlatformConfiguration();
if (interopCfg != null && !(interopCfg instanceof PlatformDotNetConfiguration))
throw new IgniteException("Illegal platform configuration (must be of type " +
PlatformDotNetConfiguration.class.getName() + "): " + interopCfg.getClass().getName());
PlatformDotNetConfiguration dotNetCfg = interopCfg != null ? (PlatformDotNetConfiguration)interopCfg : null;
if (dotNetCfg == null)
dotNetCfg = new PlatformDotNetConfiguration();
memMgr = new PlatformMemoryManagerImpl(gate, 1024);
PlatformLogger logger = null;
if (useLogger) {
logger = new PlatformLogger();
logger.setGateway(gate);
igniteCfg.setGridLogger(logger);
}
PlatformDotNetConfigurationEx dotNetCfg0 = new PlatformDotNetConfigurationEx(dotNetCfg, gate, memMgr,
logger);
igniteCfg.setPlatformConfiguration(dotNetCfg0);
// Set Ignite home so that marshaller context works.
String ggHome = igniteCfg.getIgniteHome();
if (ggHome != null)
U.setIgniteHome(ggHome);
// Callback to .Net.
prepare(igniteCfg, dotNetCfg0);
// Make sure binary config is right.
setBinaryConfiguration(igniteCfg, dotNetCfg0);
}
示例11: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
if (testSpi)
cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
if (connectionsPerNode != null)
((TcpCommunicationSpi)cfg.getCommunicationSpi()).setConnectionsPerNode(connectionsPerNode);
cfg.setClientMode(client);
if (strLog != null) {
cfg.setGridLogger(strLog);
strLog = null;
}
return cfg;
}
示例12: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setClientMode(clientMode);
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setName("simple");
cacheCfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setCacheConfiguration(cacheCfg);
if (setExternalLoader)
cfg.setClassLoader(ldr);
else
cfg.setGridLogger(log);
return cfg;
}
示例13: Server
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public Server(String theName) {
Slf4jLogger gridLog = new Slf4jLogger(logger);
IgniteConfiguration configuration = new IgniteConfiguration();
configuration.setClientMode(false);
//configuration.setConsistentId("42");
configuration.setGridName(theName);
configuration.setGridLogger(gridLog);
ignite = Ignition.start(configuration);
}
示例14: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* @param name Node name.
* @param setAttr Flag indicating whether node user attribute should be set.
* @param log Logger.
* @return Node configuration w/specified name.
* @throws Exception If failed.
*/
private IgniteConfiguration getConfiguration(String name, boolean setAttr, GridStringLogger log) throws Exception {
IgniteConfiguration cfg = optimize(getConfiguration(name));
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
if (setAttr)
cfg.setUserAttributes(Collections.singletonMap("node-type", "data"));
cfg.setGridLogger(log);
return cfg;
}
示例15: systemInitialize
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* <code>systemInitialize</code> is the entry method to start all the operations within iotracah.
* This class is expected to be extended by the core plugin only.
* If there is more than that implementation then the first implementation with no
* guarantee of selection will be loaded.
* The system will automatically throw a <code>UnRetriableException</code> if no implementation of this
* interface is detected.
*
* @param baseSystemHandlerList
* @throws UnRetriableException
*/
@Override
public void systemInitialize(List<BaseSystemHandler> baseSystemHandlerList) throws UnRetriableException {
//Initiate ignite.
synchronized (this) {
TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
// Set initial IP addresses.
// Note that you can optionally specify a port or a port range.
ipFinder.setAddresses(Arrays.asList(getDiscoveryAddresses()));
spi.setIpFinder(ipFinder);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setGridName(getExecutorDefaultName());
// Override default discovery SPI.
cfg.setDiscoverySpi(spi);
//Set node attribute.
Map<String, String> attributes = new HashMap<>();
attributes.put("ROLE", getExecutorDefaultName());
cfg.setUserAttributes(attributes);
//Use sl4j logger
IgniteLogger gridLog = new Slf4jLogger(LoggerFactory.getLogger("org.apache.ignite")); // Provide correct SLF4J logger here.
cfg.setGridLogger(gridLog);
//Optimize marshaller
OptimizedMarshaller optimizedMarshaller = new OptimizedMarshaller();
optimizedMarshaller.setRequireSerializable(true);
cfg.setMarshaller(optimizedMarshaller);
TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
transactionConfiguration.setDefaultTxConcurrency(TransactionConcurrency.PESSIMISTIC);
transactionConfiguration.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);
transactionConfiguration.setDefaultTxTimeout(30000);
cfg.setTransactionConfiguration(transactionConfiguration);
cfg.setMetricsLogFrequency(0);
cfg.setMetricsUpdateFrequency(15000);
Ignition.start(cfg);
//Also instantiate the server router.
IgniteMessaging igniteMessaging = getIgnite().message();
String cluster = getExecutorDefaultName();
UUID nodeId = getNodeId();
DefaultServerRouter defaultServerRouter = new DefaultServerRouter(cluster, nodeId, igniteMessaging);
defaultServerRouter.initiate();
this.serverRouter = defaultServerRouter;
}
log.debug(" systemInitialize : performing classifications for base system handlers");
baseSystemHandlerList.forEach(this::classifyBaseHandler);
}