本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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();
}
示例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);
}
}
示例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();
}
示例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);
}
}
示例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);
}