cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [29/30] git commit: updated refs/heads/master to 64ff67d
Date Fri, 14 Aug 2015 19:47:52 GMT
CLOUDSTACK-8656: more logging instead of sysout

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b6f1d29e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b6f1d29e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b6f1d29e

Branch: refs/heads/master
Commit: b6f1d29e64f1148d0a245231941f177fa43aab6c
Parents: adcd0c0
Author: Daan Hoogland <daan@onecht.net>
Authored: Fri Aug 14 17:28:29 2015 +0200
Committer: Daan Hoogland <daan@onecht.net>
Committed: Fri Aug 14 17:28:29 2015 +0200

----------------------------------------------------------------------
 .../java/common/BufferedImagePixelsAdapter.java |  8 ++++--
 .../src/main/java/streamer/SyncLink.java        | 26 +++++++++++---------
 .../main/java/streamer/debug/FakeSource.java    |  4 +++
 3 files changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6f1d29e/services/console-proxy-rdp/rdpconsole/src/main/java/common/BufferedImagePixelsAdapter.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/common/BufferedImagePixelsAdapter.java
b/services/console-proxy-rdp/rdpconsole/src/main/java/common/BufferedImagePixelsAdapter.java
index 396bdd4..336ff44 100644
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/common/BufferedImagePixelsAdapter.java
+++ b/services/console-proxy-rdp/rdpconsole/src/main/java/common/BufferedImagePixelsAdapter.java
@@ -21,12 +21,15 @@ import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferInt;
 import java.util.Arrays;
 
+import org.apache.log4j.Logger;
+
 import streamer.BaseElement;
 import streamer.ByteBuffer;
 import streamer.Element;
 import streamer.Link;
 
 public class BufferedImagePixelsAdapter extends BaseElement {
+    private static final Logger s_logger = Logger.getLogger(BufferedImagePixelsAdapter.class);
 
     public static final String TARGET_X = "x";
     public static final String TARGET_Y = "y";
@@ -55,7 +58,7 @@ public class BufferedImagePixelsAdapter extends BaseElement {
     @Override
     public void handleData(ByteBuffer buf, Link link) {
         if (verbose)
-            System.out.println("[" + this + "] INFO: Data received: " + buf + ".");
+            s_logger.debug("[" + this + "] INFO: Data received: " + buf + ".");
 
         int x = (Integer)buf.getMetadata(TARGET_X);
         int y = (Integer)buf.getMetadata(TARGET_Y);
@@ -100,6 +103,7 @@ public class BufferedImagePixelsAdapter extends BaseElement {
                 try {
                     System.arraycopy(intArray, srcLine * rectWidth, imageBuffer, x + dstLine
* imageWidth, rectWidth);
                 } catch (IndexOutOfBoundsException e) {
+                    s_logger.info("[ignored] copy error",e);
                 }
             }
             break;
@@ -141,7 +145,7 @@ public class BufferedImagePixelsAdapter extends BaseElement {
         String actualData = Arrays.toString(((DataBufferInt)canvas.getOfflineImage().getRaster().getDataBuffer()).getData());
         String expectedData = Arrays.toString(pixelsLE);
         if (!actualData.equals(expectedData))
-            System.err.println("Actual image:   " + actualData + "\nExpected image: " + expectedData
+ ".");
+            s_logger.error("Actual image:   " + actualData + "\nExpected image: " + expectedData
+ ".");
 
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6f1d29e/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/SyncLink.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/SyncLink.java b/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/SyncLink.java
index 493964a..77810f4 100644
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/SyncLink.java
+++ b/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/SyncLink.java
@@ -16,11 +16,14 @@
 // under the License.
 package streamer;
 
+import org.apache.log4j.Logger;
+
 /**
  * Link to transfer data in bounds of single thread (synchronized transfer).
  * Must not be used to send data to elements served in different threads.
  */
 public class SyncLink implements Link {
+    private static final Logger s_logger = Logger.getLogger(SyncLink.class);
 
     /**
      * When null packet is pulled from source element, then make slight delay to
@@ -112,7 +115,7 @@ public class SyncLink implements Link {
     @Override
     public void pushBack(ByteBuffer buf) {
         if (verbose)
-            System.out.println("[" + this + "] INFO: Buffer pushed back: " + buf + ".");
+            s_logger.debug("[" + this + "] INFO: Buffer pushed back: " + buf + ".");
 
         if (cacheBuffer != null) {
             ByteBuffer tmp = cacheBuffer.join(buf);
@@ -151,7 +154,7 @@ public class SyncLink implements Link {
             throw new RuntimeException("[" + this + "] ERROR: link is not in push mode.");
 
         if (verbose)
-            System.out.println("[" + this + "] INFO: Incoming buffer: " + buf + ".");
+            s_logger.debug("[" + this + "] INFO: Incoming buffer: " + buf + ".");
 
         if (buf == null && cacheBuffer == null)
             return;
@@ -172,7 +175,7 @@ public class SyncLink implements Link {
         while (cacheBuffer != null) {
             if (paused || hold) {
                 if (verbose)
-                    System.out.println("[" + this + "] INFO: Transfer is paused. Data in
cache buffer: " + cacheBuffer + ".");
+                    s_logger.debug("[" + this + "] INFO: Transfer is paused. Data in cache
buffer: " + cacheBuffer + ".");
 
                 // Wait until rest of packet will be read
                 return;
@@ -180,7 +183,7 @@ public class SyncLink implements Link {
 
             if (expectedPacketSize > 0 && cacheBuffer.length < expectedPacketSize)
{
                 if (verbose)
-                    System.out.println("[" + this + "] INFO: Transfer is suspended because
available data is less than expected packet size. Expected packet size: "
+                    s_logger.debug("[" + this + "] INFO: Transfer is suspended because available
data is less than expected packet size. Expected packet size: "
                             + expectedPacketSize + ", data in cache buffer: " + cacheBuffer
+ ".");
 
                 // Wait until rest of packet will be read
@@ -207,7 +210,7 @@ public class SyncLink implements Link {
     public void sendEvent(Event event, Direction direction) {
 
         if (verbose)
-            System.out.println("[" + this + "] INFO: Event " + event + " is received.");
+            s_logger.debug("[" + this + "] INFO: Event " + event + " is received.");
 
         // Shutdown main loop (if any) when STREAM_CLOSE event is received.
         switch (event) {
@@ -254,13 +257,14 @@ public class SyncLink implements Link {
 
         if (paused) {
             if (verbose)
-                System.out.println("[" + this + "] INFO: Cannot pull, link is paused.");
+                s_logger.debug("[" + this + "] INFO: Cannot pull, link is paused.");
 
             // Make slight delay in such case, to avoid consuming 100% of CPU
             if (block) {
                 try {
                     Thread.sleep(100);
                 } catch (InterruptedException e) {
+                    s_logger.info("[ignored] interupted during pull", e);
                 }
             }
 
@@ -271,7 +275,7 @@ public class SyncLink implements Link {
         // then return it instead of asking for more data from source
         if (cacheBuffer != null && (expectedPacketSize == 0 || (expectedPacketSize
> 0 && cacheBuffer.length >= expectedPacketSize))) {
             if (verbose)
-                System.out.println("[" + this + "] INFO: Data pulled from cache buffer: "
+ cacheBuffer + ".");
+                s_logger.debug("[" + this + "] INFO: Data pulled from cache buffer: " + cacheBuffer
+ ".");
 
             ByteBuffer tmp = cacheBuffer;
             cacheBuffer = null;
@@ -290,7 +294,7 @@ public class SyncLink implements Link {
         // Can return something only when data was stored in buffer
         if (cacheBuffer != null && (expectedPacketSize == 0 || (expectedPacketSize
> 0 && cacheBuffer.length >= expectedPacketSize))) {
             if (verbose)
-                System.out.println("[" + this + "] INFO: Data pulled from source: " + cacheBuffer
+ ".");
+                s_logger.debug("[" + this + "] INFO: Data pulled from source: " + cacheBuffer
+ ".");
 
             ByteBuffer tmp = cacheBuffer;
             cacheBuffer = null;
@@ -366,7 +370,7 @@ public class SyncLink implements Link {
         sendEvent(Event.LINK_SWITCH_TO_PULL_MODE, Direction.IN);
 
         if (verbose)
-            System.out.println("[" + this + "] INFO: Starting pull loop.");
+            s_logger.debug("[" + this + "] INFO: Starting pull loop.");
 
         // Pull source in loop
         while (!shutdown) {
@@ -382,7 +386,7 @@ public class SyncLink implements Link {
         }
 
         if (verbose)
-            System.out.println("[" + this + "] INFO: Pull loop finished.");
+            s_logger.debug("[" + this + "] INFO: Pull loop finished.");
 
     }
 
@@ -397,7 +401,7 @@ public class SyncLink implements Link {
     @Override
     public void setPullMode() {
         if (verbose)
-            System.out.println("[" + this + "] INFO: Switching to PULL mode.");
+            s_logger.debug("[" + this + "] INFO: Switching to PULL mode.");
 
         pullMode = true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6f1d29e/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/debug/FakeSource.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/debug/FakeSource.java
b/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/debug/FakeSource.java
index 7f0c554..41d6485 100644
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/debug/FakeSource.java
+++ b/services/console-proxy-rdp/rdpconsole/src/main/java/streamer/debug/FakeSource.java
@@ -16,6 +16,8 @@
 // under the License.
 package streamer.debug;
 
+import org.apache.log4j.Logger;
+
 import streamer.BaseElement;
 import streamer.ByteBuffer;
 import streamer.Direction;
@@ -25,6 +27,7 @@ import streamer.Link;
 import streamer.SyncLink;
 
 public class FakeSource extends BaseElement {
+    private static final Logger s_logger = Logger.getLogger(FakeSource.class);
 
     /**
      * Delay for null packets in poll method when blocking is requested, in
@@ -66,6 +69,7 @@ public class FakeSource extends BaseElement {
         try {
             Thread.sleep(delay);
         } catch (InterruptedException e) {
+            s_logger.info("[ignored] interupted while creating latency", e);
         }
     }
 


Mime
View raw message