All Examples This Package
Class examples.rmi.stock.StockServer
java.lang.Object
|
+----weblogic.rmi.server.RemoteObject
|
+----weblogic.rmi.server.RemoteServer
|
+----weblogic.rmi.server.UnicastRemoteObject
|
+----examples.rmi.stock.StockServer
- public class StockServer
- extends UnicastRemoteObject
- implements StockWatch, Runnable
This class is used with the WebLogic RMI Stock examples package.
The StockServer supplies information about stocks to its
applet clients. It keeps a Vector of those stocks of interest
to each of its clients, and it keeps a Vector of all those
clients that have registered interest in stock changes. When
a stock price changes, it notifies each client that has registered
an interest in the change.
The classes in this package have been adapted to work with WebLogic RMI
from WebLogic. To run this example, see the package description.
Author: Adapted 1997 by WebLogic, Inc.
-
StockServer()
- Constructs the stock server.
-
cancel(String, StockNotify)
- Cancels request for stock updates for a particular stock.
-
cancelAll(StockNotify)
- Cancels all requests for stock updates for the remote object.
-
list(StockNotify)
- Returns an array of stock update information for the stocks
already registered by the remote object, or null if the
object is not watching any stocks.
-
main(String[])
- Starts up the stock server.
-
run()
- The run method (called from the notifier thread) sends out stock
updates periodically to those remote objects that have
registered interest in being notified.
-
watch(String, StockNotify)
- Requests notification of stock updates.
StockServer
public StockServer() throws RemoteException
- Constructs the stock server.
- Throws: RemoteException
- if remote object cannot be exported
watch
public synchronized Stock watch(String stock,
StockNotify obj) throws StockNotFoundException
- Requests notification of stock updates.
- Parameters:
- stock - Stock name
- obj - Remote object to be notified
- Returns:
- Latest update of the stock
- Throws: StockNotFoundException
- if stock is not known
cancel
public void cancel(String stock,
StockNotify obj)
- Cancels request for stock updates for a particular stock.
- Parameters:
- stock - Stock name
- obj - Remote object canceling the notification
list
public Stock[] list(StockNotify obj)
- Returns an array of stock update information for the stocks
already registered by the remote object, or null if the
object is not watching any stocks.
- Parameters:
- obj - Remote object
- Returns:
- List of stocks, or null
cancelAll
public synchronized void cancelAll(StockNotify obj)
- Cancels all requests for stock updates for the remote object.
- Parameters:
- obj - Remote object canceling the request
run
public void run()
- The run method (called from the notifier thread) sends out stock
updates periodically to those remote objects that have
registered interest in being notified.
main
public static void main(String args[])
- Starts up the stock server. In the original example, it
also created a registry so that the StockApplet
could lookup the server. In WebLogic RMI, the registry is
created and maintained by the WebLogic Server; a call to
create a registry merely finds the appropriate running
registry.
All Examples This Package