本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.warn方法的典型用法代码示例。如果您正苦于以下问题:Java U.warn方法的具体用法?Java U.warn怎么用?Java U.warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.warn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readMetadata
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Reads binary metadata for given typeId.
*
* @param typeId typeId of BinaryMetadata to be read.
*/
private BinaryMetadata readMetadata(int typeId) {
File file = new File(workDir, Integer.toString(typeId) + ".bin");
if (!file.exists())
return null;
try (FileInputStream in = new FileInputStream(file)) {
return U.unmarshal(ctx.config().getMarshaller(), in, U.resolveClassLoader(ctx.config()));
}
catch (Exception e) {
U.warn(log, "Failed to restore metadata from file: " + file.getName() +
"; exception was thrown: " + e.getMessage());
}
return null;
}
示例2: onResult
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param res Response.
*/
public void onResult(UUID nodeId, TxLocksResponse res) {
boolean set = compareAndSet(nodeId, null);
if (res != null && set) {
if (res.classError() != null) {
IgniteLogger log = cctx.kernalContext().log(this.getClass());
U.warn(log, "Failed to finish deadlock detection due to an error: " + nodeId);
onDone();
}
else
detect(res);
}
else
onDone();
}
示例3: sendRetry
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param node Node.
* @param reqId Request ID.
* @param segmentId Index segment ID.
*/
private void sendRetry(ClusterNode node, long reqId, int segmentId) {
try {
boolean loc = node.isLocal();
GridQueryNextPageResponse msg = new GridQueryNextPageResponse(reqId, segmentId,
/*qry*/0, /*page*/0, /*allRows*/0, /*cols*/1,
loc ? null : Collections.<Message>emptyList(),
loc ? Collections.<Value[]>emptyList() : null,
false);
msg.retry(h2.readyTopologyVersion());
if (loc)
h2.reduceQueryExecutor().onMessage(ctx.localNodeId(), msg);
else
ctx.io().sendToGridTopic(node, GridTopic.TOPIC_QUERY, msg, QUERY_POOL);
}
catch (Exception e) {
U.warn(log, "Failed to send retry message: " + e.getMessage());
}
}
示例4: shutdownNow
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Shutdowns given {@code ExecutorService} and wait for executor service to stop.
*
* @param owner The ExecutorService owner.
* @param exec ExecutorService to shutdown.
* @param log The logger to possible exceptions and warnings.
*/
public static void shutdownNow(Class<?> owner, @Nullable ExecutorService exec, @Nullable IgniteLogger log) {
if (exec != null) {
List<Runnable> tasks = exec.shutdownNow();
if (!F.isEmpty(tasks))
U.warn(log, "Runnable tasks outlived thread pool executor service [owner=" + getSimpleName(owner) +
", tasks=" + tasks + ']');
try {
exec.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
catch (InterruptedException ignored) {
warn(log, "Got interrupted while waiting for executor service to stop.");
exec.shutdownNow();
// Preserve interrupt status.
Thread.currentThread().interrupt();
}
}
}
示例5: onMessage
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void onMessage(UUID nodeId, Object msg, byte plc) {
if (msg instanceof IgfsFragmentizerRequest ||
msg instanceof IgfsSyncMessage) {
if (log.isDebugEnabled())
log.debug("Received fragmentizer request from remote node [nodeId=" + nodeId +
", msg=" + msg + ']');
IgniteBiTuple<UUID, IgfsCommunicationMessage> tup = F.t(nodeId, (IgfsCommunicationMessage)msg);
try {
if (!msgs.offer(tup, MSG_OFFER_TIMEOUT, TimeUnit.MILLISECONDS)) {
U.error(log, "Failed to process fragmentizer communication message (will discard) " +
"[nodeId=" + nodeId + ", msg=" + msg + ']');
}
}
catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
U.warn(log, "Failed to process fragmentizer communication message (thread was interrupted) "+
"[nodeId=" + nodeId + ", msg=" + msg + ']');
}
}
}
示例6: removeItem
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected void removeItem(long rmvIdx) throws IgniteCheckedException {
Long idx = (Long)cache.invoke(queueKey, new RemoveProcessor(id, rmvIdx)).get();
if (idx != null) {
checkRemoved(idx);
QueueItemKey key = itemKey(idx);
if (cache.remove(key))
return;
long stop = U.currentTimeMillis() + RETRY_TIMEOUT;
while (U.currentTimeMillis() < stop) {
if (cache.remove(key))
return;
}
U.warn(log, "Failed to remove item, [queue=" + queueName + ", idx=" + idx + ']');
}
}
示例7: onSpiContextDestroyed
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
@Override
public void onSpiContextDestroyed() {
if (!closeGuard.compareAndSet(false, true)) {
U.warn(log, "Redis IP Finder can't be closed more than once.");
return;
}
if (log.isInfoEnabled())
log.info("Destroying Redis IP Finder.");
super.onSpiContextDestroyed();
}
示例8: applyPluginsData
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param nodeId Node id.
* @param pluginsData Plugins data.
*/
private void applyPluginsData(UUID nodeId, Map<String, Serializable> pluginsData) {
for (Map.Entry<String, Serializable> e : pluginsData.entrySet()) {
PluginProvider provider = plugins.get(e.getKey());
if (provider != null)
provider.receiveDiscoveryData(nodeId, e.getValue());
else
U.warn(log, "Received discovery data for unknown plugin: " + e.getKey());
}
}
示例9: validateCacheGroupsAttributesMismatch
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param cfg1 Existing configuration.
* @param cfg2 Cache configuration to start.
* @param attrName Short attribute name for error message.
* @param attrMsg Full attribute name for error message.
* @param val1 Attribute value in existing configuration.
* @param val2 Attribute value in starting configuration.
* @param fail If true throws IgniteCheckedException in case of attribute values mismatch, otherwise logs warning.
* @throws IgniteCheckedException If validation failed.
*/
public static void validateCacheGroupsAttributesMismatch(IgniteLogger log,
CacheConfiguration cfg1,
CacheConfiguration cfg2,
String attrName,
String attrMsg,
Object val1,
Object val2,
boolean fail) throws IgniteCheckedException {
if (F.eq(val1, val2))
return;
if (fail) {
throw new IgniteCheckedException(attrMsg + " mismatch for caches related to the same group " +
"[groupName=" + cfg1.getGroupName() +
", existingCache=" + cfg1.getName() +
", existing" + capitalize(attrName) + "=" + val1 +
", startingCache=" + cfg2.getName() +
", starting" + capitalize(attrName) + "=" + val2 + ']');
}
else {
U.warn(log, attrMsg + " mismatch for caches related to the same group " +
"[groupName=" + cfg1.getGroupName() +
", existingCache=" + cfg1.getName() +
", existing" + capitalize(attrName) + "=" + val1 +
", startingCache=" + cfg2.getName() +
", starting" + capitalize(attrName) + "=" + val2 + ']');
}
}
示例10: failover
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top) {
failedOverJobs.add(ctx.getJobResult().getJobContext());
// Clear failed nodes list - allow to failover on the same node.
ctx.getJobResult().getJobContext().setAttribute(FAILED_NODE_LIST_ATTR, null);
// Account for maximum number of failover attempts since we clear failed node list.
Integer failoverCnt = ctx.getJobResult().getJobContext().getAttribute(FAILOVER_NUMBER_ATTR);
if (failoverCnt == null)
ctx.getJobResult().getJobContext().setAttribute(FAILOVER_NUMBER_ATTR, 1);
else {
if (failoverCnt >= getMaximumFailoverAttempts()) {
U.warn(log, "Job failover failed because number of maximum failover attempts is exceeded " +
"[failedJob=" + ctx.getJobResult().getJob() + ", maxFailoverAttempts=" +
getMaximumFailoverAttempts() + ']');
return null;
}
ctx.getJobResult().getJobContext().setAttribute(FAILOVER_NUMBER_ATTR, failoverCnt + 1);
}
List<ClusterNode> cp = new ArrayList<>(top);
// Keep collection type.
F.retain(cp, false, new IgnitePredicate<ClusterNode>() {
@Override public boolean apply(ClusterNode node) {
return F.isAll(node, filter);
}
});
return super.failover(ctx, cp); //use cp to ensure we don't failover on failed node
}
示例11: dumpDebugInfo
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
*
*/
public void dumpDebugInfo() {
if (!pendingAssignmentFetchFuts.isEmpty()) {
U.warn(log, "Pending assignment fetch futures:");
for (GridDhtAssignmentFetchFuture fut : pendingAssignmentFetchFuts.values())
U.warn(log, ">>> " + fut);
}
}
示例12: fileMd5
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Calculates md5 checksum for the given file
*
* @param file file to calculate md5.
* @param log logger to log all failures.
* @return string representation of the calculated checksum or {@code null} if calculation failed.
*/
@Nullable public static String fileMd5(@Nullable File file, @Nullable IgniteLogger log) {
String md5 = null;
if (file != null) {
if (!file.isFile()) {
U.warn(log, "Failed to find file for md5 calculation: " + file);
return null;
}
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(file));
md5 = DigestUtils.md5Hex(in);
}
catch (IOException e) {
U.warn(log, "Failed to open input stream for md5 calculation: " + e.getMessage());
}
finally {
U.closeQuiet(in);
}
}
return md5;
}
示例13: deleteFromResourceBase
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param fileName File name.
*/
private void deleteFromResourceBase(String fileName) {
File file = new File(rsrcBase + '/' + fileName);
if (!file.delete())
U.warn(log, "Could not delete file: " + file);
}
示例14: start
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
@Override public void start() throws IgniteException {
if (sesFactory == null && F.isEmpty(hibernateCfgPath))
throw new IgniteException("Either session factory or Hibernate configuration file is required by " +
getClass().getSimpleName() + '.');
if (!F.isEmpty(hibernateCfgPath)) {
if (sesFactory == null) {
try {
URL url = new URL(hibernateCfgPath);
sesFactory = new Configuration().configure(url).buildSessionFactory();
}
catch (MalformedURLException ignored) {
// No-op.
}
if (sesFactory == null) {
File cfgFile = new File(hibernateCfgPath);
if (cfgFile.exists())
sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
}
if (sesFactory == null)
sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
if (sesFactory == null)
throw new IgniteException("Failed to resolve Hibernate configuration file: " + hibernateCfgPath);
closeSesOnStop = true;
}
else
U.warn(log, "Hibernate configuration file configured in " + getClass().getSimpleName() +
" will be ignored (session factory is already set).");
}
}
示例15: writeErrorData
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Write error data.
* @param err Error.
* @param writer Writer.
* @param log Optional logger.
*/
public static void writeErrorData(Throwable err, BinaryRawWriterEx writer, @Nullable IgniteLogger log) {
// Write additional data if needed.
if (err instanceof PlatformExtendedException) {
PlatformExtendedException err0 = (PlatformExtendedException)err;
writer.writeBoolean(true); // Data exists.
int pos = writer.out().position();
try {
writer.writeBoolean(true); // Optimistically assume that we will be able to write it.
err0.writeData(writer);
}
catch (Exception e) {
if (log != null)
U.warn(log, "Failed to write interop exception data: " + e.getMessage(), e);
writer.out().position(pos);
writer.writeBoolean(false); // Error occurred.
writer.writeString(e.getClass().getName());
String innerMsg;
try {
innerMsg = e.getMessage();
}
catch (Exception ignored) {
innerMsg = "Exception message is not available.";
}
writer.writeString(innerMsg);
}
}
else
writer.writeBoolean(false);
}