Commit 4739de9a by Patryk Czarnik

Poprawki przykładów nt wątków

parent a01f61a9
...@@ -21,6 +21,7 @@ public class PuleWatkow { ...@@ -21,6 +21,7 @@ public class PuleWatkow {
System.out.println("Zaczynam zlecać..."); System.out.println("Zaczynam zlecać...");
for(int i = 0; i < N; i++) { for(int i = 0; i < N; i++) {
pool.submit(zadanie); pool.submit(zadanie);
// albo od razu lambdę: pool.submit(() -> System.out.println("a kuku"));
// pool.execute(zadanie); // pool.execute(zadanie);
// pool.schedule(zadanie, 2, TimeUnit.SECONDS); // pool.schedule(zadanie, 2, TimeUnit.SECONDS);
try { try {
...@@ -29,7 +30,7 @@ public class PuleWatkow { ...@@ -29,7 +30,7 @@ public class PuleWatkow {
} }
} }
System.out.println("Zlecilem wykonanie"); System.out.println("Zleciłem wykonanie");
pool.shutdown(); pool.shutdown();
//pool.shutdownNow(); //pool.shutdownNow();
......
...@@ -34,7 +34,7 @@ public class Konto { ...@@ -34,7 +34,7 @@ public class Konto {
this.wlasciciel = wlasciciel; this.wlasciciel = wlasciciel;
} }
public int getSaldo() { public synchronized int getSaldo() {
return saldo; return saldo;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment