Class RemoteCloseableImpl<T>

All Implemented Interfaces:
Closeable, AutoCloseable, Remote, RemoteCloseable<T>

public class RemoteCloseableImpl<T> extends Object implements RemoteCloseable<T>
The default implementation of RemoteCloseable.
Christian Kohlschütter
See Also:
  • Constructor Details

    • RemoteCloseableImpl

      public RemoteCloseableImpl(RMISocketFactory socketFactory, T obj) throws RemoteException
      Created a new instance.
      socketFactory - The socket factory.
      obj - The object to wrap.
      RemoteException - on error.
  • Method Details

    • close

      public final void close() throws IOException
      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 by RemoteCloseable.get() supports it — locally as well.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface RemoteCloseable<T>
      IOException - if there was a problem.
    • doClose

      protected void doClose(T obj) throws IOException
      Closes the given object.
      obj - The object to close.
      IOException - on error.
    • get

      public T get() throws IOException
      Description copied from interface: RemoteCloseable
      Returns the resource (or the Remote instance of it). If the returned resource is Closeable, then closing via get().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 interface RemoteCloseable<T>
      The wrapped resource.
      NoSuchObjectException - if this instance has been closed already.
      IOException - if there was a problem.