Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
StateListener.java
Package: SIP-applet-phone.zip [view]
Upload User: liulanlin
Upload Date: 2017-12-08
Package Size: 1274k
Code Size: 2k
Category:
VOIP program
Development Platform:
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;
- }
- }