[Swift-commit] cog r3455

swift at ci.uchicago.edu swift at ci.uchicago.edu
Wed Aug 15 23:40:49 CDT 2012


------------------------------------------------------------------------
r3455 | hategan | 2012-08-15 23:35:07 -0500 (Wed, 15 Aug 2012) | 1 line

improved logging of buffers/IO providers
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/handlers/GetFileHandler.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/handlers/GetFileHandler.java	(revision 3454)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/handlers/GetFileHandler.java	(working copy)
@@ -66,6 +66,9 @@
         }
         try {
             reader = provider.pull(src, dst, this);
+            if (logger.isInfoEnabled()) {
+                logger.info(this + " reader: " + reader);
+            }
             reader.start();
         }
         catch (IOException e) {
Index: modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/handlers/providers/LocalIOProvider.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/handlers/providers/LocalIOProvider.java	(revision 3454)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/handlers/providers/LocalIOProvider.java	(working copy)
@@ -150,7 +150,9 @@
         private FileChannel fc;
 
         public Reader(String src, ReadIOCallback cb) throws IOException {
-            logger.debug("LocalIOProvider.Reader " + src);
+            if (logger.isDebugEnabled()) {
+                logger.debug("LocalIOProvider.Reader " + src);
+            }
             URI srcURI = newURI(src);
             f = CoasterFileRequestHandler.normalize(srcURI.getPath().substring(1));
             this.cb = cb;
@@ -158,7 +160,7 @@
         }
         
         public String toString() {
-            return "LR " + f;
+            return "LR-" + System.identityHashCode(this);
         }
 
         public void start() throws IOException {
@@ -167,6 +169,9 @@
                 synchronized(this) {
                     rbuf = Buffers.newReadBuffer(Buffers.getBuffers(Direction.IN), fc, f.length(), this);
                 }
+                if (logger.isInfoEnabled()) {
+                    logger.info(this + " rbuf: " + rbuf);
+                }
             }
             catch (InterruptedException e) {
                 throw new IOException(e.toString());
Index: modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/buffers/ReadBuffer.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/buffers/ReadBuffer.java	(revision 3454)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/impl/file/coaster/buffers/ReadBuffer.java	(working copy)
@@ -48,7 +48,7 @@
         int nbuf = Math.min((int) (size / Buffers.ENTRY_SIZE) + 1, Buffers.ENTRIES_PER_STREAM);
         
         if (logger.isInfoEnabled()) {
-            logger.info("Will ask for " + nbuf + " buffers for a size of " + size);
+            logger.info(this + " will ask for " + nbuf + " buffers for a size of " + size);
         }
         
         for (int i = 0; i < nbuf; i++) {
@@ -58,7 +58,7 @@
         }
         int queuedBuffers = requestFill();
         if (logger.isInfoEnabled()) {
-        	logger.info("Actual allocated buffers " + (nbuf - queuedBuffers));
+        	logger.info(this + " actual allocated buffers " + (nbuf - queuedBuffers));
         }
         if (queuedBuffers == nbuf) {
             // all buffers are queued
@@ -112,14 +112,14 @@
     
     protected synchronized void bufferCreated(Buffers.Allocation a) {
         if (logger.isDebugEnabled()) {
-            logger.debug("buffer created");
+            logger.debug(this + " buffer created");
         }
         allocs.add(a);
     }
     
     protected synchronized void deallocateBuffers() {
         if (logger.isInfoEnabled()) {
-            logger.info("De-allocating " + allocs.size() + " buffers");
+            logger.info(this + " de-allocating " + allocs.size() + " buffers");
         }
         for (Buffers.Allocation a : allocs) {
             buffers.free(a);
@@ -133,7 +133,7 @@
     }
 
     public String getName() {
-        return "RB-" + cb;
+        return "RB-" + System.identityHashCode(this);
     }
 
     public boolean isAlive() {
@@ -148,4 +148,9 @@
     public void suspend() {
     	suspended = true;
     }
+
+    @Override
+    public String toString() {
+        return getName();
+    }
 }



More information about the Swift-commit mailing list