java.lang.Object
org.newsclub.net.unix.rmi.RemoteCloseableImpl<T>
- Type Parameters:
T
- The resource type.
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Remote
,RemoteCloseable<T>
The default implementation of
RemoteCloseable
.- Author:
- Christian Kohlschütter
- See Also:
-
Constructor Summary
ConstructorDescriptionRemoteCloseableImpl
(RMISocketFactory socketFactory, T obj) Created a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the resource on the server-side (i.e., where it was created), and — as long as the wrapped resource returned byRemoteCloseable.get()
supports it — locally as well.get()
Returns the resource (or the Remote instance of it).
-
Constructor Details
-
RemoteCloseableImpl
Created a new instance.- Parameters:
socketFactory
- The socket factory.obj
- The object to wrap.- Throws:
RemoteException
- on error.
-
-
Method Details
-
close
Description copied from interface:RemoteCloseable
Closes the resource on the server-side (i.e., where it was created), and — as long as the wrapped resource returned byRemoteCloseable.get()
supports it — locally as well.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceRemoteCloseable<T>
- Throws:
IOException
- if there was a problem.
-
get
Description copied from interface:RemoteCloseable
Returns the resource (or the Remote instance of it). If the returned resource isCloseable
, then closing viaget().close()
} will affect the client-side (local), but not necessarily the server-side as well (the exact behavior depends on the resource).- Specified by:
get
in interfaceRemoteCloseable<T>
- Returns:
- The wrapped resource.
- Throws:
IOException
- if there was a problem.
-