private void startTrashEmptier(final Configuration conf) throws IOException { long trashInterval = conf.getLong(FS_TRASH_INTERVAL_KEY, FS_TRASH_INTERVAL_DEFAULT); if (trashInterval == 0) { return; } else if (trashInterval < 0) { throw new IOException("Cannot start trash emptier with negative interval." + " Set " + FS_TRASH_INTERVAL_KEY + " to a positive value."); } // This may be called from the transitionToActive code path, in which // case the current user is the administrator, not the NN. The trash // emptier needs to run as the NN. See HDFS-3972. FileSystem fs = SecurityUtil.doAsLoginUser( new PrivilegedExceptionAction<FileSystem>() { @Override public FileSystem run() throws IOException { return FileSystem.get(conf); } }); this.emptier = new Thread(new Trash(fs, conf).getEmptier(), "Trash Emptier"); this.emptier.setDaemon(true); this.emptier.start(); }
/** Run an emptier.*/ public static void main(String[] args) throws Exception { new Trash(new Configuration()).getEmptier().run(); } }
/** Run an emptier.*/ public static void main(String[] args) throws Exception { new Trash(new Configuration()).getEmptier().run(); }
private void startTrashEmptier(Configuration conf) throws IOException { if (conf.getInt("fs.trash.interval", 0) == 0) { return; } FileSystem fs = NameNode.getTrashFileSystem(conf); this.trash = new Trash(fs, conf); this.emptier = new Thread(trash.getEmptier(), "Trash Emptier"); this.emptier.setDaemon(true); this.emptier.start(); }
private void startTrashEmptier(final Configuration conf) throws IOException { long trashInterval = conf.getLong(FS_TRASH_INTERVAL_KEY, FS_TRASH_INTERVAL_DEFAULT); if (trashInterval == 0) { return; } else if (trashInterval < 0) { throw new IOException("Cannot start trash emptier with negative interval." + " Set " + FS_TRASH_INTERVAL_KEY + " to a positive value."); } // This may be called from the transitionToActive code path, in which // case the current user is the administrator, not the NN. The trash // emptier needs to run as the NN. See HDFS-3972. FileSystem fs = SecurityUtil.doAsLoginUser( new PrivilegedExceptionAction<FileSystem>() { @Override public FileSystem run() throws IOException { return FileSystem.get(conf); } }); this.emptier = new Thread(new Trash(fs, conf).getEmptier(), "Trash Emptier"); this.emptier.setDaemon(true); this.emptier.start(); }
private void startTrashEmptier(final Configuration conf) throws IOException { long trashInterval = conf.getLong(FS_TRASH_INTERVAL_KEY, FS_TRASH_INTERVAL_DEFAULT); if (trashInterval == 0) { return; } else if (trashInterval < 0) { throw new IOException("Cannot start trash emptier with negative interval." + " Set " + FS_TRASH_INTERVAL_KEY + " to a positive value."); } // This may be called from the transitionToActive code path, in which // case the current user is the administrator, not the NN. The trash // emptier needs to run as the NN. See HDFS-3972. FileSystem fs = SecurityUtil.doAsLoginUser( new PrivilegedExceptionAction<FileSystem>() { @Override public FileSystem run() throws IOException { return FileSystem.get(conf); } }); this.emptier = new Thread(new Trash(fs, conf).getEmptier(), "Trash Emptier"); this.emptier.setDaemon(true); this.emptier.start(); }
Runnable emptier = trash.getEmptier(); Thread emptierThread = new Thread(emptier); emptierThread.start();
/** * Initialize the server * * @param address hostname:port to bind to * @param conf the configuration */ private void initialize(String address, Configuration conf) throws IOException { InetSocketAddress socAddr = NameNode.getAddress(address); this.supportAppends = conf.getBoolean("dfs.support.append", true); this.handlerCount = conf.getInt("dfs.namenode.handler.count", 10); this.server = RPC.getServer(this, socAddr.getHostName(), socAddr.getPort(), handlerCount, false, conf); // The rpc-server port can be ephemeral... ensure we have the correct info this.nameNodeAddress = this.server.getListenerAddress(); FileSystem.setDefaultUri(conf, getUri(nameNodeAddress)); LOG.info("Namenode up at: " + this.nameNodeAddress); myMetrics = new NameNodeMetrics(conf, this); this.namesystem = new FSNamesystem(this, conf); this.server.start(); //start RPC server this.emptier = new Thread(new Trash(conf).getEmptier(), "Trash Emptier"); this.emptier.setDaemon(true); this.emptier.start(); }
Runnable emptier = trash.getEmptier(); Thread emptierThread = new Thread(emptier); emptierThread.start();
Runnable emptier = trash.getEmptier(); Thread emptierThread = new Thread(emptier); emptierThread.start();