[vlma-devel] commit: Add a 'isBusy' property. (Adrien Maglo )
git version control
git at videolan.org
Sat Sep 27 23:08:13 CEST 2008
vlma | branch: master | Adrien Maglo <magsoft at basile.(none)> | Sat Sep 27 23:10:50 2008 +0200| [7ae1585e533a53f7c76e2e8343ac5c2a41cb0829] | committer: Adrien Maglo
Add a 'isBusy' property.
It is true if the adapter is used for an order.
Update the value of this property in the OrderGiver process.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=7ae1585e533a53f7c76e2e8343ac5c2a41cb0829
---
.../main/java/org/videolan/vlma/model/Adapter.java | 26 ++++++++++++++++++-
.../main/java/org/videolan/vlma/OrderGiver.java | 2 +
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java b/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java
index e481881..fa3d2b0 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java
@@ -29,6 +29,8 @@ import java.io.Serializable;
*/
public abstract class Adapter implements Serializable {
+ private static final long serialVersionUID = -5424558968386604448L;
+
public static final String DTT = "DVB-T adapter";
public static final String SAT = "DVB-S adapter";
public static final String FILE = "File adapter";
@@ -36,6 +38,8 @@ public abstract class Adapter implements Serializable {
private boolean isUp;
+ private boolean isBusy;
+
private String name;
private Server server;
@@ -92,7 +96,7 @@ public abstract class Adapter implements Serializable {
public abstract String getType();
/**
- * Returns the state of the adapter.
+ * Returns the state of the adapter (up or not).
*
* @return the state of the adapter (true if up, false otherwise)
*/
@@ -101,6 +105,15 @@ public abstract class Adapter implements Serializable {
}
/**
+ * Returns the state of the adapter (busy or not).
+ *
+ * @return the state of the adapter (true if busy, false otherwise)
+ */
+ public boolean isBusy() {
+ return isBusy;
+ }
+
+ /**
* Sets the adapter name.
*
* @param name the new adapter name
@@ -118,7 +131,7 @@ public abstract class Adapter implements Serializable {
}
/**
- * Sets the state of the adater.
+ * Sets the state of the adapter (up or not).
*
* @param isUp the new adapter state
*/
@@ -126,6 +139,15 @@ public abstract class Adapter implements Serializable {
this.isUp = isUp;
}
+ /**
+ * Sets the state of the adapter (busy or not).
+ *
+ * @param isUp the new adapter state
+ */
+ public void setBusy(boolean isBusy) {
+ this.isBusy = isBusy;
+ }
+
@Override
public boolean equals(Object other) {
if (other == null || !(other instanceof Adapter)) {
diff --git a/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java b/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java
index ce5ea72..4bc0fc0 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java
@@ -302,6 +302,7 @@ public class OrderGiver {
p.setBroadcastState(false);
}
}
+ order.getAdapter().setBusy(false);
}
// Send newly computed orders in parallel
@@ -318,6 +319,7 @@ public class OrderGiver {
sendThread = new SendOrder();
sendThreads.put(order.getAdapter().getServer(), sendThread);
}
+ order.getAdapter().setBusy(true);
sendThread.addOrder(order);
}
// Start threads, one per server
More information about the vlma-devel
mailing list