package multiThreadTest;

import omq.common.broker.Broker;

public class MobileThread extends Thread {
	private String name;
	private Object lock;

	public MobileThread(String name, Object lock) {
		this.name = name;
		this.lock = lock;
	}

	@Override
	public void run() {
		try {
			Mobile mobile = (Mobile) Broker.lookup(name, Mobile.class);
			synchronized (lock) {
				mobile.sendMessage("Hello this is Sergi");
				mobile.sendMessage("and this is a test");
				Thread.sleep(1000);
				lock.notify();
			}
		} catch (Exception e) {

		}
	}
}
