2424import com .spectralogic .ds3client .models .bulk .Node ;
2525import com .spectralogic .ds3client .models .bulk .Objects ;
2626import com .spectralogic .ds3client .serializer .XmlProcessingException ;
27+ import org .slf4j .Logger ;
28+ import org .slf4j .LoggerFactory ;
2729
2830import java .io .IOException ;
2931import java .security .SignatureException ;
3335import java .util .concurrent .Executors ;
3436
3537class ChunkTransferrer {
38+ private final static Logger LOG = LoggerFactory .getLogger (ChunkTransferrer .class );
3639 private final ItemTransferrer itemTransferrer ;
3740 private final Ds3Client mainClient ;
3841 private final JobPartTracker partTracker ;
@@ -57,18 +60,24 @@ public void transferChunks(
5760 final Iterable <Node > nodes ,
5861 final Iterable <Objects > chunks )
5962 throws SignatureException , IOException , XmlProcessingException {
63+ LOG .debug ("Getting ready to process chunks" );
6064 final Map <UUID , Node > nodeMap = buildNodeMap (nodes );
65+ LOG .debug ("Starting executor service" );
6166 final ListeningExecutorService executor = MoreExecutors .listeningDecorator (Executors .newFixedThreadPool (maxParallelRequests ));
67+ LOG .debug ("Executor service started" );
6268 try {
6369 final List <ListenableFuture <?>> tasks = new ArrayList <>();
6470 for (final Objects chunk : chunks ) {
71+ LOG .debug ("Processing parts for chunk: " + chunk .getChunkId ().toString ());
6572 final Ds3Client client = mainClient .newForNode (nodeMap .get (chunk .getNodeId ()));
6673 for (final BulkObject ds3Object : chunk ) {
6774 final ObjectPart part = new ObjectPart (ds3Object .getOffset (), ds3Object .getLength ());
6875 if (this .partTracker .containsPart (ds3Object .getName (), part )) {
76+ LOG .debug ("Adding " + ds3Object .getName () + " to executor for processing" );
6977 tasks .add (executor .submit (new Callable <Object >() {
7078 @ Override
7179 public Object call () throws Exception {
80+ LOG .debug ("Processing " + ds3Object .getName ());
7281 ChunkTransferrer .this .itemTransferrer .transferItem (client , ds3Object );
7382 ChunkTransferrer .this .partTracker .completePart (ds3Object .getName (), part );
7483 return null ;
@@ -79,6 +88,7 @@ public Object call() throws Exception {
7988 }
8089 executeWithExceptionHandling (tasks );
8190 } finally {
91+ LOG .debug ("Shutting down executor" );
8292 executor .shutdown ();
8393 }
8494 }
0 commit comments