if (log.isDebugEnabled()) log.debug("doConnect() : channel connected.");
    private void doConnect()    {        try        {            if (channel == null)            {                // Before we create the JChannel, make sure UDP is working.                checkUDP();                // Use the DOM element configuration if it exists.                if (config.getBusConfigurationElement() != null)                    channel = new JChannel(config.getBusConfigurationElement());                else // Otherwise use the configuration resource name.                    channel = new JChannel(config.getBusConfiguration());            }            channel.setOpt(Channel.VIEW, Boolean.TRUE);            channel.setOpt(Channel.GET_STATE_EVENTS, Boolean.TRUE);            if (config.getGridName() == null || config.getGridName().length() == 0)                throw new GridException("No grid name.  Please provide a grid name so the grid can federate.");            // Before we connect, set up the listener.            listener = new JGroupsListener(grid);            dispatcher = new RpcDispatcher(channel, listener, new RpcHandler(grid));            channel.addChannelListener(listener);       // Listens for connect/disconnect events.            channel.connect(config.getGridName());      // Okay, connect the channel.            if (log.isDebugEnabled())                log.debug("doConnect() : channel connected.");            broadcastNodeStatus();        }        // Re-throw GridExceptions        catch (GridException e)        {            disconnect();            throw e;        }        // Wrap other exceptions.        catch (ChannelException e)        {            disconnect();            throw new GridException(e);        }        // Log and wrap unexpected exceptions.                catch (Exception e)        {            disconnect();            log.error("Unexpected exception: " + e, e);            throw new GridException(e);        }    }