com.sun.sgs.impl.util
Class Exporter<T extends Remote>

java.lang.Object
  extended by com.sun.sgs.impl.util.Exporter<T>
Type Parameters:
T - the remote interface type

public class Exporter<T extends Remote>
extends Object

Provides for making the server available on the network, and removing it from the network during shutdown.


Constructor Summary
Exporter(Class<T> type)
          Creates an instance for exporting a remote object of the given type.
 
Method Summary
 int export(T server, int port)
          Makes the server available on the network on the specified port.
 int export(T server, String name, int port)
          Makes the server available on the network on the specified port, and binds the server's proxy in a registry on the same port with the specified name.
 T getProxy()
          Returns the exported server's proxy which is available after export is invoked successfully.
 void unexport()
          Removes the server from the network.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Exporter

public Exporter(Class<T> type)
Creates an instance for exporting a remote object of the given type.

Parameters:
type - the remote object type
Method Detail

export

public int export(T server,
                  String name,
                  int port)
           throws IOException
Makes the server available on the network on the specified port, and binds the server's proxy in a registry on the same port with the specified name. If the port is 0, chooses an anonymous port. Returns the actual port on which the server is available.

Parameters:
server - the server
name - the name of the server's proxy in the registry
port - the network port for the server
Returns:
the port on which the server is available
Throws:
IOException - if there is a problem exporting the server

export

public int export(T server,
                  int port)
           throws IOException
Makes the server available on the network on the specified port. If the port is 0, chooses an anonymous port. Returns the actual port on which the server is available.

Parameters:
server - the server
port - the network port for the server
Returns:
the port on which the server is available
Throws:
IOException - if there is a problem exporting the server

getProxy

public T getProxy()
Returns the exported server's proxy which is available after export is invoked successfully. Before the server is exported, this method returns null.

Returns:
the server's proxy, or null

unexport

public void unexport()
Removes the server from the network. This method will return immediately if called a second time.


RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved