synchronized su awarenes e chat via tcp

This commit is contained in:
2014-12-02 21:50:57 +01:00
parent 1ef2207245
commit 40a630623a
7 changed files with 296 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ public class HelloImplemented extends UnicastRemoteObject implements HelloInterf
}
@Override
public void register(call_me_back obj) throws RemoteException {
public synchronized void register(call_me_back obj) throws RemoteException {
v.add(obj);
Iterator<call_me_back> it = v.iterator();
for (;it.hasNext();){
@@ -30,7 +30,7 @@ public class HelloImplemented extends UnicastRemoteObject implements HelloInterf
}
@Override
public void deregister(call_me_back obj) throws RemoteException {
public synchronized void deregister(call_me_back obj) throws RemoteException {
v.remove(obj);
Iterator<call_me_back> it = v.iterator();
for (;it.hasNext();){