[vlma-devel] commit: More debug in the order computer. (Adrien Grand )

git version control git at videolan.org
Sat Feb 14 07:17:14 CET 2009


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Feb 14 07:15:41 2009 +0100| [60462ce84a941cc4b93b5508624769aad372299f] | committer: Adrien Grand 

More debug in the order computer.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=60462ce84a941cc4b93b5508624769aad372299f
---

 .../org/videolan/vlma/model/AdapterFamily.java     |   20 ++++++++++++++++++++
 .../java/org/videolan/vlma/model/ProgramGroup.java |   14 ++++++++++++++
 .../vlma/order/management/OrderComputer.java       |    9 +++++++--
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/AdapterFamily.java b/vlma-api/src/main/java/org/videolan/vlma/model/AdapterFamily.java
index 405d189..f2ac6db 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/AdapterFamily.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/AdapterFamily.java
@@ -41,6 +41,11 @@ public abstract class AdapterFamily {
             return instance;
         }
 
+        @Override
+        public String toString() {
+            return "DTT";
+        }
+
     }
 
     public static class Files extends AdapterFamily {
@@ -53,6 +58,11 @@ public abstract class AdapterFamily {
             return instance;
         }
 
+        @Override
+        public String toString() {
+            return "Files";
+        }
+
     }
 
     public static class Stream extends AdapterFamily {
@@ -65,6 +75,11 @@ public abstract class AdapterFamily {
             return instance;
         }
 
+        @Override
+        public String toString() {
+            return "Stream";
+        }
+
     }
 
     public static class Sat extends AdapterFamily {
@@ -90,6 +105,11 @@ public abstract class AdapterFamily {
             return satellite;
         }
 
+        @Override
+        public String toString() {
+            return "Satellite (" + satellite.getName() + ")";
+        }
+
     }
 
 }
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/ProgramGroup.java b/vlma-api/src/main/java/org/videolan/vlma/model/ProgramGroup.java
index 4da1216..2897800 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/ProgramGroup.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/ProgramGroup.java
@@ -125,4 +125,18 @@ public abstract class ProgramGroup extends ArrayList<Program>
         throw new IllegalArgumentException("The program does not belong to this group");
     }
 
+    @Override
+    public String toString() {
+        boolean first = true;
+        StringBuilder result = new StringBuilder();
+        for (Program program : this) {
+            if (!first) {
+                result.append(", ");
+                first = false;
+            }
+            result.append(program.getId());
+        }
+        return result.toString();
+    }
+
 }
diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderComputer.java b/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderComputer.java
index 35f3974..d62f74f 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderComputer.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderComputer.java
@@ -207,19 +207,23 @@ public class OrderComputer {
         SortedSet<Order> orders = new TreeSet<Order>();
         // First give orders to stream Satellite and DTT channels
         for (Map.Entry<AdapterFamily, List<ProgramGroup>> entry : groups.entrySet()) {
-            if (isSatOrDTT(entry.getKey()))
+            if (isSatOrDTT(entry.getKey())) {
+                logger.debug("Now attributing adapter family " + entry.getKey());
                 computeOrdersAvailableAdapters(entry.getValue(),
                         adapters.get(entry.getKey()),
                         orders,
                         load);
+            }
         }
         // Then give other orders (for which there is not a limit of one
         // ProgramGroup per adapter) to servers with lower load
         for (Map.Entry<AdapterFamily, List<ProgramGroup>> entry : groups.entrySet()) {
-            if (!isSatOrDTT(entry.getKey()))
+            if (!isSatOrDTT(entry.getKey())) {
+                logger.debug("Now attributing adapter family " + entry.getKey());
                 computeOrdersLowerLoad(entry.getValue(),
                         orders,
                         load);
+            }
         }
         return orders;
     }
@@ -245,6 +249,7 @@ public class OrderComputer {
             Adapter a = adapterIt.next();
             ProgramGroup g = groupIt.next();
             Order order = new Order(a, g);
+            logger.debug("Attributing " + g + " (priority " + g.getPriority() + ") to " + a.getName() + " of " + a.getServer().getName() + "(score " + a.getScore() + ")");
             if(!orders.add(order)) {
                 logger.error("Unexpected error while building the new set of orders");
             }



More information about the vlma-devel mailing list