From a8839639a664a5056ad93f5db7d442fecc9e8f2d Mon Sep 17 00:00:00 2001 From: Gregor Riegler Date: Sat, 15 Jun 2013 02:29:13 +0200 Subject: [PATCH] [XVSM] Add theoretic persistence+recovery support. --- pom.xml | 170 ++++++++------- runXVSM-spaces.sh | 10 +- runXVSM.sh | 17 +- .../pizzeria/gui/PizzeriaFrame.java | 2 +- .../sbc/valesriegler/xvsm/CookXVSM.java | 10 +- .../valesriegler/xvsm/PizzeriaAgentXVSM.java | 6 +- src/main/resources/logback.xml | 4 +- src/main/resources/mozartspace1.xml | 195 ++++++++++++++++++ src/main/resources/mozartspace2.xml | 195 ++++++++++++++++++ src/main/resources/mozartspace3.xml | 195 ++++++++++++++++++ src/main/resources/mozartspace4.xml | 195 ++++++++++++++++++ src/main/resources/mozartspace5.xml | 195 ++++++++++++++++++ src/main/resources/mozartspaces-client.xml | 28 ++- 13 files changed, 1107 insertions(+), 115 deletions(-) create mode 100644 src/main/resources/mozartspace1.xml create mode 100644 src/main/resources/mozartspace2.xml create mode 100644 src/main/resources/mozartspace3.xml create mode 100644 src/main/resources/mozartspace4.xml create mode 100644 src/main/resources/mozartspace5.xml diff --git a/pom.xml b/pom.xml index aa59978..55a00ed 100644 --- a/pom.xml +++ b/pom.xml @@ -1,89 +1,99 @@ - 4.0.0 - at.ac.tuwien.sbc - vales-riegler - 0.0.1-SNAPSHOT + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + at.ac.tuwien.sbc + vales-riegler + 0.0.1-SNAPSHOT - - UTF-8 - + + UTF-8 + - - - org.slf4j - slf4j-api - 1.6.6 - - - ch.qos.logback - logback-classic - 1.0.7 - - - org.apache.activemq - activemq-all - 5.8.0 - - - ch.qos.logback - logback-classic - - - - - org.mozartspaces - mozartspaces-runtime - 2.2-SNAPSHOT - - - ch.qos.logback - logback-classic - - - - - org.mozartspaces - mozartspaces-notifications - 2.2-SNAPSHOT - + + + org.slf4j + slf4j-api + 1.6.6 + + + ch.qos.logback + logback-classic + 1.0.7 + + + org.apache.activemq + activemq-all + 5.8.0 + + + ch.qos.logback + logback-classic + + + + + org.mozartspaces + mozartspaces-runtime + 2.2-SNAPSHOT + + + ch.qos.logback + logback-classic + + + + + org.mozartspaces + mozartspaces-xvsmp-jaxb + 2.2-SNAPSHOT + + + org.mozartspaces + mozartspaces-capi3-berkeleydb + 2.2-SNAPSHOT + + + org.mozartspaces + mozartspaces-notifications + 2.2-SNAPSHOT + - + - - - - - - - - maven-compiler-plugin - 2.3.2 - - 1.7 - 1.7 - - - - org.apache.activemq.tooling - activemq-maven-plugin - 5.8.0 - - broker:(tcp://localhost:61616)?useJmx=true&persistent=false - - - - + + + + + + + + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + org.apache.activemq.tooling + activemq-maven-plugin + 5.8.0 + + broker:(tcp://localhost:61616)?useJmx=true&persistent=false + + + + - + - - - mozartspaces - http://www.mozartspaces.org/maven-snapshots - - + + + mozartspaces + http://www.mozartspaces.org/maven-snapshots + + - \ No newline at end of file + diff --git a/runXVSM-spaces.sh b/runXVSM-spaces.sh index 1ac317e..0b32ea7 100755 --- a/runXVSM-spaces.sh +++ b/runXVSM-spaces.sh @@ -1,6 +1,6 @@ #!/bin/bash -mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9876 & -mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9875 & -mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9874 & -mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9877 & -mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9873 & +mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9876 -Dmozartspaces.configurationFile=mozartspace1.xml & +mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9875 -Dmozartspaces.configurationFile=mozartspace2.xml & +mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9874 -Dmozartspaces.configurationFile=mozartspace3.xml & +mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9877 -Dmozartspaces.configurationFile=mozartspace4.xml & +mvn exec:java -Dexec.mainClass="org.mozartspaces.core.Server" -Dexec.args=9873 -Dmozartspaces.configurationFile=mozartspace5.xml & diff --git a/runXVSM.sh b/runXVSM.sh index 7e7c200..9826b7a 100755 --- a/runXVSM.sh +++ b/runXVSM.sh @@ -1,16 +1,15 @@ #!/bin/bash -#mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.cook.Cook" -Dexec.args="1 9875" & -#mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.cook.Cook" -Dexec.args="2 9875" & -#mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.cook.Cook" -Dexec.args="1 9874" & -#mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.cook.Cook" -Dexec.args="2 9874" & +mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.cook.Cook" -Dexec.args="1 9875" & +mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.cook.Cook" -Dexec.args="2 9875" & +mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.cook.Cook" -Dexec.args="1 9874" & +mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.cook.Cook" -Dexec.args="2 9874" & +mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.waiter.Waiter" -Dexec.args="2 9875" & mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.waiter.Waiter" -Dexec.args="2 9875" & -#mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.waiter.Waiter" -Dexec.args="2 9875" & mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.waiter.Waiter" -Dexec.args="1 9874" & -#mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.waiter.Waiter" -Dexec.args="2 9874" & +mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.waiter.Waiter" -Dexec.args="2 9874" & mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.driver.Driver" -Dexec.args="1 9875" & -#mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.driver.Driver" -Dexec.args="2 9875" & +mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.driver.Driver" -Dexec.args="2 9875" & mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.driver.Driver" -Dexec.args="1 9874" & -#mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.driver.Driver" -Dexec.args="2 9874" & +mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.xvsm.driver.Driver" -Dexec.args="2 9874" & mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.pizzeria.PizzeriaAgent" -Dexec.args="XVSM 9875" & mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.pizzeria.PizzeriaAgent" -Dexec.args="XVSM 9874" & -mvn exec:java -Dexec.mainClass="at.ac.tuwien.sbc.valesriegler.group.GroupAgent" -Dexec.args="XVSM" & diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/PizzeriaFrame.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/PizzeriaFrame.java index debb3be..1ca84d2 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/PizzeriaFrame.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/PizzeriaFrame.java @@ -93,7 +93,7 @@ public class PizzeriaFrame extends JFrame { return getNumberOfTables(); } - if (numberOfTables < 1) { + if (numberOfTables < 0) { JOptionPane.showMessageDialog(this, THE_NUMBER_MUST_BE_GREATER_OR_EQUAL_TO_1, WRONG_INPUT, JOptionPane.ERROR_MESSAGE); return getNumberOfTables(); diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/CookXVSM.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/CookXVSM.java index 13c6da7..a217f37 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/CookXVSM.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/CookXVSM.java @@ -72,7 +72,7 @@ public class CookXVSM extends AbstractXVSMConnector { notifyCustomerPizzaDone(pizza, tx); capi.commitTransaction(tx); - log.debug("I have completed preparing a pizza for order {}!", pizza.getOrderId()); + log.info("I have completed preparing a pizza for order {}!", pizza.getOrderId()); } catch (NullPointerException e) { // the strange nullpointer exception from the space } catch (EntityNotFoundByTemplate e) { @@ -181,7 +181,7 @@ public class CookXVSM extends AbstractXVSMConnector { } } else mayPrepare = true; - log.warn("Cook may prepare Customer pizza: {} for order {}", mayPrepare, pizzaOrder.getOrderId()); + log.info("Cook may prepare Customer pizza: {} for order {}", mayPrepare, pizzaOrder.getOrderId()); return mayPrepare; } @@ -196,7 +196,7 @@ public class CookXVSM extends AbstractXVSMConnector { pizza.setDeliveryPizza(false); final List preparedNonDeliveryPizzas = readMatchingEntities(pizza, preparedPizzasContainer, tx, RequestTimeout.DEFAULT, "mayPrepareDeliveryPizza: cannot access preparedPizzasContainer", MzsConstants.Selecting.COUNT_MAX); if(! preparedNonDeliveryPizzas.isEmpty()) { - log.warn("PreparedNonDeliveryPizzas NOT empty!"); + log.info("PreparedNonDeliveryPizzas NOT empty!"); mayPrepare = false; } else { @@ -204,7 +204,7 @@ public class CookXVSM extends AbstractXVSMConnector { if (! nonDeliveryPizzasInProgress.isEmpty()) mayPrepare = false; else mayPrepare = true; } - log.warn("Cook may prepare Delivery pizza: {} for order {}", mayPrepare, pizzaOrder.getOrderId()); + log.info("Cook may prepare Delivery pizza: {} for order {}", mayPrepare, pizzaOrder.getOrderId()); return mayPrepare; } @@ -281,7 +281,7 @@ public class CookXVSM extends AbstractXVSMConnector { groupTemplate.setOrder(groupOrder); groupTemplate.setState(null); final TransactionReference inPreparationTx = getDefaultTransaction(); - final GroupData groupFromSpace = takeMatchingEntity(groupTemplate, pizzeriaGroupContainer, inPreparationTx, 100, "Cannot take the order from pizzeriaGroupContainer"); + final GroupData groupFromSpace = takeMatchingEntity(groupTemplate, pizzeriaGroupContainer, inPreparationTx, RequestTimeout.DEFAULT, "Cannot take the order from pizzeriaGroupContainer"); final List orderedPizzas = groupFromSpace.getOrder().getOrderedPizzas(); for (PizzaOrder orderedPizza : orderedPizzas) { if (orderedPizza.getId() == pizzaInProgress.getId()) { diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/PizzeriaAgentXVSM.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/PizzeriaAgentXVSM.java index 4abcd3d..18d9977 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/PizzeriaAgentXVSM.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/PizzeriaAgentXVSM.java @@ -40,7 +40,7 @@ public class PizzeriaAgentXVSM extends AbstractXVSMConnector { } public void listenForTablesUpdates() { - getDefaultBuilder("listenForTablesUpdates").setCref(pizzeriaTableContainer).setSpaceAction(new SpaceAction() { + getDefaultBuilder("listenForTablesUpdates").setLookaround(true).setCref(pizzeriaTableContainer).setSpaceAction(new SpaceAction() { @Override public void onEntriesWritten(List entries) throws Exception { @@ -63,7 +63,7 @@ public class PizzeriaAgentXVSM extends AbstractXVSMConnector { } public void listenForGroupUpdates() { - getDefaultBuilder("listenForGroupUpdates").setCref(pizzeriaGroupContainer).setSpaceAction(new SpaceAction() { + getDefaultBuilder("listenForGroupUpdates").setLookaround(true).setCref(pizzeriaGroupContainer).setSpaceAction(new SpaceAction() { @Override public void onEntriesWritten(List entries) throws Exception { final List groups = castEntries(entries); @@ -83,7 +83,7 @@ public class PizzeriaAgentXVSM extends AbstractXVSMConnector { } public void listenForDeliveryUpdates() { - getDefaultBuilder("listenForDeliveryUpdates").setCref(pizzeriaDeliveryContainer).setSpaceAction(new SpaceAction() { + getDefaultBuilder("listenForDeliveryUpdates").setLookaround(true).setCref(pizzeriaDeliveryContainer).setSpaceAction(new SpaceAction() { @Override public void onEntriesWritten(List entries) throws Exception { final List groups = castEntries(entries); diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 184b6a9..06ca13a 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -12,11 +12,11 @@ - + - + diff --git a/src/main/resources/mozartspace1.xml b/src/main/resources/mozartspace1.xml new file mode 100644 index 0000000..37a98cb --- /dev/null +++ b/src/main/resources/mozartspace1.xml @@ -0,0 +1,195 @@ + + + + + + true + + + + + 10 + + + + + + javabuiltin + + + + + + xvsm + + 0.0.0.0 + + + + + + + 1000 + + 9876 + + ${serializers.serializer(0)} + + + + + + + + + ${remoting.defaultScheme}://localhost:${remoting.transports.tcpsocket.receiverPort} + + + + + + + + + + + + + + + + false + + + + + + + in-memory + + ${serializers.serializer(0)} + + 0 + + /tmp/xvsm1 + + + + + + + + + + + + + + + + + + + + + + + + + + + org.mozartspaces.capi3.AnyCoordinator + + org.mozartspaces.capi3.AnyCoordinator$AnySelector + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnyCoordinatorTranslator + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnySelectorTranslator + + + + + + + + javanative + + \ No newline at end of file diff --git a/src/main/resources/mozartspace2.xml b/src/main/resources/mozartspace2.xml new file mode 100644 index 0000000..f2c3c87 --- /dev/null +++ b/src/main/resources/mozartspace2.xml @@ -0,0 +1,195 @@ + + + + + + true + + + + + 10 + + + + + + javabuiltin + + + + + + xvsm + + 0.0.0.0 + + + + + + + 1000 + + 9876 + + ${serializers.serializer(0)} + + + + + + + + + ${remoting.defaultScheme}://localhost:${remoting.transports.tcpsocket.receiverPort} + + + + + + + + + + + + + + + + false + + + + + + + in-memory + + ${serializers.serializer(0)} + + 0 + + /tmp/xvsm2 + + + + + + + + + + + + + + + + + + + + + + + + + + + org.mozartspaces.capi3.AnyCoordinator + + org.mozartspaces.capi3.AnyCoordinator$AnySelector + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnyCoordinatorTranslator + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnySelectorTranslator + + + + + + + + javanative + + \ No newline at end of file diff --git a/src/main/resources/mozartspace3.xml b/src/main/resources/mozartspace3.xml new file mode 100644 index 0000000..7847a48 --- /dev/null +++ b/src/main/resources/mozartspace3.xml @@ -0,0 +1,195 @@ + + + + + + true + + + + + 10 + + + + + + javabuiltin + + + + + + xvsm + + 0.0.0.0 + + + + + + + 1000 + + 9876 + + ${serializers.serializer(0)} + + + + + + + + + ${remoting.defaultScheme}://localhost:${remoting.transports.tcpsocket.receiverPort} + + + + + + + + + + + + + + + + false + + + + + + + in-memory + + ${serializers.serializer(0)} + + 0 + + /tmp/xvsm3 + + + + + + + + + + + + + + + + + + + + + + + + + + + org.mozartspaces.capi3.AnyCoordinator + + org.mozartspaces.capi3.AnyCoordinator$AnySelector + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnyCoordinatorTranslator + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnySelectorTranslator + + + + + + + + javanative + + \ No newline at end of file diff --git a/src/main/resources/mozartspace4.xml b/src/main/resources/mozartspace4.xml new file mode 100644 index 0000000..21e7fcb --- /dev/null +++ b/src/main/resources/mozartspace4.xml @@ -0,0 +1,195 @@ + + + + + + true + + + + + 10 + + + + + + javabuiltin + + + + + + xvsm + + 0.0.0.0 + + + + + + + 1000 + + 9876 + + ${serializers.serializer(0)} + + + + + + + + + ${remoting.defaultScheme}://localhost:${remoting.transports.tcpsocket.receiverPort} + + + + + + + + + + + + + + + + false + + + + + + + in-memory + + ${serializers.serializer(0)} + + 0 + + /tmp/xvsm4 + + + + + + + + + + + + + + + + + + + + + + + + + + + org.mozartspaces.capi3.AnyCoordinator + + org.mozartspaces.capi3.AnyCoordinator$AnySelector + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnyCoordinatorTranslator + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnySelectorTranslator + + + + + + + + javanative + + \ No newline at end of file diff --git a/src/main/resources/mozartspace5.xml b/src/main/resources/mozartspace5.xml new file mode 100644 index 0000000..73a22ec --- /dev/null +++ b/src/main/resources/mozartspace5.xml @@ -0,0 +1,195 @@ + + + + + + true + + + + + 10 + + + + + + javabuiltin + + + + + + xvsm + + 0.0.0.0 + + + + + + + 1000 + + 9876 + + ${serializers.serializer(0)} + + + + + + + + + ${remoting.defaultScheme}://localhost:${remoting.transports.tcpsocket.receiverPort} + + + + + + + + + + + + + + + + false + + + + + + + in-memory + + ${serializers.serializer(0)} + + 0 + + /tmp/xvsm5 + + + + + + + + + + + + + + + + + + + + + + + + + + + org.mozartspaces.capi3.AnyCoordinator + + org.mozartspaces.capi3.AnyCoordinator$AnySelector + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnyCoordinatorTranslator + + org.mozartspaces.capi3.javanative.coordination.DefaultAnyCoordinator$AnySelectorTranslator + + + + + + + + javanative + + \ No newline at end of file diff --git a/src/main/resources/mozartspaces-client.xml b/src/main/resources/mozartspaces-client.xml index 36185f0..2f55417 100644 --- a/src/main/resources/mozartspaces-client.xml +++ b/src/main/resources/mozartspaces-client.xml @@ -1,12 +1,20 @@ - false - - - - 0 - - - - ${remoting.defaultScheme}://localhost:${remoting.transports.tcpsocket.receiverPort} - + false + + + + 0 + + + + ${remoting.defaultScheme}://localhost:${remoting.transports.tcpsocket.receiverPort} + + + javabuiltin + + + berkeleydb-transactional-sync + ${serializers.serializer(0)} + 0 + -- 2.43.0