com.sun.jini.reggie
Class RegistrarImpl.AnnounceThread

java.lang.Object
  extended by java.lang.Thread
      extended by com.sun.jini.thread.InterruptedStatusThread
          extended by com.sun.jini.reggie.RegistrarImpl.AnnounceThread
All Implemented Interfaces:
Runnable
Enclosing class:
RegistrarImpl

private class RegistrarImpl.AnnounceThread
extends InterruptedStatusThread

Multicast discovery announcement thread code.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  DatagramPacket[] dataPackets
          Cached datagram packets
private  String[] lastGroups
          Groups associated with cached datagram packets
private  LookupLocator lastLocator
          LookupLocator associated with cached datagram packets
private  MulticastSocket socket
          Multicast socket to send packets on
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RegistrarImpl.AnnounceThread()
          Create a daemon thread.
 
Method Summary
private  boolean announce(String[] groups)
          Announce membership in the specified groups, and return false if interrupted, otherwise return true.
 void run()
           
private  void send(DatagramPacket[] packets)
          Attempts to multicast the given packets on each of the configured network interfaces.
private  void send(DatagramPacket[] packets, NetworkInterface nic, Level failureLogLevel)
          Attempts to multicast the given packets on the specified network interface, logging failures at the given logging level.
 
Methods inherited from class com.sun.jini.thread.InterruptedStatusThread
hasBeenInterrupted, interrupt
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

socket

private final MulticastSocket socket
Multicast socket to send packets on


dataPackets

private DatagramPacket[] dataPackets
Cached datagram packets


lastLocator

private LookupLocator lastLocator
LookupLocator associated with cached datagram packets


lastGroups

private String[] lastGroups
Groups associated with cached datagram packets

Constructor Detail

RegistrarImpl.AnnounceThread

public RegistrarImpl.AnnounceThread()
                             throws IOException
Create a daemon thread. Set up the socket now rather than in run, so that we get any exception up front.

Throws:
IOException
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

announce

private boolean announce(String[] groups)
Announce membership in the specified groups, and return false if interrupted, otherwise return true. This method is run from synchronized run method in thread.


send

private void send(DatagramPacket[] packets)
           throws InterruptedIOException
Attempts to multicast the given packets on each of the configured network interfaces.

Throws:
InterruptedIOException

send

private void send(DatagramPacket[] packets,
                  NetworkInterface nic,
                  Level failureLogLevel)
           throws InterruptedIOException
Attempts to multicast the given packets on the specified network interface, logging failures at the given logging level. If the specified network interface is null, then the default interface is used.

Throws:
InterruptedIOException


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.