@Test public void testAsyncTrash() throws Exception { Properties properties = TestTrash.propertiesForTestTrash(); TestTrash.simulateDelay(properties, 2); FileSystem fs = mock(FileSystem.class); AsyncTrash trash = new AsyncTrash(fs, properties); for(int i = 0; i < 5; i++) { trash.moveToTrash(new Path("file" + i)); Thread.sleep(10); } for(int i = 0; i < 5; i++) { trash.moveToTrashAsUser(new Path("file" + i), "user" + i); Thread.sleep(10); } int maxWaits = 5; while(maxWaits > 0 && ((TestTrash) trash.getDecoratedObject()).getOperationsWaiting() < 10) { Thread.sleep(100); maxWaits--; } Assert.assertTrue(((TestTrash) trash.getDecoratedObject()).getDeleteOperations().isEmpty()); ((TestTrash) trash.getDecoratedObject()).tick(); Assert.assertTrue(((TestTrash) trash.getDecoratedObject()).getDeleteOperations().isEmpty()); ((TestTrash) trash.getDecoratedObject()).tick(); Assert.assertTrue(((TestTrash) trash.getDecoratedObject()).getDeleteOperations().size() > 8); ((TestTrash) trash.getDecoratedObject()).tick(); ((TestTrash) trash.getDecoratedObject()).tick(); ((TestTrash) trash.getDecoratedObject()).tick(); ((TestTrash) trash.getDecoratedObject()).tick(); Assert.assertEquals(((TestTrash) trash.getDecoratedObject()).getDeleteOperations().size(), 10); }
public AsyncTrash(FileSystem fs, Properties properties) throws IOException { this(fs, properties, UserGroupInformation.getCurrentUser().getShortUserName()); }
AsyncTrash implements GobblinProxiedTrash, Closeable, Decorator { public AsyncTrash(FileSystem fs, Properties properties) throws IOException { this(fs, properties, UserGroupInformation.getCurrentUser().getShortUserName()); } }
AsyncTrash implements GobblinProxiedTrash, Closeable, Decorator { public AsyncTrash(FileSystem fs, Properties properties) throws IOException { this(fs, properties, UserGroupInformation.getCurrentUser().getShortUserName()); } AsyncTrash(FileSystem fs, Properties properties);  AsyncTrash(FileSystem fs, Properties properties, String user); }
AsyncTrash implements GobblinProxiedTrash, Closeable, Decorator { public AsyncTrash(FileSystem fs, Properties properties) throws IOException { this(fs, properties, UserGroupInformation.getCurrentUser().getShortUserName()); } AsyncTrash(FileSystem fs, Properties properties);  AsyncTrash(FileSystem fs, Properties properties, String user); @Override boolean moveToTrashAsUser(Path path, String user); ListenableFuture<Boolean> moveToTrashAsUserFuture(final Path path, final String user); boolean moveToTrashAsOwner(Path path); ListenableFuture<Boolean> moveToTrashAsOwnerFuture(final Path path); @Override boolean moveToTrash(Path path); ListenableFuture<Boolean> moveToTrashFuture(final Path path); @Override Object getDecoratedObject(); @Override void close(); }
AsyncTrash implements GobblinProxiedTrash, Closeable, Decorator { public AsyncTrash(FileSystem fs, Properties properties) throws IOException { this(fs, properties, UserGroupInformation.getCurrentUser().getShortUserName()); } AsyncTrash(FileSystem fs, Properties properties);  AsyncTrash(FileSystem fs, Properties properties, String user); @Override boolean moveToTrashAsUser(Path path, String user); ListenableFuture<Boolean> moveToTrashAsUserFuture(final Path path, final String user); boolean moveToTrashAsOwner(Path path); ListenableFuture<Boolean> moveToTrashAsOwnerFuture(final Path path); @Override boolean moveToTrash(Path path); ListenableFuture<Boolean> moveToTrashFuture(final Path path); @Override Object getDecoratedObject(); @Override void close(); static final String MAX_DELETING_THREADS_KEY; static final int DEFAULT_MAX_DELETING_THREADS; }