hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: JavaDocs for DistCp (or similar)
Date Thu, 18 Feb 2010 14:40:36 GMT
Tsz Wo (Nicholas), Sze wrote:
> Hi Balu,
> Unfortunately, DistCp does not have a public Java API.  One simple way is to invoke DistCp.main(args)
in your java program, where args is an array of the string arguments you would pass in the
command line.

That's a method with System.exit() in, so either you run under a 
security manager or your app fails without warning

Better to create your own Configuration instance, then a new DistCp object

DistCp distcp = new DistCp(conf);
int res = ToolRunner.run(distcp, args);

It's still going to log at System.out/System.err instead of a log API, 
but your JVM should stay around without you having to jump through 
security manager hoops

View raw message