com.pepper.platform.net
Class NetworkMonitor

java.lang.Object
  extended by com.pepper.platform.net.NetworkMonitor

public final class NetworkMonitor
extends Object

Watch for network events like IP address changes and online/offline events.

Assumes that hardware may be multihomed, but Pepper network services like chat and sharing are aware of only a single IP address on a single interface (the primary IP address).

Fires online/offline events in response to some (but not all) network changes:

Other changes, such as a secondary network interface coming online or going offline, do not trigger events. They may in the future if services become multihoming-aware.

Since:
3.2

Method Summary
 void addNetworkListener(NetworkListener listener)
          Adds a listener for network events.
static NetworkMonitor getInstance()
          Returns the singleton instance of NetworkMonitor.
 void init()
          Start the monitor.
 boolean isOnline()
          Indicates if the Keeper is online.
 void removeNetworkListener(NetworkListener listener)
          Removes a listener for network events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

public void init()
Start the monitor. Only needs to happen once, during Keeper startup.


addNetworkListener

public void addNetworkListener(NetworkListener listener)
Adds a listener for network events.

Parameters:
listener - a class instance which implements the NetworkListener interface.

getInstance

public static NetworkMonitor getInstance()
Returns the singleton instance of NetworkMonitor.

Returns:
the NetworkMonitor singleton instance.

isOnline

public boolean isOnline()
Indicates if the Keeper is online.

Returns:
a boolean which indicates if the Keeper is online.

removeNetworkListener

public void removeNetworkListener(NetworkListener listener)
Removes a listener for network events.

Parameters:
listener - a class instance which implements the NetworkListener interface.


Copyright © 2006-2007 Pepper Computer, Inc. All Rights Reserved.