[vlma-devel] commit: Fix the reassignment of orders. (Adrien Grand )
git version control
git at videolan.org
Fri Jan 30 04:39:02 CET 2009
vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Fri Jan 30 04:34:01 2009 +0100| [388250327ed6b981e3516a440bfb0cd574decd4f] | committer: Adrien Grand
Fix the reassignment of orders.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=388250327ed6b981e3516a440bfb0cd574decd4f
---
.../main/java/org/videolan/vlma/model/Order.java | 2 +-
.../vlma/order/management/OrderManager.java | 17 ++++++++++++-----
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/Order.java b/vlma-api/src/main/java/org/videolan/vlma/model/Order.java
index 14d9aa0..1f782ba 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/Order.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/Order.java
@@ -97,7 +97,7 @@ public class Order implements Comparable<Order> {
*/
public String getName() {
if(adapter.getCapacity() <= 1) {
- return adapter.getName();
+ return "adapter-" + adapter.getName();
} else {
// Warning if you want to change this, this name is used in the URI for RTSP streaming
Program program = programs.get(0);
diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java b/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java
index 105ccc6..df782cf 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java
@@ -117,12 +117,19 @@ public class OrderManager {
result = true;
entry.getValue().setValue(State.TO_STOP);
}
- } else if(!entry.getValue().getValue().equals(State.STARTED) ||
- !order.equals(entry.getValue().getKey())) {
+ } else if(!order.equals(entry.getValue().getKey())) {
entry.getValue().getKey().getAdapter().setBusy(true);
- // This order is news but not broadcasted
- // OR The order is broadcasted but the medias to stream have changed
- // => Start this order
+ // This order has been updated
+ // => Update the order and start it
+ result = true;
+ // We are losing the reference to the former order now, so we
+ // need to update some fields here
+ entry.getValue().getKey().getAdapter().setBusy(false);
+ // Set the new order
+ Map.Entry<Order, State> value = new DefaultMapEntry(order, State.TO_START);
+ entry.setValue(value);
+ } else if(!entry.getValue().getValue().equals(State.STARTED)) {
+ // This order has either been stopped or is not started yet
result = true;
entry.getValue().setValue(State.TO_START);
}
More information about the vlma-devel
mailing list