use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class GridJobSiblingImpl method cancel.
/**
* {@inheritDoc}
*/
@Override
public void cancel() {
GridTaskSessionImpl ses = ctx.session().getSession(sesId);
Collection<ClusterNode> nodes = ses == null ? ctx.discovery().remoteNodes() : ctx.discovery().nodes(ses.getTopology());
for (ClusterNode node : nodes) {
if (!ctx.localNodeId().equals(node.id())) {
try {
ctx.io().sendToGridTopic(node, TOPIC_JOB_CANCEL, new GridJobCancelRequest(sesId, jobId), SYSTEM_POOL);
} catch (ClusterTopologyCheckedException e) {
IgniteLogger log = ctx.log(GridJobSiblingImpl.class);
if (log.isDebugEnabled())
log.debug("Failed to send cancel request, node left [nodeId=" + node.id() + ", ses=" + ses + ']');
} catch (IgniteCheckedException e) {
// Avoid stack trace for left nodes.
if (ctx.discovery().node(node.id()) != null && ctx.discovery().pingNodeNoError(node.id()))
U.error(ctx.log(GridJobSiblingImpl.class), "Failed to send cancel request to node " + "[nodeId=" + node.id() + ", ses=" + ses + ']', e);
}
}
}
// Cancel local jobs directly.
ctx.job().cancelJob(sesId, jobId, false);
}
use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class GridLoggerProxy method readResolve.
/**
* 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();
}
}
use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class IgniteUtils method logger.
/**
* Initializes logger into/from log reference passed in.
*
* @param ctx Context.
* @param logRef Log reference.
* @param cls Class to get logger for.
* @return Logger for the object.
*/
public static IgniteLogger logger(GridKernalContext ctx, AtomicReference<IgniteLogger> logRef, Class<?> cls) {
IgniteLogger log = logRef.get();
if (log == null) {
logRef.compareAndSet(null, ctx.log(cls));
log = logRef.get();
}
return log;
}
use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class IgniteNodeStartUtils method processDefaults.
/**
* Converts properties map to default specification.
*
* @param dflts Properties.
* @return Specification.
* @throws IgniteCheckedException If properties are invalid.
*/
private static IgniteRemoteStartSpecification processDefaults(@Nullable Map<String, Object> dflts) throws IgniteCheckedException {
int port = DFLT_PORT;
String uname = System.getProperty("user.name");
String passwd = null;
File key = null;
int nodes = DFLT_NODES;
String igniteHome = null;
String cfg = DFLT_CFG;
String script = null;
IgniteLogger log = null;
if (dflts != null) {
if (dflts.get(PORT) != null)
port = (Integer) dflts.get(PORT);
if (dflts.get(UNAME) != null)
uname = (String) dflts.get(UNAME);
if (dflts.get(PASSWD) != null)
passwd = (String) dflts.get(PASSWD);
if (dflts.get(KEY) != null)
key = (File) dflts.get(KEY);
if (dflts.get(NODES) != null)
nodes = (Integer) dflts.get(NODES);
if (dflts.get(IGNITE_HOME) != null)
igniteHome = (String) dflts.get(IGNITE_HOME);
if (dflts.get(CFG) != null)
cfg = (String) dflts.get(CFG);
if (dflts.get(SCRIPT) != null)
script = (String) dflts.get(SCRIPT);
if (dflts.get(LOGGER) != null)
log = (IgniteLogger) dflts.get(LOGGER);
}
if (port <= 0)
throw new IgniteCheckedException("Invalid port number: " + port);
if (nodes <= 0)
throw new IgniteCheckedException("Invalid number of nodes: " + nodes);
return new IgniteRemoteStartSpecification(null, port, uname, passwd, key, nodes, igniteHome, cfg, script, log);
}
use of org.apache.ignite.IgniteLogger in project ignite by apache.
the class GridToStringBuilderSelfTest method testToString.
/**
* @throws Exception If failed.
*/
public void testToString() throws Exception {
TestClass1 obj = new TestClass1();
IgniteLogger log = log();
log.info(obj.toStringManual());
log.info(obj.toStringAutomatic());
assertEquals(obj.toStringManual(), obj.toStringAutomatic());
}
Aggregations