use of org.apache.hadoop.hdfs.DFSClient in project hadoop by apache.
the class TestRetryCacheWithHA method testAddCacheDirectiveInfo.
@Test(timeout = 60000)
public void testAddCacheDirectiveInfo() throws Exception {
DFSClient client = genClientWithDummyHandler();
AtMostOnceOp op = new AddCacheDirectiveInfoOp(client, new CacheDirectiveInfo.Builder().setPool("pool").setPath(new Path("/path")).build());
testClientRetryWithFailover(op);
}
use of org.apache.hadoop.hdfs.DFSClient in project hadoop by apache.
the class TestDisallowModifyROSnapshot method testCreate.
@Test(timeout = 60000, expected = SnapshotAccessControlException.class)
public void testCreate() throws Exception {
@SuppressWarnings("deprecation") DFSClient dfsclient = new DFSClient(conf);
dfsclient.create(objInSnapshot.toString(), true);
}
use of org.apache.hadoop.hdfs.DFSClient in project hadoop by apache.
the class TestDisallowModifyROSnapshot method testCreateSymlink.
@Test(timeout = 60000, expected = SnapshotAccessControlException.class)
public void testCreateSymlink() throws Exception {
@SuppressWarnings("deprecation") DFSClient dfsclient = new DFSClient(conf);
dfsclient.createSymlink(sub2.toString(), "/TestSnapshot/sub1/.snapshot", false);
}
use of org.apache.hadoop.hdfs.DFSClient in project hadoop by apache.
the class LeaseRenewer method renew.
private void renew() throws IOException {
final List<DFSClient> copies;
synchronized (this) {
copies = new ArrayList<>(dfsclients);
}
//sort the client names for finding out repeated names.
Collections.sort(copies, new Comparator<DFSClient>() {
@Override
public int compare(final DFSClient left, final DFSClient right) {
return left.getClientName().compareTo(right.getClientName());
}
});
String previousName = "";
for (final DFSClient c : copies) {
//skip if current client name is the same as the previous name.
if (!c.getClientName().equals(previousName)) {
if (!c.renewLease()) {
LOG.debug("Did not renew lease for client {}", c);
continue;
}
previousName = c.getClientName();
LOG.debug("Lease renewed for client {}", previousName);
}
}
}
use of org.apache.hadoop.hdfs.DFSClient in project hadoop by apache.
the class LeaseRenewer method addClient.
/** Add a client. */
private synchronized void addClient(final DFSClient dfsc) {
for (DFSClient c : dfsclients) {
if (c == dfsc) {
//client already exists, nothing to do.
return;
}
}
//client not found, add it
dfsclients.add(dfsc);
//update renewal time
final int hdfsTimeout = dfsc.getConf().getHdfsTimeout();
if (hdfsTimeout > 0) {
final long half = hdfsTimeout / 2;
if (half < renewal) {
this.renewal = half;
}
}
}
Aggregations