YARN-6873. Moving logging APIs over to slf4j in hadoop-yarn-server-applicationhistoryservice. Contributed by Yeliang Cang.
This commit is contained in:
parent
3f50800d41
commit
9fd5a03611
|
@ -22,8 +22,6 @@ import java.io.IOException;
|
|||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||
|
@ -61,11 +59,13 @@ import org.apache.hadoop.yarn.ipc.YarnRPC;
|
|||
import org.apache.hadoop.yarn.server.timeline.security.authorize.TimelinePolicyProvider;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ApplicationHistoryClientService extends AbstractService implements
|
||||
ApplicationHistoryProtocol {
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(ApplicationHistoryClientService.class);
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(ApplicationHistoryClientService.class);
|
||||
private ApplicationHistoryManager history;
|
||||
private Server server;
|
||||
private InetSocketAddress bindAddress;
|
||||
|
|
|
@ -23,8 +23,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.service.AbstractService;
|
||||
|
@ -42,11 +40,13 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Container
|
|||
import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ApplicationHistoryManagerImpl extends AbstractService implements
|
||||
ApplicationHistoryManager {
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(ApplicationHistoryManagerImpl.class);
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(ApplicationHistoryManagerImpl.class);
|
||||
private static final String UNAVAILABLE = "N/A";
|
||||
|
||||
private ApplicationHistoryStore historyStore;
|
||||
|
|
|
@ -28,8 +28,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.security.authorize.AuthorizationException;
|
||||
|
@ -69,12 +67,14 @@ import org.apache.hadoop.yarn.util.ConverterUtils;
|
|||
import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
|
||||
implements
|
||||
ApplicationHistoryManager {
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(ApplicationHistoryManagerOnTimelineStore.class);
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(ApplicationHistoryManagerOnTimelineStore.class);
|
||||
|
||||
@VisibleForTesting
|
||||
static final String UNAVAILABLE = "N/A";
|
||||
|
|
|
@ -22,8 +22,6 @@ import java.io.IOException;
|
|||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.http.HttpServer2;
|
||||
|
@ -60,6 +58,8 @@ import org.mortbay.jetty.servlet.FilterHolder;
|
|||
import org.mortbay.jetty.webapp.WebAppContext;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* History server that keeps track of all types of history in the cluster.
|
||||
|
@ -68,8 +68,8 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
public class ApplicationHistoryServer extends CompositeService {
|
||||
|
||||
public static final int SHUTDOWN_HOOK_PRIORITY = 30;
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(ApplicationHistoryServer.class);
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(ApplicationHistoryServer.class);
|
||||
|
||||
private ApplicationHistoryClientService ahsClientService;
|
||||
private ApplicationACLsManager aclsManager;
|
||||
|
@ -178,7 +178,7 @@ public class ApplicationHistoryServer extends CompositeService {
|
|||
appHistoryServer.init(conf);
|
||||
appHistoryServer.start();
|
||||
} catch (Throwable t) {
|
||||
LOG.fatal("Error starting ApplicationHistoryServer", t);
|
||||
LOG.error("Error starting ApplicationHistoryServer", t);
|
||||
ExitUtil.terminate(-1, "Error starting ApplicationHistoryServer");
|
||||
}
|
||||
return appHistoryServer;
|
||||
|
|
|
@ -30,8 +30,6 @@ import java.util.Map.Entry;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
|
@ -74,6 +72,8 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.impl.pb.C
|
|||
import org.apache.hadoop.yarn.util.ConverterUtils;
|
||||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* File system implementation of {@link ApplicationHistoryStore}. In this
|
||||
|
@ -89,8 +89,8 @@ import com.google.protobuf.InvalidProtocolBufferException;
|
|||
public class FileSystemApplicationHistoryStore extends AbstractService
|
||||
implements ApplicationHistoryStore {
|
||||
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(FileSystemApplicationHistoryStore.class);
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(FileSystemApplicationHistoryStore.class);
|
||||
|
||||
private static final String ROOT_DIR_NAME = "ApplicationHistoryDataRoot";
|
||||
private static final int MIN_BLOCK_SIZE = 256 * 1024;
|
||||
|
@ -141,7 +141,7 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
}
|
||||
outstandingWriters.clear();
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, fs);
|
||||
IOUtils.cleanupWithLogger(LOG, fs);
|
||||
}
|
||||
super.serviceStop();
|
||||
}
|
||||
|
@ -711,12 +711,12 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
}
|
||||
|
||||
public void reset() throws IOException {
|
||||
IOUtils.cleanup(LOG, scanner);
|
||||
IOUtils.cleanupWithLogger(LOG, scanner);
|
||||
scanner = reader.createScanner();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
IOUtils.cleanup(LOG, scanner, reader, fsdis);
|
||||
IOUtils.cleanupWithLogger(LOG, scanner, reader, fsdis);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -740,13 +740,13 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
YarnConfiguration.DEFAULT_FS_APPLICATION_HISTORY_STORE_COMPRESSION_TYPE), null,
|
||||
getConfig());
|
||||
} catch (IOException e) {
|
||||
IOUtils.cleanup(LOG, fsdos);
|
||||
IOUtils.cleanupWithLogger(LOG, fsdos);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void close() {
|
||||
IOUtils.cleanup(LOG, writer, fsdos);
|
||||
IOUtils.cleanupWithLogger(LOG, writer, fsdos);
|
||||
}
|
||||
|
||||
public synchronized void writeHistoryData(HistoryDataKey key, byte[] value)
|
||||
|
@ -756,13 +756,13 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
dos = writer.prepareAppendKey(-1);
|
||||
key.write(dos);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, dos);
|
||||
IOUtils.cleanupWithLogger(LOG, dos);
|
||||
}
|
||||
try {
|
||||
dos = writer.prepareAppendValue(value.length);
|
||||
dos.write(value);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, dos);
|
||||
IOUtils.cleanupWithLogger(LOG, dos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@ import javax.ws.rs.core.Response;
|
|||
import javax.ws.rs.core.StreamingOutput;
|
||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
|
@ -79,12 +77,15 @@ import com.google.inject.Inject;
|
|||
import com.google.inject.Singleton;
|
||||
import com.sun.jersey.api.client.ClientHandlerException;
|
||||
import com.sun.jersey.api.client.UniformInterfaceException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
@Path("/ws/v1/applicationhistory")
|
||||
public class AHSWebServices extends WebServices {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(AHSWebServices.class);
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(AHSWebServices.class);
|
||||
private static final String NM_DOWNLOAD_URI_STR =
|
||||
"/ws/v1/node/containers";
|
||||
private static final Joiner JOINER = Joiner.on("");
|
||||
|
|
|
@ -18,21 +18,19 @@
|
|||
|
||||
package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.commons.logging.impl.Log4JLogger;
|
||||
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||
import org.apache.hadoop.yarn.util.Log4jWarningErrorMetricsAppender;
|
||||
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
|
||||
import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
|
||||
|
||||
import static org.apache.hadoop.util.GenericsUtil.isLog4jLogger;
|
||||
|
||||
public class NavBlock extends HtmlBlock {
|
||||
|
||||
@Override
|
||||
public void render(Block html) {
|
||||
boolean addErrorsAndWarningsLink = false;
|
||||
Log log = LogFactory.getLog(NavBlock.class);
|
||||
if (log instanceof Log4JLogger) {
|
||||
if (isLog4jLogger(NavBlock.class)) {
|
||||
Log4jWarningErrorMetricsAppender appender =
|
||||
Log4jWarningErrorMetricsAppender.findAppender();
|
||||
if (appender != null) {
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
package org.apache.hadoop.yarn.server.timeline;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.service.AbstractService;
|
||||
|
@ -33,6 +31,8 @@ import org.apache.hadoop.yarn.api.records.timeline.TimelineEvents.EventsOfOneEnt
|
|||
import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse;
|
||||
import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse.TimelinePutError;
|
||||
import org.apache.hadoop.yarn.server.timeline.TimelineDataManager.CheckAcl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -71,8 +71,8 @@ abstract class KeyValueBasedTimelineStore
|
|||
|
||||
private boolean serviceStopped = false;
|
||||
|
||||
private static final Log LOG
|
||||
= LogFactory.getLog(KeyValueBasedTimelineStore.class);
|
||||
private static final Logger LOG
|
||||
= LoggerFactory.getLogger(KeyValueBasedTimelineStore.class);
|
||||
|
||||
public KeyValueBasedTimelineStore() {
|
||||
super(KeyValueBasedTimelineStore.class.getName());
|
||||
|
|
|
@ -22,8 +22,6 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
import com.google.common.base.Preconditions;
|
||||
import org.apache.commons.collections.map.LRUMap;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
|
@ -48,6 +46,7 @@ import org.apache.hadoop.yarn.server.timeline.util.LeveldbUtils.KeyParser;
|
|||
import org.apache.hadoop.yarn.server.utils.LeveldbIterator;
|
||||
import org.fusesource.leveldbjni.JniDBFactory;
|
||||
import org.iq80.leveldb.*;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -118,8 +117,8 @@ import static org.fusesource.leveldbjni.JniDBFactory.bytes;
|
|||
@InterfaceStability.Unstable
|
||||
public class LeveldbTimelineStore extends AbstractService
|
||||
implements TimelineStore {
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(LeveldbTimelineStore.class);
|
||||
private static final org.slf4j.Logger LOG = LoggerFactory
|
||||
.getLogger(LeveldbTimelineStore.class);
|
||||
|
||||
@Private
|
||||
@VisibleForTesting
|
||||
|
@ -240,7 +239,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
localFS.setPermission(dbPath, LEVELDB_DIR_UMASK);
|
||||
}
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, localFS);
|
||||
IOUtils.cleanupWithLogger(LOG, localFS);
|
||||
}
|
||||
LOG.info("Using leveldb path " + dbPath);
|
||||
try {
|
||||
|
@ -284,7 +283,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
" closing db now", e);
|
||||
}
|
||||
}
|
||||
IOUtils.cleanup(LOG, db);
|
||||
IOUtils.cleanupWithLogger(LOG, db);
|
||||
super.serviceStop();
|
||||
}
|
||||
|
||||
|
@ -320,7 +319,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
discardOldEntities(timestamp);
|
||||
Thread.sleep(ttlInterval);
|
||||
} catch (IOException e) {
|
||||
LOG.error(e);
|
||||
LOG.error(e.toString());
|
||||
} catch (InterruptedException e) {
|
||||
LOG.info("Deletion thread received interrupt, exiting");
|
||||
break;
|
||||
|
@ -394,7 +393,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
} catch(DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, iterator);
|
||||
IOUtils.cleanupWithLogger(LOG, iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -570,7 +569,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
} catch(DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, iterator);
|
||||
IOUtils.cleanupWithLogger(LOG, iterator);
|
||||
}
|
||||
return events;
|
||||
}
|
||||
|
@ -753,7 +752,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
} catch(DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, iterator);
|
||||
IOUtils.cleanupWithLogger(LOG, iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -925,7 +924,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
} finally {
|
||||
lock.unlock();
|
||||
writeLocks.returnLock(lock);
|
||||
IOUtils.cleanup(LOG, writeBatch);
|
||||
IOUtils.cleanupWithLogger(LOG, writeBatch);
|
||||
}
|
||||
|
||||
for (EntityIdentifier relatedEntity : relatedEntitiesWithoutStartTimes) {
|
||||
|
@ -1376,7 +1375,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
} catch(DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, iterator);
|
||||
IOUtils.cleanupWithLogger(LOG, iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1506,7 +1505,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
} catch(DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, writeBatch);
|
||||
IOUtils.cleanupWithLogger(LOG, writeBatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1548,7 +1547,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
LOG.error("Got IOException while deleting entities for type " +
|
||||
entityType + ", continuing to next type", e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, iterator, pfIterator);
|
||||
IOUtils.cleanupWithLogger(LOG, iterator, pfIterator);
|
||||
deleteLock.writeLock().unlock();
|
||||
if (typeCount > 0) {
|
||||
LOG.info("Deleted " + typeCount + " entities of type " +
|
||||
|
@ -1629,7 +1628,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
String incompatibleMessage =
|
||||
"Incompatible version for timeline store: expecting version "
|
||||
+ getCurrentVersion() + ", but loading version " + loadedVersion;
|
||||
LOG.fatal(incompatibleMessage);
|
||||
LOG.error(incompatibleMessage);
|
||||
throw new IOException(incompatibleMessage);
|
||||
}
|
||||
}
|
||||
|
@ -1718,7 +1717,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
} catch(DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, writeBatch);
|
||||
IOUtils.cleanupWithLogger(LOG, writeBatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1755,7 +1754,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
} catch(DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, iterator);
|
||||
IOUtils.cleanupWithLogger(LOG, iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1805,7 +1804,7 @@ public class LeveldbTimelineStore extends AbstractService
|
|||
} catch(DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, iterator);
|
||||
IOUtils.cleanupWithLogger(LOG, iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,6 @@ import java.util.Map.Entry;
|
|||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang.time.FastDateFormat;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileStatus;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
|
@ -45,6 +43,8 @@ import org.fusesource.leveldbjni.JniDBFactory;
|
|||
import org.iq80.leveldb.DB;
|
||||
import org.iq80.leveldb.Options;
|
||||
import org.iq80.leveldb.WriteBatch;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Contains the logic to lookup a leveldb by timestamp so that multiple smaller
|
||||
|
@ -54,7 +54,8 @@ import org.iq80.leveldb.WriteBatch;
|
|||
class RollingLevelDB {
|
||||
|
||||
/** Logger for this class. */
|
||||
private static final Log LOG = LogFactory.getLog(RollingLevelDB.class);
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(RollingLevelDB.class);
|
||||
/** Factory to open and create new leveldb instances. */
|
||||
private static JniDBFactory factory = new JniDBFactory();
|
||||
/** Thread safe date formatter. */
|
||||
|
@ -151,7 +152,7 @@ class RollingLevelDB {
|
|||
}
|
||||
|
||||
public void close() {
|
||||
IOUtils.cleanup(LOG, writeBatch);
|
||||
IOUtils.cleanupWithLogger(LOG, writeBatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,7 +347,7 @@ class RollingLevelDB {
|
|||
.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Entry<Long, DB> entry = iterator.next();
|
||||
IOUtils.cleanup(LOG, entry.getValue());
|
||||
IOUtils.cleanupWithLogger(LOG, entry.getValue());
|
||||
String dbName = fdf.format(entry.getKey());
|
||||
Path path = new Path(rollingDBPath, getName() + "." + dbName);
|
||||
try {
|
||||
|
@ -361,9 +362,9 @@ class RollingLevelDB {
|
|||
|
||||
public void stop() throws Exception {
|
||||
for (DB db : rollingdbs.values()) {
|
||||
IOUtils.cleanup(LOG, db);
|
||||
IOUtils.cleanupWithLogger(LOG, db);
|
||||
}
|
||||
IOUtils.cleanup(LOG, lfs);
|
||||
IOUtils.cleanupWithLogger(LOG, lfs);
|
||||
}
|
||||
|
||||
private long computeNextCheckMillis(long now) {
|
||||
|
|
|
@ -38,8 +38,6 @@ import java.util.TreeMap;
|
|||
|
||||
import org.apache.commons.collections.map.LRUMap;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
|
@ -76,6 +74,8 @@ import org.iq80.leveldb.ReadOptions;
|
|||
import org.iq80.leveldb.WriteBatch;
|
||||
import org.nustaq.serialization.FSTConfiguration;
|
||||
import org.nustaq.serialization.FSTClazzNameRegistry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
|
@ -168,8 +168,8 @@ import static org.fusesource.leveldbjni.JniDBFactory.bytes;
|
|||
@InterfaceStability.Unstable
|
||||
public class RollingLevelDBTimelineStore extends AbstractService implements
|
||||
TimelineStore {
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(RollingLevelDBTimelineStore.class);
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(RollingLevelDBTimelineStore.class);
|
||||
private static FSTConfiguration fstConf =
|
||||
FSTConfiguration.createDefaultConfiguration();
|
||||
// Fall back to 2.24 parsing if 2.50 parsing fails
|
||||
|
@ -368,9 +368,9 @@ public class RollingLevelDBTimelineStore extends AbstractService implements
|
|||
+ " closing db now", e);
|
||||
}
|
||||
}
|
||||
IOUtils.cleanup(LOG, domaindb);
|
||||
IOUtils.cleanup(LOG, starttimedb);
|
||||
IOUtils.cleanup(LOG, ownerdb);
|
||||
IOUtils.cleanupWithLogger(LOG, domaindb);
|
||||
IOUtils.cleanupWithLogger(LOG, starttimedb);
|
||||
IOUtils.cleanupWithLogger(LOG, ownerdb);
|
||||
entitydb.stop();
|
||||
indexdb.stop();
|
||||
super.serviceStop();
|
||||
|
@ -399,7 +399,7 @@ public class RollingLevelDBTimelineStore extends AbstractService implements
|
|||
discardOldEntities(timestamp);
|
||||
Thread.sleep(ttlInterval);
|
||||
} catch (IOException e) {
|
||||
LOG.error(e);
|
||||
LOG.error(e.toString());
|
||||
} catch (InterruptedException e) {
|
||||
LOG.info("Deletion thread received interrupt, exiting");
|
||||
break;
|
||||
|
@ -1525,7 +1525,7 @@ public class RollingLevelDBTimelineStore extends AbstractService implements
|
|||
+ ". Total start times deleted so far this cycle: "
|
||||
+ startTimesCount);
|
||||
}
|
||||
IOUtils.cleanup(LOG, writeBatch);
|
||||
IOUtils.cleanupWithLogger(LOG, writeBatch);
|
||||
writeBatch = starttimedb.createWriteBatch();
|
||||
batchSize = 0;
|
||||
}
|
||||
|
@ -1545,7 +1545,7 @@ public class RollingLevelDBTimelineStore extends AbstractService implements
|
|||
LOG.info("Deleted " + startTimesCount + "/" + totalCount
|
||||
+ " start time entities earlier than " + minStartTime);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, writeBatch);
|
||||
IOUtils.cleanupWithLogger(LOG, writeBatch);
|
||||
}
|
||||
return startTimesCount;
|
||||
}
|
||||
|
@ -1622,7 +1622,7 @@ public class RollingLevelDBTimelineStore extends AbstractService implements
|
|||
String incompatibleMessage = "Incompatible version for timeline store: "
|
||||
+ "expecting version " + getCurrentVersion()
|
||||
+ ", but loading version " + loadedVersion;
|
||||
LOG.fatal(incompatibleMessage);
|
||||
LOG.error(incompatibleMessage);
|
||||
throw new IOException(incompatibleMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.service.AbstractService;
|
||||
|
@ -45,6 +43,8 @@ import org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager;
|
|||
import org.apache.hadoop.yarn.webapp.BadRequestException;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The class wrap over the timeline store and the ACLs manager. It does some non
|
||||
|
@ -54,7 +54,8 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
*/
|
||||
public class TimelineDataManager extends AbstractService {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(TimelineDataManager.class);
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(TimelineDataManager.class);
|
||||
@VisibleForTesting
|
||||
public static final String DEFAULT_DOMAIN_ID = "DEFAULT";
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
|
@ -50,6 +48,8 @@ import org.iq80.leveldb.DB;
|
|||
import org.iq80.leveldb.DBException;
|
||||
import org.iq80.leveldb.Options;
|
||||
import org.iq80.leveldb.WriteBatch;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.fusesource.leveldbjni.JniDBFactory.bytes;
|
||||
|
||||
|
@ -60,8 +60,8 @@ import static org.fusesource.leveldbjni.JniDBFactory.bytes;
|
|||
public class LeveldbTimelineStateStore extends
|
||||
TimelineStateStore {
|
||||
|
||||
public static final Log LOG =
|
||||
LogFactory.getLog(LeveldbTimelineStateStore.class);
|
||||
public static final Logger LOG =
|
||||
LoggerFactory.getLogger(LeveldbTimelineStateStore.class);
|
||||
|
||||
private static final String DB_NAME = "timeline-state-store.ldb";
|
||||
private static final FsPermission LEVELDB_DIR_UMASK = FsPermission
|
||||
|
@ -103,7 +103,7 @@ public class LeveldbTimelineStateStore extends
|
|||
localFS.setPermission(dbPath, LEVELDB_DIR_UMASK);
|
||||
}
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, localFS);
|
||||
IOUtils.cleanupWithLogger(LOG, localFS);
|
||||
}
|
||||
JniDBFactory factory = new JniDBFactory();
|
||||
try {
|
||||
|
@ -131,7 +131,7 @@ public class LeveldbTimelineStateStore extends
|
|||
|
||||
@Override
|
||||
protected void closeStorage() throws IOException {
|
||||
IOUtils.cleanup(LOG, db);
|
||||
IOUtils.cleanupWithLogger(LOG, db);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -168,8 +168,8 @@ public class LeveldbTimelineStateStore extends
|
|||
} catch (DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, ds);
|
||||
IOUtils.cleanup(LOG, batch);
|
||||
IOUtils.cleanupWithLogger(LOG, ds);
|
||||
IOUtils.cleanupWithLogger(LOG, batch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ public class LeveldbTimelineStateStore extends
|
|||
key.write(dataStream);
|
||||
dataStream.close();
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, dataStream);
|
||||
IOUtils.cleanupWithLogger(LOG, dataStream);
|
||||
}
|
||||
return memStream.toByteArray();
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ public class LeveldbTimelineStateStore extends
|
|||
try {
|
||||
key.readFields(in);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, in);
|
||||
IOUtils.cleanupWithLogger(LOG, in);
|
||||
}
|
||||
state.tokenMasterKeyState.add(key);
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ public class LeveldbTimelineStateStore extends
|
|||
try {
|
||||
data.readFields(in);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, in);
|
||||
IOUtils.cleanupWithLogger(LOG, in);
|
||||
}
|
||||
state.tokenState.put(data.getTokenIdentifier(), data.getRenewDate());
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ public class LeveldbTimelineStateStore extends
|
|||
++numKeys;
|
||||
}
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, iterator);
|
||||
IOUtils.cleanupWithLogger(LOG, iterator);
|
||||
}
|
||||
return numKeys;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ public class LeveldbTimelineStateStore extends
|
|||
} catch (DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, iterator);
|
||||
IOUtils.cleanupWithLogger(LOG, iterator);
|
||||
}
|
||||
return numTokens;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ public class LeveldbTimelineStateStore extends
|
|||
try {
|
||||
state.latestSequenceNumber = in.readInt();
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, in);
|
||||
IOUtils.cleanupWithLogger(LOG, in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ public class LeveldbTimelineStateStore extends
|
|||
String incompatibleMessage =
|
||||
"Incompatible version for timeline state store: expecting version "
|
||||
+ getCurrentVersion() + ", but loading version " + loadedVersion;
|
||||
LOG.fatal(incompatibleMessage);
|
||||
LOG.error(incompatibleMessage);
|
||||
throw new IOException(incompatibleMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections.map.LRUMap;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
|
@ -41,6 +39,8 @@ import org.apache.hadoop.yarn.server.timeline.TimelineStore;
|
|||
import org.apache.hadoop.yarn.util.StringHelper;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <code>TimelineACLsManager</code> check the entity level timeline data access.
|
||||
|
@ -48,7 +48,8 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
@Private
|
||||
public class TimelineACLsManager {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(TimelineACLsManager.class);
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(TimelineACLsManager.class);
|
||||
private static final int DOMAIN_ACCESS_ENTRY_CACHE_SIZE = 100;
|
||||
|
||||
private AdminACLsManager adminAclsManager;
|
||||
|
|
|
@ -21,8 +21,6 @@ package org.apache.hadoop.yarn.server.timeline.security;
|
|||
import java.io.IOException;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
|
@ -35,6 +33,8 @@ import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier;
|
|||
import org.apache.hadoop.yarn.server.timeline.recovery.LeveldbTimelineStateStore;
|
||||
import org.apache.hadoop.yarn.server.timeline.recovery.TimelineStateStore;
|
||||
import org.apache.hadoop.yarn.server.timeline.recovery.TimelineStateStore.TimelineServiceState;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The service wrapper of {@link TimelineDelegationTokenSecretManager}
|
||||
|
@ -118,8 +118,8 @@ public class TimelineDelegationTokenSecretManagerService extends
|
|||
public static class TimelineDelegationTokenSecretManager extends
|
||||
AbstractDelegationTokenSecretManager<TimelineDelegationTokenIdentifier> {
|
||||
|
||||
public static final Log LOG =
|
||||
LogFactory.getLog(TimelineDelegationTokenSecretManager.class);
|
||||
public static final Logger LOG =
|
||||
LoggerFactory.getLogger(TimelineDelegationTokenSecretManager.class);
|
||||
|
||||
private TimelineStateStore stateStore;
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ import javax.ws.rs.core.Context;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain;
|
||||
|
@ -67,13 +65,16 @@ import org.apache.hadoop.yarn.webapp.NotFoundException;
|
|||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
@Path("/ws/v1/timeline")
|
||||
//TODO: support XML serialization/deserialization
|
||||
public class TimelineWebServices {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(TimelineWebServices.class);
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(TimelineWebServices.class);
|
||||
|
||||
private TimelineDataManager timelineDataManager;
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@ import static org.mockito.Mockito.spy;
|
|||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
|
@ -49,12 +47,14 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Container
|
|||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TestFileSystemApplicationHistoryStore extends
|
||||
ApplicationHistoryStoreTestUtils {
|
||||
|
||||
private static Log LOG = LogFactory
|
||||
.getLog(TestFileSystemApplicationHistoryStore.class.getName());
|
||||
private static final Logger LOG = LoggerFactory
|
||||
.getLogger(TestFileSystemApplicationHistoryStore.class.getName());
|
||||
|
||||
private FileSystem fs;
|
||||
private Path fsWorkingPath;
|
||||
|
|
|
@ -160,7 +160,7 @@ public class TestLeveldbTimelineStore extends TimelineStoreTestUtils {
|
|||
} catch(DBException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
IOUtils.cleanup(null, iterator, pfIterator);
|
||||
IOUtils.cleanupWithLogger(null, iterator, pfIterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue