public void run()

in auxiliary-builds/jdk14/src/java/org/apache/commons/jcs/auxiliary/lateral/javagroups/LateralJGReceiver.java [49:141]


    public void run()
    {
        try
        {
            if ( log.isDebugEnabled() )
            {
                log.debug( "Listening" );
            }

            JGConnectionHolder holder = JGConnectionHolder.getInstance( ilca );
            Channel javagroups = holder.getChannel();

            // don't need a dispatcher unless we are allowing gets.
            // gets are not supported right now.
            if ( !ilca.getPutOnlyMode() )
            {
                RpcDispatcher disp = holder.getDispatcher();
                if ( log.isDebugEnabled() )
                {
                    log.debug( "Dispatcher = " + disp );
                }
            }

            if ( javagroups == null )
            {
                log.error( "JavaGroups is null" );
                throw new IOException( "javagroups is null" );
            }

            int conProbCnt = 0;
            while ( true )
            {
                if ( log.isDebugEnabled() )
                {
                    log.debug( "Wating for messages." );
                }

                Message mes = null;
                try
                {
                    Object obj = javagroups.receive( 0 );
                    if ( obj instanceof org.jgroups.Message )
                    {
                        mes = (Message) obj;
                        if ( log.isDebugEnabled() )
                        {
                            log.debug( "Starting new socket node." );
                        }
                        new Thread( new LateralJGReceiverConnection( mes, ilcl ) ).start();
                    }
                    else
                    {
                        if ( log.isDebugEnabled() )
                        {
                            log.debug( "Received unknown object from jgroups = " + obj );
                        }
                    }
                }
                catch ( ChannelNotConnectedException cnce )
                {
                    if ( conProbCnt % 20 == 0 )
                    {
                        log.warn( cnce );
                    }
                    conProbCnt++;

                    if ( conProbCnt >= 2000 )
                    {
                        log.error( "Couldn't get connected to group after " + conProbCnt + " tries" );
                        break;
                    }
                    // slow the connection try process down
                    synchronized ( this )
                    {
                        this.wait( 100 );
                    }
                    // this will cycle unitl connected and eat up the processor
                    // need to throw out and recover
                    // seems to periodically require about 50 tries.
                }
                catch ( Exception e )
                {
                    // should zombie
                    log.error( "problem receiving", e );
                }

            }
        }
        catch ( Exception e )
        {
            log.error( "Major connection problem", e );
        }
    }