@Override public long isReady(long tid, Master environment) throws Exception { try { String namespaceId = Tables.getNamespaceId(environment.getInstance(), tableId); return Utils.reserveNamespace(namespaceId, tid, false, false, TableOperation.DELETE) + Utils.reserveTable(tableId, tid, true, true, TableOperation.DELETE); } catch (IllegalArgumentException ex) { if (ex.getCause() != null && ex.getCause() instanceof TableNotFoundException) { return 0; } throw ex; } }
@Override public Repo<Master> call(long tid, Master environment) throws Exception { try { String namespaceId = Tables.getNamespaceId(environment.getInstance(), tableId); TableManager.getInstance().transitionTableState(tableId, TableState.DELETING); environment.getEventCoordinator().event("deleting table %s ", tableId); return new CleanUp(tableId, namespaceId); } catch (IllegalArgumentException ex) { if (ex.getCause() != null && ex.getCause() instanceof TableNotFoundException) { return null; } throw ex; } }
@Override public void undo(long tid, Master environment) throws Exception { String namespaceId = Tables.getNamespaceId(environment.getInstance(), tableId); Utils.unreserveNamespace(namespaceId, tid, false); Utils.unreserveTable(tableId, tid, true); }