本文整理汇总了Java中org.apache.ignite.IgniteLogger类的典型用法代码示例。如果您正苦于以下问题:Java IgniteLogger类的具体用法?Java IgniteLogger怎么用?Java IgniteLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IgniteLogger类属于org.apache.ignite包,在下文中一共展示了IgniteLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logSuggestions
import org.apache.ignite.IgniteLogger; //导入依赖的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: start
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* Starts child process runner.
*/
public void start(HadoopExternalCommunication comm, HadoopProcessDescriptor nodeDesc,
ExecutorService msgExecSvc, IgniteLogger parentLog)
throws IgniteCheckedException {
this.comm = comm;
this.nodeDesc = nodeDesc;
this.msgExecSvc = msgExecSvc;
comm.setListener(new MessageListener());
log = parentLog.getLogger(HadoopChildProcessRunner.class);
startTime = U.currentTimeMillis();
// At this point node knows that this process has started.
comm.sendMessage(this.nodeDesc, new HadoopProcessStartedAck());
}
示例3: connectEndpoint
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* Connects to open server IPC endpoint.
*
* @param endpointAddr Endpoint address.
* @param log Log.
* @return Connected client endpoint.
* @throws IgniteCheckedException If failed to establish connection.
*/
public static IpcEndpoint connectEndpoint(String endpointAddr, IgniteLogger log) throws IgniteCheckedException {
A.notNull(endpointAddr, "endpointAddr");
String[] split = endpointAddr.split(":");
int port;
if (split.length == 2) {
try {
port = Integer.parseInt(split[1]);
}
catch (NumberFormatException e) {
throw new IgniteCheckedException("Failed to parse port number: " + endpointAddr, e);
}
}
else
// Use default port.
port = -1;
return "shmem".equalsIgnoreCase(split[0]) ?
connectSharedMemoryEndpoint(port > 0 ? port : IpcSharedMemoryServerEndpoint.DFLT_IPC_PORT, log) :
connectTcpEndpoint(split[0], port > 0 ? port : IpcServerTcpEndpoint.DFLT_IPC_PORT);
}
示例4: printErrors
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* Prints errors.
*
* @param log Logger.
*/
public void printErrors(IgniteLogger log) {
int size = q.size();
Iterator<ExceptionInfo> descIter = q.descendingIterator();
for (int i = 0; i < size && descIter.hasNext(); i++) {
ExceptionInfo error = descIter.next();
U.error(
log,
"Error: " + (i + 1) + U.nl() +
" Time: " + new Date(error.time()) + U.nl() +
" Error: " + error.message() + U.nl() +
" Thread ID: " + error.threadId() + U.nl() +
" Thread name: " + error.threadName(),
error.error()
);
}
}
示例5: addOrderedHandler
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
private void addOrderedHandler(GridCacheSharedContext cctx, boolean cacheGrp, Object topic, IgniteBiInClosure<UUID, ? extends GridCacheMessage> c) {
MessageHandlers msgHandlers = cacheGrp ? grpHandlers : cacheHandlers;
IgniteLogger log0 = log;
if (msgHandlers.orderedHandlers.putIfAbsent(topic, c) == null) {
cctx.gridIO().addMessageListener(topic, new OrderedMessageListener(
(IgniteBiInClosure<UUID, GridCacheMessage>)c));
if (log0 != null && log0.isTraceEnabled())
log0.trace("Registered ordered cache communication handler [topic=" + topic + ", handler=" + c + ']');
}
else if (log0 != null)
U.warn(log0, "Failed to register ordered cache communication handler because it is already " +
"registered for this topic [topic=" + topic + ", handler=" + c + ']');
}
示例6: IpcToNioAdapter
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* @param metricsLsnr Metrics listener.
* @param log Log.
* @param endp Endpoint.
* @param lsnr Listener.
* @param writerFactory Writer factory.
* @param filters Filters.
*/
public IpcToNioAdapter(GridNioMetricsListener metricsLsnr, IgniteLogger log, IpcEndpoint endp,
GridNioServerListener<T> lsnr, GridNioMessageWriterFactory writerFactory, GridNioFilter... filters) {
assert metricsLsnr != null;
this.metricsLsnr = metricsLsnr;
this.endp = endp;
this.writerFactory = writerFactory;
chain = new GridNioFilterChain<>(log, lsnr, new HeadFilter(), filters);
ses = new GridNioSessionImpl(chain, null, null, true);
writeBuf = ByteBuffer.allocate(8 << 10);
writeBuf.order(ByteOrder.nativeOrder());
}
示例7: split
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
Collection<ComputeJob> jobs = new ArrayList<>(JOB_COUNT);
for (int i = 0; i < JOB_COUNT; i++) {
jobs.add(new ComputeJobAdapter(i) {
@LoggerResource
private IgniteLogger log;
@Override public Serializable execute() {
if (log.isInfoEnabled())
log.info("Executing job [index=" + argument(0) + ']');
return argument(0);
}
});
}
return jobs;
}
示例8: StandaloneWalRecordsIterator
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* Creates iterator in file-by-file iteration mode. Directory
* @param log Logger.
* @param sharedCtx Shared context. Cache processor is to be configured if Cache Object Key & Data Entry is
* required.
* @param ioFactory File I/O factory.
* @param workDir Work directory is scanned, false - archive
* @param keepBinary Keep binary. This flag disables converting of non primitive types
* (BinaryObjects will be used instead)
* @param walFiles Wal files.
*/
StandaloneWalRecordsIterator(
@NotNull IgniteLogger log,
@NotNull GridCacheSharedContext sharedCtx,
@NotNull FileIOFactory ioFactory,
boolean workDir,
boolean keepBinary,
int bufSize,
@NotNull File... walFiles) throws IgniteCheckedException {
super(log,
sharedCtx,
new RecordSerializerFactoryImpl(sharedCtx),
ioFactory,
bufSize);
this.keepBinary = keepBinary;
init(null, workDir, walFiles);
advance();
}
示例9: errorLogger
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* @param log Logger.
* @param excl Excludes.
* @return Future listener that logs errors.
*/
public static IgniteInClosure<IgniteInternalFuture<?>> errorLogger(final IgniteLogger log,
final Class<? extends Exception>... excl) {
return new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> f) {
try {
f.get();
}
catch (IgniteCheckedException e) {
if (!F.isEmpty(excl))
for (Class cls : excl)
if (e.hasCause(cls))
return;
U.error(log, "Future execution resulted in error: " + f, e);
}
}
@Override public String toString() {
return "Error logger [excludes=" + Arrays.toString(excl) + ']';
}
};
}
示例10: read
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* Reads all checkpoint data from given file. File is read as binary
* data which is than deserialized.
*
* @param file File which contains checkpoint data.
* @param m Grid marshaller.
* @param log Messages logger.
* @return Checkpoint data object read from given file.
* @throws IgniteCheckedException Thrown if data could not be converted
* to {@link SharedFsCheckpointData} object.
* @throws IOException Thrown if file read error occurred.
*/
static SharedFsCheckpointData read(File file, Marshaller m, IgniteLogger log)
throws IOException, IgniteCheckedException {
assert file != null;
assert m != null;
assert log != null;
InputStream in = new FileInputStream(file);
try {
return U.unmarshal(m, in, U.gridClassLoader());
}
finally {
U.close(in, log);
}
}
示例11: write
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* Writes given checkpoint data to a given file. Data are serialized to
* the binary stream and saved to the file.
*
* @param file File data should be saved to.
* @param data Checkpoint data.
* @param m Grid marshaller.
* @param log Messages logger.
* @throws IgniteCheckedException Thrown if data could not be marshalled.
* @throws IOException Thrown if file write operation failed.
*/
static void write(File file, SharedFsCheckpointData data, Marshaller m, IgniteLogger log)
throws IOException, IgniteCheckedException {
assert file != null;
assert m != null;
assert data != null;
assert log != null;
OutputStream out = null;
try {
out = new FileOutputStream(file);
U.marshal(m, data, out);
}
finally {
U.close(out, log);
}
}
示例12: join
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* Joins runnable.
*
* @param w Worker to join.
* @param log The logger to possible exception.
* @return {@code true} if worker has not been interrupted, {@code false} if it was interrupted.
*/
public static boolean join(@Nullable GridWorker w, @Nullable IgniteLogger log) {
if (w != null)
try {
w.join();
}
catch (InterruptedException ignore) {
warn(log, "Got interrupted while waiting for completion of runnable: " + w);
Thread.currentThread().interrupt();
return false;
}
return true;
}
示例13: marshalData
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* @param src Source.
* @param target Target.
* @param marsh Marsh.
* @param log Logger.
*/
private void marshalData(
Map<Integer, Serializable> src,
Map<Integer, byte[]> target,
Marshaller marsh,
IgniteLogger log
) {
//may happen if nothing was collected from components,
// corresponding map (for common data or for node specific data) left null
if (src == null)
return;
for (Map.Entry<Integer, Serializable> entry : src.entrySet()) {
try {
target.put(entry.getKey(), marsh.marshal(entry.getValue()));
}
catch (IgniteCheckedException e) {
U.error(log, "Failed to marshal discovery data " +
"[comp=" + entry.getKey() + ", data=" + entry.getValue() + ']', e);
}
}
}
示例14: readResolve
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* Reconstructs object on unmarshalling.
*
* @return Reconstructed object.
* @throws ObjectStreamException Thrown in case of unmarshalling error.
*/
protected Object readResolve() throws ObjectStreamException {
try {
IgniteBiTuple<String, Object> t = stash.get();
Object ctgrR = t.get2();
IgniteLogger log = IgnitionEx.localIgnite().log();
return ctgrR != null ? log.getLogger(ctgrR) : log;
}
catch (IllegalStateException e) {
throw U.withCause(new InvalidObjectException(e.getMessage()), e);
}
finally {
stash.remove();
}
}
示例15: IpcSharedMemorySpace
import org.apache.ignite.IgniteLogger; //导入依赖的package包/类
/**
* This will allocate system resources for the space.
*
* @param tokFileName Token filename.
* @param writerPid Writer PID.
* @param readerPid Reader PID.
* @param size Size in bytes.
* @param reader {@code True} if reader.
* @param parent Parent logger.
* @throws IgniteCheckedException If failed.
*/
public IpcSharedMemorySpace(String tokFileName, int writerPid, int readerPid, int size, boolean reader,
IgniteLogger parent) throws IgniteCheckedException {
assert size > 0 : "Size cannot be less than 1 byte";
log = parent.getLogger(IpcSharedMemorySpace.class);
opSize = size;
shmemPtr = IpcSharedMemoryUtils.allocateSystemResources(tokFileName, size, DEBUG && log.isDebugEnabled());
shmemId = IpcSharedMemoryUtils.sharedMemoryId(shmemPtr);
semId = IpcSharedMemoryUtils.semaphoreId(shmemPtr);
isReader = reader;
this.tokFileName = tokFileName;
this.readerPid = readerPid;
this.writerPid = writerPid;
if (DEBUG && log.isDebugEnabled())
log.debug("Shared memory space has been created: " + this);
}