本文整理汇总了Java中javax.rmi.PortableRemoteObject.exportObject方法的典型用法代码示例。如果您正苦于以下问题:Java PortableRemoteObject.exportObject方法的具体用法?Java PortableRemoteObject.exportObject怎么用?Java PortableRemoteObject.exportObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.rmi.PortableRemoteObject
的用法示例。
在下文中一共展示了PortableRemoteObject.exportObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import javax.rmi.PortableRemoteObject; //导入方法依赖的package包/类
/**
* Initialize this service exporter, binding the specified service to JNDI.
* @throws NamingException if service binding failed
* @throws RemoteException if service export failed
*/
public void prepare() throws NamingException, RemoteException {
if (this.jndiName == null) {
throw new IllegalArgumentException("Property 'jndiName' is required");
}
// Initialize and cache exported object.
this.exportedObject = getObjectToExport();
PortableRemoteObject.exportObject(this.exportedObject);
rebind();
}
示例2: start
import javax.rmi.PortableRemoteObject; //导入方法依赖的package包/类
public void start() throws Exception
{
if (!m_isRunning)
{
// export the remote object
PortableRemoteObject.exportObject(this);
// set up the initialContext
Context ctx = new InitialContext();
ctx.rebind(IIOP_JNDI_NAME, this);
System.out.println("My Service servant started successfully");
m_isRunning = true;
}
}
示例3: export
import javax.rmi.PortableRemoteObject; //导入方法依赖的package包/类
public Object export(Remote server, Class<?> remoteClass)
throws RemoteException
{
try {
PortableRemoteObject.exportObject(server);
POA poa = getPOA();
Object servant = Util.getTie(server);
Object ref = poa.servant_to_reference((Servant)servant);
return PortableRemoteObject.narrow(ref, remoteClass);
} catch(UserException e) {
throw new ExportException("could not export corba stream servant", e);
}
}
示例4: exportObject
import javax.rmi.PortableRemoteObject; //导入方法依赖的package包/类
@Override
public void exportObject(Remote obj) throws RemoteException {
PortableRemoteObject.exportObject(obj);
}
示例5: bConnect_actionPerformed
import javax.rmi.PortableRemoteObject; //导入方法依赖的package包/类
/**
* Handles the connection procedure.
*/
void bConnect_actionPerformed(ActionEvent e)
{
try
{
int state = desk.player.get_current_state();
if (state == State.DISCONNECTED || state == State.ERROR)
{
talk(ChatConstants.colors[0], "Connecting...");
if (desk.manager == null)
{
mior = taUrl.getText().trim();
// Obtain the manager object:
org.omg.CORBA.Object object = null;
try
{
object = desk.orb.string_to_object(mior);
}
catch (Exception exc)
{
// Maybe CORBA 3.0.3 is not completely implemented?
if (mior.startsWith("http://") || mior.startsWith("ftp://")
|| mior.startsWith("file://"))
object = desk.orb.string_to_object(IorReader.readUrl(mior));
else
throw exc;
}
desk.manager = (GameManager) PortableRemoteObject.narrow(
object, GameManager.class);
// Export the desk.player as a remote object.
PortableRemoteObject.exportObject(desk.player);
}
desk.player.set_current_state(State.QUEUED);
desk.manager.requestTheGame(desk.player);
}
// Save the specified IOR for the future use:
File gmf = new File(OrbStarter.WRITE_URL_TO_FILE);
FileWriter f = new FileWriter(gmf);
BufferedWriter b = new BufferedWriter(f);
b.write(mior);
b.close();
}
catch (Exception ex)
{
talk(Color.red, "The manager is not reachable by this address.");
talk(Color.red, ex.getMessage());
desk.player.set_current_state(State.DISCONNECTED);
}
}