⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statelistener.java

📁 It is Java for SIP phone
💻 JAVA
字号:
package gov.nist.applet.phone.media.transmitter;import javax.media.*;public class StateListener implements ControllerListener {	private Integer stateLock = new Integer(0);    private boolean failed = false;    public Integer getStateLock() {        return stateLock;    }    public void setFailed() {        failed = true;    }	public void controllerUpdate(ControllerEvent ce) {		// If there was an error during configure or		// realize, the processor will be closed		if (ce instanceof ControllerClosedEvent)			setFailed();		// All controller events, send a notification		// to the waiting thread in waitForState method.		if (ce instanceof ControllerEvent) {			synchronized (getStateLock()) {				getStateLock().notifyAll();			}		}	}    public synchronized boolean waitForState(Processor p, int state) {        p.addControllerListener(this);        failed = false;        // Call the required method on the processor        if (state == Processor.Configured) {            p.configure();        } else if (state == Processor.Realized) {            p.realize();        }        // Wait until we get an event that confirms the        // success of the method, or a failure event.        // See StateListener inner class        while (p.getState() < state && !failed) {            synchronized (getStateLock()) {                try {                    getStateLock().wait();                } catch (InterruptedException ie) {                    return false;                }            }        }        if (failed)            return false;        else            return true;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -