Iris/src/main/java/TcpServer.java
public synchronized void reset(){
        switch( this.currentState ){
            case STARTED:
                this.addPropertyChangeListener(STATE_PROP, new PropertyChangeListener() {
                    public void propertyChange(PropertyChangeEvent evt) {
                        State newState = (State)evt.getNewValue();
                        if( newState == State.STOPPED ){
                            TcpServer server = (TcpServer)evt.getSource();
                            server.removePropertyChangeListener(STATE_PROP,this);
                            server.start();
                        }   // end if: stopped
                    }   // end prop change
                });
                stop();
                break;
        }   // end switch
    }
/**
     * Resets the server, if it is running, otherwise does nothing.
     * This is accomplished by registering as a listener, stopping
     * the server, detecting the stop, unregistering, and starting
     * the server again. It's a useful design pattern, and you may
     * want to look at the source code for this method to check it out.
     */
Resets the server, if it is running, otherwise does nothing.
This is accomplished by registering as a listener, stopping
the server, detecting the stop, unregistering, and starting
the server again. It's a useful design pattern, and you may
want to look at the source code for this method to check it out.
Resets the server if it is running otherwise does nothing . This is accomplished by registering as a listener stopping the server detecting the stop unregistering and starting the server again . It ' s a useful design pattern and you may want to look at the source code for this method to check it out .
public synchronized void reset(){
        switch( this.currentState ){
            case STARTED:
                this.addPropertyChangeListener(STATE_PROP, new PropertyChangeListener() {
                    public void propertyChange(PropertyChangeEvent evt) {
                        State newState = (State)evt.getNewValue();
                        if( newState == State.STOPPED ){
                            TcpServer server = (TcpServer)evt.getSource();
                            server.removePropertyChangeListener(STATE_PROP,this);
                            server.start();
                        }   
                    }   
                });
                stop();
                break;
        }   
    }
public synchronized void reset ( ) { switch ( this . currentState ) { case STARTED : this . addPropertyChangeListener ( STATE_PROP , new PropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent evt ) { State newState = ( State ) evt . getNewValue ( ) ; if ( newState == State . STOPPED ) { TcpServer server = ( TcpServer ) evt . getSource ( ) ; server . removePropertyChangeListener ( STATE_PROP , this ) ; server . start ( ) ; } } } ) ; stop ( ) ; break ; } }
Resets the server, if it is running, otherwise does nothing.
Resets the server if it is running otherwise does nothing .
// end if: stopped // end prop change // end switch