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


Java U.closeQuiet方法代码示例

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


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

示例1: PublicKeyspacePersistenceSettings

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Constructs Ignite cache key/value persistence settings.
 *
 * @param settingsRsrc resource containing xml with persistence settings for Ignite cache key/value
 */
public PublicKeyspacePersistenceSettings(Resource settingsRsrc) {
    InputStream in;
    try {
        in = settingsRsrc.getInputStream();
    }
    catch (IOException e) {
        throw new IgniteException("Failed to get input stream for Cassandra persistence settings resource: " +
            settingsRsrc, e);
    }
    try {
        init(loadSettings(in));
    }
    finally {
        U.closeQuiet(in);
    }
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:22,代码来源:PublicKeyspacePersistenceSettings.java

示例2: PublicKeyValuePersistenceSettings

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Constructs Ignite cache key/value persistence settings.
 *
 * @param settingsRsrc resource containing xml with persistence settings for Ignite cache key/value
 */
public PublicKeyValuePersistenceSettings(Resource settingsRsrc) {
    InputStream in;
    try {
        in = settingsRsrc.getInputStream();
    }
    catch (IOException e) {
        throw new IgniteException("Failed to get input stream for Cassandra persistence settings resource: " +
            settingsRsrc, e);
    }
    try {
        init(loadSettings(in));
    }
    finally {
        U.closeQuiet(in);
    }
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:22,代码来源:PublicKeyValuePersistenceSettings.java

示例3: appendFile

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Append to the file in the given IGFS provided data chunks.
 *
 * @param igfs IGFS.
 * @param file File.
 * @param chunks Data chunks.
 * @throws Exception If failed.
 */
protected static void appendFile(IgfsImpl igfs, IgfsPath file, @Nullable byte[]... chunks)
    throws Exception {
    IgfsOutputStream os = null;

    try {
        os = igfs.append(file, false);

        writeFileChunks(os, chunks);
    }
    finally {
        U.closeQuiet(os);

        awaitFileClose(igfs, file);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:IgfsAbstractBaseSelfTest.java

示例4: onTimeout

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void onTimeout() {
    if (done.compareAndSet(false, true)) {
        // Close socket - timeout occurred.
        U.closeQuiet(sock);

        LT.warn(log, "Socket write has timed out (consider increasing " +
            (failureDetectionTimeoutEnabled() ?
                "'IgniteConfiguration.failureDetectionTimeout' configuration property) [" +
                "failureDetectionTimeout=" + failureDetectionTimeout() :
                "'sockTimeout' configuration property) [sockTimeout=" + sockTimeout) +
            ", rmtAddr=" + sock.getRemoteSocketAddress() + ", rmtPort=" + sock.getPort() +
            ", sockTimeout=" + sockTimeout + ']');

        stats.onSocketTimeout();
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:TcpDiscoverySpi.java

示例5: sessionEnd

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void sessionEnd(boolean commit) throws CacheWriterException {
    if (!storeSes.isWithinTransaction())
        return;

    List<Mutation> mutations = mutations();
    if (mutations == null || mutations.isEmpty())
        return;

    CassandraSession ses = getCassandraSession();

    try {
        ses.execute(mutations);
    }
    finally {
        mutations.clear();
        U.closeQuiet(ses);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:CassandraCacheStore.java

示例6: createFile

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Create the file in the given IGFS and write provided data chunks to it.
 *
 * @param igfs IGFS.
 * @param file File.
 * @param overwrite Overwrite flag.
 * @param blockSize Block size.
 * @param chunks Data chunks.
 * @throws Exception If failed.
 */
protected static void createFile(IgfsImpl igfs, IgfsPath file, boolean overwrite, long blockSize,
    @Nullable byte[]... chunks) throws Exception {
    IgfsOutputStream os = null;

    try {
        os = igfs.create(file, 256, overwrite, null, 0, blockSize, null);

        writeFileChunks(os, chunks);
    }
    finally {
        U.closeQuiet(os);

        awaitFileClose(igfs, file);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:26,代码来源:IgfsAbstractBaseSelfTest.java

示例7: load

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public <K, V> V load(final K key, String cacheName,
    Iterable<Metadata> path) throws CacheLoaderException {
    if (key == null) {
        return null;
    }
    CassandraSession ses = session();
    try {
        for (Metadata metadata : path) {
            final PersistenceController ctrl = settings.get(cacheName, metadata);
            Object val = ses.execute(new GenericExecutionAssistant(false, "READ") {
                @Override public String getStatement() {
                    return ctrl.getLoadStatement(false, true, true);
                }

                @Override public BoundStatement bindStatement(PreparedStatement statement) {
                    return ctrl.bindKey(statement, key);
                }

                @Override public KeyValuePersistenceSettings getPersistenceSettings() {
                    return ctrl.getPersistenceSettings();
                }

                @Override public Object process(Row row) {
                    return row == null ? null : ctrl.buildValueObject(row);
                }
            });
            if (val != null) {
                return ActiveCacheStore.TOMBSTONE.equals(val) ? null : (V)val;
            }
        }
    }
    finally {
        U.closeQuiet(ses);
    }
    return null;
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:39,代码来源:CassandraKeyValueProvider.java

示例8: fetchAllKeys

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void fetchAllKeys(String cacheName, Metadata metadata,
    final IgniteInClosure<Object> action) throws CacheLoaderException {
    final PersistenceController ctrl = settings.get(cacheName, metadata);
    CassandraSession ses = session();
    try {
        ses.executeAllRows(new GenericExecutionAssistant<Void>(false, "READ ALL KEYS") {
            @Override public String getStatement() {
                return ctrl.getLoadStatement(true, false, false);
            }

            @Override public BoundStatement bindStatement(PreparedStatement statement) {
                return new BoundStatement(statement);
            }

            @Override public KeyValuePersistenceSettings getPersistenceSettings() {
                return ctrl.getPersistenceSettings();
            }

            @Override public Void process(Row row) {
                action.apply(ctrl.buildKeyObject(row));
                return null;
            }
        });
    }
    finally {
        U.closeQuiet(ses);
    }
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:30,代码来源:CassandraKeyValueProvider.java

示例9: loadTree

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected MetadataTree loadTree() {
    CassandraSession ses = dataSrc.session(log == null ? new NullLogger() : log);
    final PersistenceController ctrl = settings.get(METADATA_TABLE_NAME);
    MetadataTree tree;
    try {
        tree = ses.execute(new GenericExecutionAssistant<MetadataTree>(true, "READ_METADATA") {
            @Override public String getStatement() {
                return ctrl.getLoadStatement(false, true, true);
            }

            @Override public BoundStatement bindStatement(PreparedStatement statement) {
                return ctrl.bindKey(statement, METADATA_KEY);
            }

            @Override public KeyValuePersistenceSettings getPersistenceSettings() {
                return ctrl.getPersistenceSettings();
            }

            @Override public MetadataTree process(Row row) {
                return row == null ? null : (MetadataTree)ctrl.buildValueObject(row);
            }
        });
    }
    finally {
        U.closeQuiet(ses);
    }
    if (tree == null) {
        tree = new MetadataTree();
        saveTree(tree);
    }
    return tree;
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:34,代码来源:CassandraMetadataManager.java

示例10: saveTree

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void saveTree(final MetadataTree tree) {
    CassandraSession ses = dataSrc.session(log == null ? new NullLogger() : log);
    final PersistenceController ctrl = settings.get(METADATA_TABLE_NAME);
    try {
        ses.execute(new GenericExecutionAssistant<Void>(true, "WRITE_METADATA") {
            @Override public String getStatement() {
                return ctrl.getWriteStatement();
            }

            @Override public BoundStatement bindStatement(PreparedStatement statement) {
                return ctrl.bindKeyValue(statement, METADATA_KEY, tree);
            }

            @Override public KeyValuePersistenceSettings getPersistenceSettings() {
                return ctrl.getPersistenceSettings();
            }

            @Override public Void process(Row row) {
                return null;
            }
        });
    }
    finally {
        U.closeQuiet(ses);
    }
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:28,代码来源:CassandraMetadataManager.java

示例11: releaseCassandraResources

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** */
public static synchronized void releaseCassandraResources() {
    try {
        if (adminSes != null && !adminSes.isClosed())
            U.closeQuiet(adminSes);
    }
    finally {
        adminSes = null;
    }
    try {
        if (adminCluster != null && !adminCluster.isClosed())
            U.closeQuiet(adminCluster);
    }
    finally {
        adminCluster = null;
    }
    try {
        if (regularSes != null && !regularSes.isClosed())
            U.closeQuiet(regularSes);
    }
    finally {
        regularSes = null;
    }
    try {
        if (regularCluster != null && !regularCluster.isClosed())
            U.closeQuiet(regularCluster);
    }
    finally {
        regularCluster = null;
    }
    SessionPool.release();
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:33,代码来源:CassandraHelper.java

示例12: shutdown

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void shutdown() throws IgniteCheckedException {
    try {
        if (rdr != null) {
            rdr.interrupt();

            U.closeQuiet(sock);

            rdr.join();
        }
    }
    catch (InterruptedException e) {
        throw new IgniteCheckedException(e);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:16,代码来源:TestMemcacheClient.java

示例13: cleanup

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void cleanup() {
    super.cleanup();

    U.closeQuiet(sock);

    synchronized (mux) {
        readers.remove(this);
    }

    spi.stats.onSocketReaderRemoved();
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:ServerImpl.java

示例14: testClientReconnect

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Verifies that client reconnects after connection to the server has been lost.
 *
 * @throws Exception If error occurs.
 */
public void testClientReconnect() throws Exception {
    final Path igfsHome = new Path(primaryFsUri);

    final Path filePath = new Path(igfsHome, "someFile");

    final FSDataOutputStream s = fs.create(filePath, EnumSet.noneOf(CreateFlag.class),
        Options.CreateOpts.perms(FsPermission.getDefault())); // Open stream before stopping IGFS.

    try {
        G.stopAll(true); // Stop the server.

        startNodes(); // Start server again.

        // Check that client is again operational.
        fs.mkdir(new Path("igfs:///dir1/dir2"), FsPermission.getDefault(), true);

        // However, the streams, opened before disconnect, should not be valid.
        GridTestUtils.assertThrows(log, new Callable<Object>() {
            @Nullable @Override public Object call() throws Exception {
                s.write("test".getBytes());

                s.flush();

                return null;
            }
        }, IOException.class, null);

        GridTestUtils.assertThrows(log, new Callable<Object>() {
            @Override public Object call() throws Exception {
                fs.getFileStatus(filePath);

                return null;
            }
        }, FileNotFoundException.class, null);
    }
    finally {
        U.closeQuiet(s);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:45,代码来源:HadoopIgfs20FileSystemAbstractSelfTest.java

示例15: closeConnection

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Closes connection.
 *
 * @param conn Connection to close.
 */
protected void closeConnection(@Nullable Connection conn) {
    CacheStoreSession ses = session();

    // Close connection right away if there is no transaction.
    if (ses.transaction() == null)
        U.closeQuiet(conn);
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:CacheAbstractJdbcStore.java


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