Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.client.api
Class BusLifecycleAdapter

java.lang.Object
  extended by org.jboss.errai.bus.client.api.BusLifecycleAdapter
All Implemented Interfaces:
BusLifecycleListener

public class BusLifecycleAdapter
extends Object
implements BusLifecycleListener

Do-nothing implementation of BusLifecycleListener. Convenient for subclassing (instead of implementing BusLifecycleListener directly) when you are only interested in one or two of the event types.

For example:

     bus.addLifecycleListener(new BusLifecycleAdapter() {
     @Override
     public void busOnline(BusLifecycleEvent e) {
       // do stuff
     }
   });
 

Author:
Jonathan Fuerth , Christian Sadilek

Constructor Summary
BusLifecycleAdapter()
           
 
Method Summary
 void busAssociating(BusLifecycleEvent e)
          Indicates that the bus is about to transition from the local only to the connecting state.
 void busDisassociating(BusLifecycleEvent e)
          Indicates that the bus is about to transition from the connecting to the local only state.
 void busOffline(BusLifecycleEvent e)
          Indicates that the bus has just transitioned from the connected to the connecting state.
 void busOnline(BusLifecycleEvent e)
          Indicates that the bus has just transitioned from the connecting to the connected state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BusLifecycleAdapter

public BusLifecycleAdapter()
Method Detail

busAssociating

public void busAssociating(BusLifecycleEvent e)
Description copied from interface: BusLifecycleListener
Indicates that the bus is about to transition from the local only to the connecting state. While this event is being delivered, it is still permitted to change the remote endpoint URL of the server bus.

Specified by:
busAssociating in interface BusLifecycleListener
Parameters:
e - the object describing the event (includes a reference to the bus that fired the event).

busDisassociating

public void busDisassociating(BusLifecycleEvent e)
Description copied from interface: BusLifecycleListener
Indicates that the bus is about to transition from the connecting to the local only state. This can happen automatically due to too many failed connection attempts, or because the application stopped the bus explicitly.

When you want to try to connect to the server again (for example, to fail over to another server, after a set timeout has elapsed, or in response to the user clicking a "Reconnect" button in the user interface), call ClientMessageBusImpl.init(). This will transition the bus back to the connecting state.

Specified by:
busDisassociating in interface BusLifecycleListener
Parameters:
e - the object describing the event (includes a reference to the bus that fired the event).

busOnline

public void busOnline(BusLifecycleEvent e)
Description copied from interface: BusLifecycleListener
Indicates that the bus has just transitioned from the connecting to the connected state. At the time when this event is delivered, it is possible to exchange messages with the remote bus.

Specified by:
busOnline in interface BusLifecycleListener
Parameters:
e - the object describing the event (includes a reference to the bus that fired the event).

busOffline

public void busOffline(BusLifecycleEvent e)
Description copied from interface: BusLifecycleListener
Indicates that the bus has just transitioned from the connected to the connecting state. In the connecting state, the bus will continue to attempt to reconnect to the server. If the reconnect is successful, you will receive a BusLifecycleListener.busOnline(BusLifecycleEvent) event. If the bus gives up trying to reconnect, you will receive a BusLifecycleListener.busDisassociating(BusLifecycleEvent) event.

At the time when this event is delivered, messages intended for the remote bus will be enqueued for delivery when (and if) the bus goes back online.

Specified by:
busOffline in interface BusLifecycleListener
Parameters:
e - the object describing the event (includes a reference to the bus that fired the event).

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.