当前位置: 首页>>代码示例>>Java>>正文


Java U.defaultWorkDirectory方法代码示例

本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.defaultWorkDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java U.defaultWorkDirectory方法的具体用法?Java U.defaultWorkDirectory怎么用?Java U.defaultWorkDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.internal.util.typedef.internal.U的用法示例。


在下文中一共展示了U.defaultWorkDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllNodeIndexesInFolder

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @return set of all indexes of nodes found in work folder
 * @throws IgniteCheckedException if failed.
 */
@NotNull private Set<Integer> getAllNodeIndexesInFolder() throws IgniteCheckedException {
    final File curFolder = new File(U.defaultWorkDirectory(), PdsConsistentIdProcessor.DB_DEFAULT_FOLDER);
    final Set<Integer> indexes = new TreeSet<>();
    final File[] files = curFolder.listFiles(PdsConsistentIdProcessor.DB_SUBFOLDERS_NEW_STYLE_FILTER);

    for (File file : files) {
        final PdsConsistentIdProcessor.FolderCandidate uid
            = parseSubFolderName(file, log);

        if (uid != null)
            indexes.add(uid.nodeIndex());
    }

    return indexes;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:FoldersReuseCompatibilityTest.java

示例2: assertDirectoryExist

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Checks one folder existence
 *
 * @param subFolderNames subfolders array to touch
 * @throws IgniteCheckedException if IO error occur
 */
private void assertDirectoryExist(String... subFolderNames) throws IgniteCheckedException {
    File curFolder = new File(U.defaultWorkDirectory());

    for (String name : subFolderNames) {
        curFolder = new File(curFolder, name);
    }

    final String path;
    try {
        path = curFolder.getCanonicalPath();
    }
    catch (IOException e) {
        throw new IgniteCheckedException("Failed to convert path: [" + curFolder.getAbsolutePath() + "]", e);
    }

    assertTrue("Directory " + Arrays.asList(subFolderNames).toString()
        + " is expected to exist [" + path + "]", curFolder.exists() && curFolder.isDirectory());
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:FoldersReuseCompatibilityTest.java

示例3: RecoveryDebug

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @param constId Consistent ID.
 * @param log Logger.
 */
public RecoveryDebug(Object constId,long time, @Nullable IgniteLogger log) {
    this.log = log;

    try {
        String workDir = U.defaultWorkDirectory();

        File tmpDir = new File(workDir, "tmp");

        if (!tmpDir.exists())
            if (!tmpDir.mkdir())
                return;

        File f = new File(tmpDir, "recovery-" +
            sdf.get().format(new Date(time)) + "-" + constId  +".log");

        f.createNewFile();

        fc = FileChannel.open(Paths.get(f.getPath()), EnumSet.of(CREATE, READ, WRITE));
    }
    catch (IgniteCheckedException | IOException e) {
        U.error(log, "Fail create recovery debug file.", e);

        fc = null;
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:30,代码来源:RecoveryDebug.java

示例4: workDirectory

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public String workDirectory() {
    try {
        return ctx != null ? ctx.config().getWorkDirectory() : U.defaultWorkDirectory();
    }
    catch (IgniteCheckedException e) {
        throw new IgniteException("Failed to resolve Ignite work directory.", e);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:HadoopHelperImpl.java

示例5: copyIncompatibleBinaryMetadata

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** */
private void copyIncompatibleBinaryMetadata(String fromWorkDir,
    String fromConsId,
    String toWorkDir,
    String toConsId,
    String fileName
) throws Exception {
    String workDir = U.defaultWorkDirectory();

    Path fromFile = Paths.get(workDir, fromWorkDir, "binary_meta", "node00-" + fromConsId, fileName);
    Path toFile = Paths.get(workDir, toWorkDir, "binary_meta", "node00-" + toConsId, fileName);

    Files.copy(fromFile, toFile, StandardCopyOption.REPLACE_EXISTING);
}
 
开发者ID:apache,项目名称:ignite,代码行数:15,代码来源:IgnitePdsBinaryMetadataOnClusterRestartTest.java

示例6: cleanIgniteWorkDir

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 *
 */
private void cleanIgniteWorkDir() throws IgniteCheckedException {
    String baseDir = U.defaultWorkDirectory();

    File baseDirFile = new File(baseDir);

    for (File f : baseDirFile.listFiles())
        deleteRecursively(U.resolveWorkDirectory(baseDir, f.getName(), false));
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:IgnitePdsBinaryMetadataOnClusterRestartTest.java

示例7: getAllNodeIndexesInFolder

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @return set of all indexes of nodes found in work folder
 * @throws IgniteCheckedException if failed.
 */
@NotNull private Set<Integer> getAllNodeIndexesInFolder() throws IgniteCheckedException {
    final File curFolder = new File(U.defaultWorkDirectory(), PdsConsistentIdProcessor.DB_DEFAULT_FOLDER);
    final Set<Integer> indexes = new TreeSet<>();
    final File[] files = curFolder.listFiles(PdsConsistentIdProcessor.DB_SUBFOLDERS_NEW_STYLE_FILTER);

    for (File file : files) {
        final PdsConsistentIdProcessor.FolderCandidate uid = parseSubFolderName(file, log);

        if (uid != null)
            indexes.add(uid.nodeIndex());
    }

    return indexes;
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:IgniteUidAsConsistentIdMigrationTest.java

示例8: testTxRecordsReadWoBinaryMeta

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Tests transaction generation and WAL for putAll cache operation.
 * @throws Exception if failed.
 */
public void testTxRecordsReadWoBinaryMeta() throws Exception {
    clearProperties = true;
    System.setProperty(IgniteSystemProperties.IGNITE_WAL_LOG_TX_RECORDS, "true");

    final Ignite ignite = startGrid("node0");
    ignite.active(true);

    final Map<Object, IndexedObject> map = new TreeMap<>();

    for (int i = 0; i < 1000; i++)
        map.put(i, new IndexedObject(i));

    ignite.cache(CACHE_NAME).putAll(map);

    ignite.active(false);

    final String workDir = U.defaultWorkDirectory();
    final String subfolderName = genDbSubfolderName(ignite, 0);
    stopAllGrids();

    IgniteWalIteratorFactory factory = new IgniteWalIteratorFactory(new NullLogger(),
        PAGE_SIZE,
        null,
        null,
        false);

    scanIterateAndCount(factory, workDir, subfolderName, 1000, 1, null, null);
}
 
开发者ID:apache,项目名称:ignite,代码行数:33,代码来源:IgniteWalReaderTest.java

示例9: afterTestsStopped

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
    // Start and stop server endpoint to let GC worker
    // make a run and cleanup resources.
    IpcSharedMemoryServerEndpoint srv = new IpcSharedMemoryServerEndpoint(U.defaultWorkDirectory());

    new IgniteTestResources().inject(srv);

    try {
        srv.start();
    }
    finally {
        srv.close();
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:16,代码来源:IpcSharedMemoryCrashDetectionSelfTest.java

示例10: testIgfsServerClientInteractionsUponClientKilling

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testIgfsServerClientInteractionsUponClientKilling() throws Exception {
    // Run server endpoint.
    IpcSharedMemoryServerEndpoint srv = new IpcSharedMemoryServerEndpoint(U.defaultWorkDirectory());

    new IgniteTestResources().inject(srv);

    try {
        srv.start();

        info("Check that server gets correct exception upon client's killing.");

        info("Shared memory IDs before starting client endpoint: " + IpcSharedMemoryUtils.sharedMemoryIds());

        Collection<Integer> shmemIdsWithinInteractions = interactWithClient(srv, true);

        Collection<Integer> shmemIdsAfterInteractions = null;

        // Give server endpoint some time to make resource clean up. See IpcSharedMemoryServerEndpoint.GC_FREQ.
        for (int i = 0; i < 12; i++) {
            shmemIdsAfterInteractions = IpcSharedMemoryUtils.sharedMemoryIds();

            info("Shared memory IDs created within interaction: " + shmemIdsWithinInteractions);
            info("Shared memory IDs after killing client endpoint: " + shmemIdsAfterInteractions);

            if (CollectionUtils.containsAny(shmemIdsAfterInteractions, shmemIdsWithinInteractions))
                U.sleep(1000);
            else
                break;
        }

        assertFalse("List of shared memory IDs after killing client endpoint should not include IDs created " +
            "within server-client interactions.",
            CollectionUtils.containsAny(shmemIdsAfterInteractions, shmemIdsWithinInteractions));
    }
    finally {
        srv.close();
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:42,代码来源:IpcSharedMemoryCrashDetectionSelfTest.java

示例11: main

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
@SuppressWarnings({"BusyWait", "InfiniteLoopStatement"})
public static void main(String[] args) throws IgniteCheckedException {
    System.out.println("Starting server ...");

    // Tell our process PID to the wrapper.
    X.println(GridJavaProcess.PID_MSG_PREFIX + U.jvmPid());

    InputStream is = null;

    try {
        IpcServerEndpoint srv = new IpcSharedMemoryServerEndpoint(U.defaultWorkDirectory());

        new IgniteTestResources().inject(srv);

        srv.start();

        System.out.println("IPC shared memory server endpoint started");

        IpcEndpoint clientEndpoint = srv.accept();

        is = clientEndpoint.inputStream();

        for (;;) {
            X.println("Before read.");

            is.read();

            Thread.sleep(IpcSharedMemoryCrashDetectionSelfTest.RW_SLEEP_TIMEOUT);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        U.closeQuiet(is);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:38,代码来源:IgfsSharedMemoryTestServer.java

示例12: cleanUpWorkingDir

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Clean up working directory.
 */
private void cleanUpWorkingDir() throws Exception {
    String workDir = U.defaultWorkDirectory();

    deleteRecursively(U.resolveWorkDirectory(workDir, "marshaller", false));
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:JdbcAbstractDmlStatementSelfTest.java

示例13: cleanUpWorkDir

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 *
 */
private void cleanUpWorkDir() throws Exception {
    String workDir = U.defaultWorkDirectory();

    deleteRecursively(U.resolveWorkDirectory(workDir, "marshaller", false));
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:IgniteMarshallerCacheFSRestoreTest.java

示例14: testFillWalAndReadRecords

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @throws Exception if failed.
 */
public void testFillWalAndReadRecords() throws Exception {
    final int cacheObjectsToWrite = 10000;

    final Ignite ignite0 = startGrid("node0");

    ignite0.active(true);

    final Serializable consistentId = (Serializable)ignite0.cluster().localNode().consistentId();
    final String subfolderName = genNewStyleSubfolderName(0, (UUID)consistentId);

    putDummyRecords(ignite0, cacheObjectsToWrite);

    stopGrid("node0");

    final String workDir = U.defaultWorkDirectory();
    final File db = U.resolveWorkDirectory(workDir, DFLT_STORE_DIR, false);
    final File wal = new File(db, "wal");
    final File walArchive = new File(wal, "archive");

    final MockWalIteratorFactory mockItFactory = new MockWalIteratorFactory(log, PAGE_SIZE, consistentId, subfolderName, WAL_SEGMENTS);
    final WALIterator it = mockItFactory.iterator(wal, walArchive);
    final int cntUsingMockIter = iterateAndCount(it, false);

    log.info("Total records loaded " + cntUsingMockIter);
    assertTrue(cntUsingMockIter > 0);
    assertTrue(cntUsingMockIter > cacheObjectsToWrite);

    final File walArchiveDirWithConsistentId = new File(walArchive, subfolderName);
    final File walWorkDirWithConsistentId = new File(wal, subfolderName);
    final IgniteWalIteratorFactory factory = createWalIteratorFactory(workDir, subfolderName);
    final int cntArchiveDir = iterateAndCount(factory.iteratorArchiveDirectory(walArchiveDirWithConsistentId));

    log.info("Total records loaded using directory : " + cntArchiveDir);

    final int cntArchiveFileByFile = iterateAndCount(
        factory.iteratorArchiveFiles(
            walArchiveDirWithConsistentId.listFiles(FileWriteAheadLogManager.WAL_SEGMENT_FILE_FILTER)));

    log.info("Total records loaded using archive directory (file-by-file): " + cntArchiveFileByFile);

    assertTrue(cntArchiveFileByFile > cacheObjectsToWrite);
    assertTrue(cntArchiveDir > cacheObjectsToWrite);
    assertTrue(cntArchiveDir == cntArchiveFileByFile);
    //really count2 may be less because work dir correct loading is not supported yet
    assertTrue("Mock based reader loaded " + cntUsingMockIter + " records " +
            "but standalone has loaded only " + cntArchiveDir,
        cntUsingMockIter >= cntArchiveDir);

    final File[] workFiles = walWorkDirWithConsistentId.listFiles(FileWriteAheadLogManager.WAL_SEGMENT_FILE_FILTER);

    final int cntWork = iterateAndCount(factory.iteratorWorkFiles(workFiles));

    log.info("Total records loaded from work: " + cntWork);

    assertTrue("Work iterator loaded [" + cntWork + "] " +
            "Archive iterator loaded [" + cntArchiveFileByFile + "]; " +
            "mock iterator [" + cntUsingMockIter + "]",
        cntWork + cntArchiveFileByFile == cntUsingMockIter);
}
 
开发者ID:apache,项目名称:ignite,代码行数:63,代码来源:IgniteWalReaderTest.java

示例15: testTxFillWalAndExtractDataRecords

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Places records under transaction, checks its value using WAL.
 *
 * @throws Exception if failed.
 */
public void testTxFillWalAndExtractDataRecords() throws Exception {
    final int cntEntries = 1000;
    final int txCnt = 100;

    final Ignite ignite0 = startGrid("node0");

    ignite0.active(true);

    final IgniteCache<Object, Object> entries = txPutDummyRecords(ignite0, cntEntries, txCnt);

    final Map<Object, Object> ctrlMap = new HashMap<>();    for (Cache.Entry<Object, Object> next : entries)
            ctrlMap.put(next.getKey(), next.getValue());


    final String subfolderName = genDbSubfolderName(ignite0, 0);
    stopGrid("node0");

    final String workDir = U.defaultWorkDirectory();
    final File binaryMeta = U.resolveWorkDirectory(workDir, "binary_meta", false);
    final File binaryMetaWithConsId = new File(binaryMeta, subfolderName);
    final File marshallerMapping = U.resolveWorkDirectory(workDir, "marshaller", false);

    final IgniteWalIteratorFactory factory = new IgniteWalIteratorFactory(log,
        PAGE_SIZE,
        binaryMetaWithConsId,
        marshallerMapping);

    final IgniteBiInClosure<Object, Object> objConsumer = new IgniteBiInClosure<Object, Object>() {
        @Override public void apply(Object key, Object val) {
            boolean rmv = remove(ctrlMap, key, val);
            if (!rmv)
                log.error("Unable to remove Key and value from control Map K:[" + key + "] V: [" + val + "]");

            if (val instanceof IndexedObject) {
                IndexedObject indexedObj = (IndexedObject)val;

                assertEquals(indexedObj.iVal, indexedObj.jVal);
                assertEquals(indexedObj.iVal, key);

                for (byte datum : indexedObj.getData())
                    assertTrue(datum >= 'A' && datum <= 'A' + 10);
            }
        }
    };

    scanIterateAndCount(factory, workDir, subfolderName, cntEntries, txCnt, objConsumer, null);

    assertTrue(" Control Map is not empty after reading entries " + ctrlMap, ctrlMap.isEmpty());
}
 
开发者ID:apache,项目名称:ignite,代码行数:55,代码来源:IgniteWalReaderTest.java


注:本文中的org.apache.ignite.internal.util.typedef.internal.U.defaultWorkDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。