Java Code Examples for org.apache.ignite.internal.IgniteEx#context()

The following examples show how to use org.apache.ignite.internal.IgniteEx#context() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgniteHadoopIgfsSecondaryFileSystem.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @param ignite Ignite instance.
 */
@IgniteInstanceResource
public void setIgniteInstance(IgniteEx ignite) {
    ctx = ignite.context();
}
 
Example 2
Source File: IgniteWalConverterSensitiveDataTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
    super.beforeTestsStarted();

    sysOut = System.out;
    testOut = new ByteArrayOutputStream(16 * 1024);

    int nodeId = 0;

    IgniteEx crd = startGrid(nodeId);
    crd.cluster().active(true);

    try (Transaction tx = crd.transactions().txStart()) {
        IgniteCache<Object, Object> cache = crd.cache(DEFAULT_CACHE_NAME);

        sensitiveValues.add(SENSITIVE_DATA_VALUE_PREFIX + 0);
        sensitiveValues.add(SENSITIVE_DATA_VALUE_PREFIX + 1);
        sensitiveValues.add(SENSITIVE_DATA_VALUE_PREFIX + 2);

        String val0 = sensitiveValues.get(0);
        String val1 = sensitiveValues.get(1);
        String val2 = sensitiveValues.get(2);

        cache.put(val0, val0);
        cache.withKeepBinary().put(val1, val1);
        cache.put(val2, new Person(1, val2));

        tx.commit();
    }

    GridKernalContext kernalCtx = crd.context();
    IgniteWriteAheadLogManager wal = kernalCtx.cache().context().wal();

    for (WALRecord walRecord : withSensitiveData()) {
        if (isIncludeIntoLog(walRecord))
            wal.log(walRecord);
    }

    sensitiveValues.add(SENSITIVE_DATA_VALUE_PREFIX);

    wal.flush(null, true);

    IgniteConfiguration cfg = crd.configuration();

    String wd = cfg.getWorkDirectory();
    String wp = cfg.getDataStorageConfiguration().getWalPath();
    String fn = kernalCtx.pdsFolderResolver().resolveFolders().folderName();

    walDirPath = wd + File.separator + wp + File.separator + fn;
    pageSize = cfg.getDataStorageConfiguration().getPageSize();

    stopGrid(nodeId);
}