All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class metrosub.net.ObjectMailer

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----metrosub.net.ObjectMailer

public class ObjectMailer
extends java.lang.Thread
ObjectMailer will send and receive Objects over the network using a Datagram transport mechanism. This does not guarentee the arrival or ordering of the Objects sent. However, it does not require much overhead to construct and maintain. There is a limit on the size of the object which may be send (maxSize).

Version:
2.0 11-Apr-2000
Author:
Andrew Miner

Constructor Index

 o ObjectMailer()
Creates a new ObjectMailer which uses a random port for sending and receiving messages.
 o ObjectMailer(int)
Creates an ObjectMailer which uses the specified port for communication.

Method Index

 o addListener(ObjectMailListener)
Adds an ObjectMailListener to the listeners for this ObjectMailer
 o finalize()
cleans up the object before deletion
 o finish()
Discontinues the execution of the thread.
 o removeListener(ObjectMailListener)
Removes a listener from the list of listeners
 o run()
Listens for incoming mail and delivers it to any registered ObjectMailListeners.
 o send(Object, String, int)
Sends an Object

Constructors

 o ObjectMailer
 public ObjectMailer() throws java.net.SocketException
Creates a new ObjectMailer which uses a random port for sending and receiving messages.

 o ObjectMailer
 public ObjectMailer(int localPort) throws java.net.SocketException
Creates an ObjectMailer which uses the specified port for communication.

Parameters:
port - the remote port to send messages to

Methods

 o addListener
 public void addListener(metrosub.net.ObjectMailListener o)
Adds an ObjectMailListener to the listeners for this ObjectMailer

Parameters:
the - listener to add
 o removeListener
 public void removeListener(metrosub.net.ObjectMailListener o)
Removes a listener from the list of listeners

Parameters:
o - the listener to remove
 o send
 public void send(java.lang.Object object,
                  java.lang.String host,
                  int port) throws java.io.IOException, java.net.SocketException, java.net.UnknownHostException, metrosub.net.ObjectTooLargeException
Sends an Object

Parameters:
o - the object to be sent
 o run
 public void run()
Listens for incoming mail and delivers it to any registered ObjectMailListeners.

Overrides:
run in class java.lang.Thread
 o finish
 public void finish()
Discontinues the execution of the thread. This indicates to the thread that it should finish what it is working on and terminate when it is able. This allows clean-up of objects that would be prohibited by the more drastic stop() method. This method will block until the thread is finished.

 o finalize
 public void finalize()
cleans up the object before deletion

Overrides:
finalize in class java.lang.Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index