本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U类的典型用法代码示例。如果您正苦于以下问题:Java U类的具体用法?Java U怎么用?Java U使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
U类属于org.apache.ignite.internal.util.typedef.internal包,在下文中一共展示了U类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logSuggestions
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/**
* @param log Log.
* @param igniteInstanceName Ignite instance name.
*/
public synchronized void logSuggestions(IgniteLogger log, @Nullable String igniteInstanceName) {
if (disabled)
return;
if (!F.isEmpty(perfs) && !suppressed.containsAll(perfs)) {
U.quietAndInfo(log, "Performance suggestions for grid " +
(igniteInstanceName == null ? "" : '\'' + igniteInstanceName + '\'') + " (fix if possible)");
U.quietAndInfo(log, "To disable, set -D" + IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED + "=true");
for (String s : perfs)
if (!suppressed.contains(s))
U.quietAndInfo(log, " ^-- " + s);
perfs.clear();
}
U.quietAndInfo(log, "Refer to this page for more performance suggestions: " + SUGGESTIONS_LINK);
U.quietAndInfo(log, "");
}
示例2: 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);
}
}
示例3: 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);
}
}
示例4: evictAll
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public void evictAll(Collection<? extends K> keys) {
A.notNull(keys, "keys");
if (F.isEmpty(keys))
return;
if (keyCheck)
validateCacheKey(keys);
GridCacheVersion obsoleteVer = ctx.versions().next();
try {
ctx.evicts().batchEvict(keys, obsoleteVer);
}
catch (IgniteCheckedException e) {
U.error(log, "Failed to perform batch evict for keys: " + keys, e);
}
}
示例5: writeExternal
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
writeExternalMeta(out);
out.writeObject(xidVer);
out.writeBoolean(invalidate);
out.writeLong(timeout);
out.writeLong(threadId);
out.writeLong(startTime);
U.writeUuid(out, nodeId);
out.write(isolation.ordinal());
out.write(concurrency.ordinal());
out.write(state().ordinal());
}
示例6: deserialize
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Object deserialize(ByteBuffer buf) {
ByteArrayInputStream stream = null;
Input in = null;
try {
stream = new ByteArrayInputStream(buf.array());
in = new Input(stream);
return kryos.get().readClassAndObject(in);
}
catch (Throwable e) {
throw new IllegalStateException("Failed to deserialize object from byte stream", e);
}
finally {
U.closeQuiet(in);
U.closeQuiet(stream);
}
}
示例7: sendAckOnTimeout
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/**
* @param recovery Recovery descriptor.
* @param ses Session.
*/
private void sendAckOnTimeout(GridNioRecoveryDescriptor recovery, GridNioSession ses) {
if (recovery != null && recovery.lastAcknowledged() != recovery.received()) {
RecoveryLastReceivedMessage msg = new RecoveryLastReceivedMessage(recovery.received());
if (log.isDebugEnabled()) {
log.debug("Send recovery acknowledgement on timeout [rmtNode=" + recovery.node().id() +
", rcvCnt=" + msg.received() +
", lastAcked=" + recovery.lastAcknowledged() + ']');
}
try {
nioSrvr.sendSystem(ses, msg);
recovery.lastAcknowledged(msg.received());
}
catch (IgniteCheckedException e) {
U.error(log, "Failed to send message: " + e, e);
}
}
}
示例8: testAppendUpdateNoClose
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/**
* Test update on the file when it was opened for write(create) and is not closed yet.
*
* @throws Exception If failed.
*/
public void testAppendUpdateNoClose() throws Exception {
if (dual)
return;
if (appendSupported()) {
Map<String, String> props = properties("owner", "group", "0555");
create(igfs, paths(DIR, SUBDIR), null);
createFile(igfs, FILE, false);
IgfsOutputStream os = null;
try {
os = igfs.append(FILE, false);
if (permissionsSupported())
igfs.update(FILE, props);
os.close();
} finally {
U.closeQuiet(os);
}
}
}
示例9: getLocalDeployment
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/**
* @param rsrcName Class name.
* @return Grid cached task.
*/
@Nullable public GridDeployment getLocalDeployment(String rsrcName) {
if (locDep != null)
return locDep;
String lambdaEnclosingClsName = U.lambdaEnclosingClassName(rsrcName);
String clsName = lambdaEnclosingClsName == null ? rsrcName : lambdaEnclosingClsName;
GridDeploymentMetadata meta = new GridDeploymentMetadata();
meta.record(true);
meta.deploymentMode(ctx.config().getDeploymentMode());
meta.alias(rsrcName);
meta.className(clsName);
meta.senderNodeId(ctx.localNodeId());
return locStore.getDeployment(meta);
}
示例10: checkOneNode
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/**
* Starts the local node and checks for presence of log file.
* Also checks that this is really a log of a started node.
*
* @param id Test-local node ID.
* @throws Exception If error occurred.
*/
private void checkOneNode(int id) throws Exception {
try (Ignite ignite = G.start(getConfiguration("grid" + id))) {
String id8 = U.id8(ignite.cluster().localNode().id());
String logPath = "work/log/ignite-" + id8 + ".log";
File logFile = U.resolveIgnitePath(logPath);
assertNotNull("Failed to resolve path: " + logPath, logFile);
assertTrue("Log file does not exist: " + logFile, logFile.exists());
String logContent = U.readFileToString(logFile.getAbsolutePath(), "UTF-8");
assertTrue("Log file does not contain it's node ID: " + logFile,
logContent.contains(">>> Local node [ID=" + id8.toUpperCase()));
}
}
示例11: sendDhtPrimaryResponse
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/**
* @param nodeId Primary node ID.
* @param req Request.
* @param dhtRes Response to send.
*/
private void sendDhtPrimaryResponse(UUID nodeId,
GridDhtAtomicAbstractUpdateRequest req,
GridDhtAtomicUpdateResponse dhtRes) {
try {
ctx.io().send(nodeId, dhtRes, ctx.ioPolicy());
if (msgLog.isDebugEnabled()) {
msgLog.debug("Sent DHT response [futId=" + req.futureId() +
", nearFutId=" + req.nearFutureId() +
", writeVer=" + req.writeVersion() +
", node=" + nodeId + ']');
}
}
catch (ClusterTopologyCheckedException ignored) {
U.warn(msgLog, "Failed to send DHT response, node left [futId=" + req.futureId() +
", nearFutId=" + req.nearFutureId() +
", node=" + nodeId + ']');
}
catch (IgniteCheckedException e) {
U.error(msgLog, "Failed to send DHT near response [futId=" + req.futureId() +
", nearFutId=" + req.nearFutureId() +
", node=" + nodeId +
", res=" + dhtRes + ']', e);
}
}
示例12: checkWeakQueue
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/**
* Closes unreachable iterators.
*/
public void checkWeakQueue() {
for (Reference itRef = refQueue.poll(); itRef != null;
itRef = refQueue.poll()) {
try {
WeakReference weakRef = (WeakReference)itRef;
AutoCloseable rsrc = refs.remove(weakRef);
if (rsrc != null)
rsrc.close();
}
catch (Exception e) {
U.error(log, "Failed to close iterator.", e);
}
}
}
示例13: get
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public long get() {
checkRemoved();
try {
GridCacheAtomicLongValue val = cacheView.get(key);
if (val == null)
throw new IgniteException("Failed to find atomic long: " + name);
return val.get();
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
}
}
示例14: doTestDeadlocksTxOnPrimary
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/**
* @param cache Cache.
* @param startKey Start key.
*/
private void doTestDeadlocksTxOnPrimary(IgniteCache cache, Object startKey) {
try {
awaitPartitionMapExchange();
doTestDeadlock(3, false, false, startKey, true);
doTestDeadlock(4, false, false, startKey, true);
}
catch (Throwable e) {
U.error(log, "Unexpected exception: ", e);
//TODO "if" statement will be removed after fixing https://issues.apache.org/jira/browse/IGNITE-6445
if (!e.getMessage().equals("Failed to detect deadlock"))
fail();
}
finally {
if (cache != null)
cache.destroy();
}
}
示例15: setNodeId
import org.apache.ignite.internal.util.typedef.internal.U; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public void setNodeId(UUID nodeId) {
A.notNull(nodeId, "nodeId");
this.nodeId = nodeId;
// Set nodeId as system variable to be used at configuration.
System.setProperty(NODE_ID, U.id8(nodeId));
if (inited) {
final LoggerContext ctx = impl.getContext();
synchronized (mux) {
inited = false;
}
addConsoleAppenderIfNeeded(new C1<Boolean, Logger>() {
@Override public Logger apply(Boolean init) {
if (init)
ctx.reconfigure();
return (Logger)LogManager.getRootLogger();
}
});
}
}