Interface Exporter
- All Known Implementing Classes:
GenericExporter,ProxyTrustExporter
Details of the export and unexport behavior, including the communication protocols used for remote invocation and additional remote invocation semantics, are defined by the particular implementation of this interface.
- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionExports the specified remote object and returns a proxy that can be used to invoke remote methods on the exported remote object.booleanunexport(boolean force) Unexports the remote object that was exported by thisExportersuch that it will no longer receive remote method invocations that were made possible as a result of exporting it with thisExporter.
-
Method Details
-
export
Exports the specified remote object and returns a proxy that can be used to invoke remote methods on the exported remote object. This method must only be invoked once on a givenExporterinstance.The returned proxy implements an implementation-specific set of remote interfaces of the remote object and may also implement additional implementation-specific interfaces.
A remote interface is an interface that extends the interface
java.rmi.Remoteand whose methods each declare at least one exception whose type isjava.rmi.RemoteExceptionor one of its superclasses.- Parameters:
impl- a remote object to export- Returns:
- a proxy for the remote object
- Throws:
ExportException- if a problem occurs exporting the objectSecurityException- if aSecurityExceptionoccurs exporting the objectNullPointerException- ifimplisnullIllegalStateException- if an object has already been exported with thisExporterinstance
-
unexport
boolean unexport(boolean force) Unexports the remote object that was exported by thisExportersuch that it will no longer receive remote method invocations that were made possible as a result of exporting it with thisExporter. The unexport operation may not occur if theforceargument isfalse. This method must only be invoked after theexportmethod has been invoked on thisExporterinstance to export a remote object successfully.This method returns
trueif upon return, the remote object is no longer exported with thisExporter, andfalseif the remote object remains exported with thisExporter. This method will always returntrueif it has returnedtruepreviously.The
forceparameter serves to indicate whether or not the caller desires the unexport to occur even if there are known remote calls pending or in progress to the remote object that were made possible by thisExporter:- If
forceistrue, then the remote object will be forcibly unexported even if there are remote calls pending or in progress, and this method will returntrue. - If
forceisfalse, then this acts as a hint to the implementation that the remote object should not be unexported if there are known remote calls pending or in progress, and this method will either unexport the remote object and returntrueor not unexport the remote object and returnfalse. If the implementation detects that there are indeed remote calls pending or in progress, then it should returnfalse; otherwise, it must returntrue. If the implementation does not support being able to unexport conditionally based on knowledge of remote calls pending or in progress, then it must implement this method as ifforcewere alwaystrue.
If the remote object is unexported as a result of this method, then the implementation may (and should, if possible) prevent remote calls in progress from being able to communicate their results successfully.
- Parameters:
force- iftrue, the remote object will be unexported even if there are remote calls pending or in progress; iffalse, the remote object may only be unexported if there are no known remote calls pending or in progress- Returns:
trueif the remote object is unexported when this method returns andfalseotherwise- Throws:
IllegalStateException- if an object has not been exported with thisExporterinstance
- If
-