use of org.apache.ignite.internal.GridLoggerProxy in project ignite by apache.
the class HadoopIgfsIpcIo method start.
/**
* Starts the IO.
*
* @throws IgniteCheckedException If failed to connect the endpoint.
*/
private void start() throws IgniteCheckedException {
boolean success = false;
try {
endpoint = IpcEndpointFactory.connectEndpoint(endpointAddr, new GridLoggerProxy(new HadoopIgfsJclLogger(log), null, null, ""));
out = new IgfsDataOutputStream(new BufferedOutputStream(endpoint.outputStream()));
reader = new ReaderThread();
// Required for Hadoop 2.x
reader.setDaemon(true);
reader.start();
success = true;
} catch (IgniteCheckedException e) {
IpcOutOfSystemResourcesException resEx = e.getCause(IpcOutOfSystemResourcesException.class);
if (resEx != null)
throw new IgniteCheckedException(IpcSharedMemoryServerEndpoint.OUT_OF_RESOURCES_MSG, resEx);
throw e;
} finally {
if (!success)
stop();
}
}
use of org.apache.ignite.internal.GridLoggerProxy in project ignite by apache.
the class GridLoggerInjectionSelfTest method testClosureMethod.
/**
* Test that closure gets right log category injected on all nodes using method injection.
*
* @throws Exception If failed.
*/
public void testClosureMethod() throws Exception {
Ignite ignite = grid(0);
ignite.compute().call(new IgniteCallable<Object>() {
@LoggerResource(categoryClass = GridLoggerInjectionSelfTest.class)
private void log(IgniteLogger log) {
if (log instanceof GridLoggerProxy) {
Object category = U.field(log, "ctgr");
assertTrue("Logger created for the wrong category.", category.toString().contains(GridLoggerInjectionSelfTest.class.getName()));
} else
fail("This test should be run with proxy logger.");
}
@Override
public Object call() throws Exception {
return null;
}
});
}
use of org.apache.ignite.internal.GridLoggerProxy in project ignite by apache.
the class GridLoggerInjectionSelfTest method testStringCategory.
/**
* Test that closure gets right log category injected through {@link org.apache.ignite.resources.LoggerResource#categoryName()}.
*
* @throws Exception If failed.
*/
public void testStringCategory() throws Exception {
Ignite ignite = grid(0);
ignite.compute().call(new IgniteCallable<Object>() {
@LoggerResource(categoryName = "GridLoggerInjectionSelfTest")
private void log(IgniteLogger log) {
if (log instanceof GridLoggerProxy) {
Object category = U.field(log, "ctgr");
assertTrue("Logger created for the wrong category.", "GridLoggerInjectionSelfTest".equals(category.toString()));
} else
fail("This test should be run with proxy logger.");
}
@Override
public Object call() throws Exception {
return null;
}
});
}
use of org.apache.ignite.internal.GridLoggerProxy in project ignite by apache.
the class GridLoggerInjectionSelfTest method testClosureField.
/**
* Test that closure gets right log category injected on all nodes using field injection.
*
* @throws Exception If failed.
*/
public void testClosureField() throws Exception {
Ignite ignite = grid(0);
ignite.compute().call(new IgniteCallable<Object>() {
@LoggerResource(categoryClass = GridLoggerInjectionSelfTest.class)
private IgniteLogger log;
@Override
public Object call() throws Exception {
if (log instanceof GridLoggerProxy) {
Object category = U.field(log, "ctgr");
assertTrue("Logger created for the wrong category.", category.toString().contains(GridLoggerInjectionSelfTest.class.getName()));
} else
fail("This test should be run with proxy logger.");
return null;
}
});
}
Aggregations