HADOOP-16657. Move remaining log4j APIs over to slf4j in hadoop-common. Contributed by Minni Mittal.
This commit is contained in:
parent
0e22e9ab83
commit
4050471b45
@ -18,8 +18,8 @@
|
||||
package org.apache.hadoop.fs.viewfs;
|
||||
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||
@ -59,7 +59,7 @@
|
||||
*/
|
||||
@Private
|
||||
final class NflyFSystem extends FileSystem {
|
||||
private static final Log LOG = LogFactory.getLog(NflyFSystem.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(NflyFSystem.class);
|
||||
private static final String NFLY_TMP_PREFIX = "_nfly_tmp_";
|
||||
|
||||
enum NflyKey {
|
||||
|
@ -1384,7 +1384,7 @@ void doAccept(SelectionKey key) throws InterruptedException, IOException, OutOf
|
||||
// If the connectionManager can't take it, close the connection.
|
||||
if (c == null) {
|
||||
if (channel.isOpen()) {
|
||||
IOUtils.cleanup(null, channel);
|
||||
IOUtils.cleanupWithLogger(LOG, channel);
|
||||
}
|
||||
connectionManager.droppedConnections.getAndIncrement();
|
||||
continue;
|
||||
@ -2823,9 +2823,9 @@ private synchronized void close() {
|
||||
LOG.debug("Ignoring socket shutdown exception", e);
|
||||
}
|
||||
if (channel.isOpen()) {
|
||||
IOUtils.cleanup(null, channel);
|
||||
IOUtils.cleanupWithLogger(LOG, channel);
|
||||
}
|
||||
IOUtils.cleanup(null, socket);
|
||||
IOUtils.cleanupWithLogger(LOG, socket);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ private static void diskIoCheckWithoutNativeIo(File file)
|
||||
}
|
||||
file = null;
|
||||
} finally {
|
||||
IOUtils.cleanup(null, fos);
|
||||
IOUtils.cleanupWithLogger(LOG, fos);
|
||||
FileUtils.deleteQuietly(file);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.LocalFileSystem;
|
||||
@ -49,6 +51,8 @@
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestBloomMapFile {
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(TestBloomMapFile.class);
|
||||
private static Configuration conf = new Configuration();
|
||||
private static final Path TEST_ROOT = new Path(GenericTestUtils.getTempPath(
|
||||
TestMapFile.class.getSimpleName()));
|
||||
@ -107,7 +111,7 @@ public void testMembershipTest() throws Exception {
|
||||
System.out.println("False positives: " + falsePos);
|
||||
assertTrue(falsePos < 2);
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +140,7 @@ private void checkMembershipVaryingSizedKeys(List<Text> keys)
|
||||
reader.close();
|
||||
fs.delete(qualifiedDirName, true);
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +177,7 @@ public void testDeleteFile() {
|
||||
} catch (Exception ex) {
|
||||
fail("unexpect ex in testDeleteFile !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,7 +206,7 @@ public void testIOExceptionInWriterConstructor() {
|
||||
} catch (Exception ex) {
|
||||
fail("unexpect ex in testIOExceptionInWriterConstructor !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,7 +241,7 @@ public void testGetBloomMapFile() {
|
||||
} catch (Exception ex) {
|
||||
fail("unexpect ex in testGetBloomMapFile !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +290,7 @@ public void testBloomMapFileConstructors() {
|
||||
} catch (Exception ex) {
|
||||
fail("testBloomMapFileConstructors error !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.LocalFileSystem;
|
||||
@ -48,7 +50,7 @@
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public class TestMapFile {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TestMapFile.class);
|
||||
private static final Path TEST_DIR = new Path(GenericTestUtils.getTempPath(
|
||||
TestMapFile.class.getSimpleName()));
|
||||
|
||||
@ -187,7 +189,7 @@ public void testGetClosestOnCurrentApi() throws Exception {
|
||||
closest = (Text) reader.getClosest(key, value, true);
|
||||
assertEquals(new Text("91"), closest);
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +213,7 @@ public void testMidKeyOnCurrentApi() throws Exception {
|
||||
reader = createReader(TEST_PREFIX, IntWritable.class);
|
||||
assertEquals(new IntWritable((SIZE - 1) / 2), reader.midKey());
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,7 +235,7 @@ public void testRename() {
|
||||
} catch (IOException ex) {
|
||||
fail("testRename error " + ex);
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,7 +267,7 @@ public void testRenameWithException() {
|
||||
assertEquals("testRenameWithException invalid IOExceptionMessage !!!",
|
||||
ex.getMessage(), ERROR_MESSAGE);
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,7 +294,7 @@ public void testRenameWithFalse() {
|
||||
assertTrue("testRenameWithFalse invalid IOExceptionMessage error !!!", ex
|
||||
.getMessage().startsWith(ERROR_MESSAGE));
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,7 +321,7 @@ public void testWriteWithFailDirCreation() {
|
||||
assertTrue("testWriteWithFailDirCreation ex error !!!", ex.getMessage()
|
||||
.startsWith(ERROR_MESSAGE));
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -347,7 +349,7 @@ public void testOnFinalKey() {
|
||||
} catch (IOException ex) {
|
||||
fail("testOnFinalKey error !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,7 +394,7 @@ public void testReaderGetClosest() throws Exception {
|
||||
} catch (IOException ex) {
|
||||
/* Should be thrown to pass the test */
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -410,7 +412,7 @@ public void testReaderWithWrongValueClass() {
|
||||
} catch (IOException ex) {
|
||||
/* Should be thrown to pass the test */
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -451,7 +453,7 @@ public void testReaderKeyIteration() {
|
||||
} catch (IOException ex) {
|
||||
fail("reader seek error !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,7 +484,7 @@ public void testFix() {
|
||||
} catch (Exception ex) {
|
||||
fail("testFix error !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -588,7 +590,7 @@ public void testDeprecatedConstructors() {
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -607,7 +609,7 @@ public void testKeyLessWriterCreation() {
|
||||
} catch (Exception e) {
|
||||
fail("fail in testKeyLessWriterCreation. Other ex !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@ -636,7 +638,7 @@ public void testPathExplosionWriterCreation() {
|
||||
} catch (Exception e) {
|
||||
fail("fail in testPathExplosionWriterCreation. Other ex !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -657,7 +659,7 @@ public void testDescOrderWithThrowExceptionWriterAppend() {
|
||||
} catch (Exception e) {
|
||||
fail("testDescOrderWithThrowExceptionWriterAppend other ex throw !!!");
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer);
|
||||
IOUtils.cleanupWithLogger(LOG, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -745,7 +747,7 @@ public void testGetClosest() throws Exception {
|
||||
closest = (Text) reader.getClosest(key, value, true);
|
||||
assertEquals(new Text("90"), closest);
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
@ -768,7 +770,7 @@ public void testMidKey() throws Exception {
|
||||
reader = new MapFile.Reader(qualifiedDirName, conf);
|
||||
assertEquals(new IntWritable(1), reader.midKey());
|
||||
} finally {
|
||||
IOUtils.cleanup(null, writer, reader);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, reader);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user