summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java')
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java
new file mode 100644
index 0000000..f19d236
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java
@@ -0,0 +1 @@
+package examples.entity.intro; import javax.naming.Context; import javax.naming.InitialContext; /** * Sample client code for an Account entity that is accessed through * a stateful session bean facade. */ public class ConflictingClient { static Bank bank = null; static int num = 13; static class SecondClientThread extends Thread { public void run() { System.out.println("Withdrawing... " ); try { bank.withdraw(num, 100000); } catch (Exception e) { //System.out.println("Exception: " + e.getMessage()); } System.out.println("Balance = " + bank.getBalance(num)); } } static class FirstClientThread extends Thread { public void run() { bank.printBigAccounts(); } } public static void main(String[] args) { try { Context ctx = new InitialContext(System.getProperties()); bank = (Bank)ctx.lookup(Bank.class.getName()); bank.openAccount("blub", num); bank.deposit(num, 100000); Thread fst = new FirstClientThread(); Thread scn = new SecondClientThread(); fst.start(); scn.start(); fst.join(); scn.join(); System.out.println("Balance = " + bank.getBalance(num)); } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); } } } \ No newline at end of file