Methods Summary |
---|
public synchronized void | add(java.net.Socket socket)
_customers.add(socket);
notifyAll();
|
private synchronized java.net.Socket | getNextSocket()
int size = _customers.size();
if (0 == size) {
return null;
}
size--;
Socket returnValue = (Socket) _customers.remove(size);
return returnValue;
|
public void | run()
while (true) {
sendStub();
}
|
public void | sendStub()
Socket nextSocket = getNextSocket();
if (null == nextSocket) {
waitForSocket();
return;
} else {
try {
RemoteStub stub = (RemoteStub) RemoteStub.toStub(_server);
OutputStream output = nextSocket.getOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(output);
objectOutputStream.writeObject(stub);
objectOutputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
|
private synchronized void | waitForSocket()
if (0 == _customers.size()) {
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
|