org.apache.jcs.auxiliary.lateral.socket.tcp.discovery
Class UDPDiscoverySender

java.lang.Object
  extended byorg.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoverySender

public class UDPDiscoverySender
extends java.lang.Object

This is a generic sender for the UDPDiscovery process.

Author:
Aaron Smuts

Constructor Summary
UDPDiscoverySender(java.lang.String host, int port)
          Constructor for the UDPDiscoverySender object
 
Method Summary
 void destroy()
          Closes the socket connection.
 void finalize()
          Just being careful about closing the socket.
 void passiveBroadcast(java.lang.String host, int port, java.util.ArrayList cacheNames)
          This sends a message braodcasting our that the host and port is available for connections.
protected  void passiveBroadcast(java.lang.String host, int port, java.util.ArrayList cacheNames, long listenerId)
          This allows you to set the sender id.
 void requestBroadcast()
          Ask other to broadcast their info the the multicast address.
 void send(UDPDiscoveryMessage message)
          Send messages.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDPDiscoverySender

public UDPDiscoverySender(java.lang.String host,
                          int port)
                   throws java.io.IOException
Constructor for the UDPDiscoverySender object

This sender can be used to send multiple messages.

When you are done sending, you should destroy the socket sender.

Parameters:
host -
port -
Throws:
java.io.IOException
Method Detail

destroy

public void destroy()
Closes the socket connection.


finalize

public void finalize()
              throws java.lang.Throwable
Just being careful about closing the socket.

Throws:
java.lang.Throwable

send

public void send(UDPDiscoveryMessage message)
          throws java.io.IOException
Send messages.

Parameters:
message -
Throws:
java.io.IOException

requestBroadcast

public void requestBroadcast()
                      throws java.io.IOException
Ask other to broadcast their info the the multicast address. If a lateral is non receiving it can use this. This is also called on startup so we can get info.

Throws:
java.io.IOException

passiveBroadcast

public void passiveBroadcast(java.lang.String host,
                             int port,
                             java.util.ArrayList cacheNames)
                      throws java.io.IOException
This sends a message braodcasting our that the host and port is available for connections.

It uses the vmid as the requesterDI

Parameters:
host -
port -
cacheNames -
Throws:
java.io.IOException

passiveBroadcast

protected void passiveBroadcast(java.lang.String host,
                                int port,
                                java.util.ArrayList cacheNames,
                                long listenerId)
                         throws java.io.IOException
This allows you to set the sender id. This is mainly for testing.

Parameters:
host -
port -
cacheNames -
listenerId -
Throws:
java.io.IOException


Copyright © 2002-2007 Apache Software Foundation. All Rights Reserved.