Interface SerializableOnlyOverRemoting

All Superinterfaces:
Serializable
All Known Implementing Classes:
ClassLoaderHolder, Pipe, RemoteInputStream, RemoteOutputStream, RemoteWriter

public interface SerializableOnlyOverRemoting extends Serializable
This interface indicates objects which are Serializable only for sending over the Remoting Channel. Usually it means that the object requires export of the class via Channel and hudson.remoting.ExportTable. Attempts to serialize the instance of this interface for different purposes lead to undefined behavior.
Since:
3.14
Author:
Oleg Nenashev
  • Method Details

    • getChannelForSerialization

      @NonNull @Restricted(org.kohsuke.accmod.restrictions.ProtectedExternally.class) default Channel getChannelForSerialization() throws NotSerializableException
      Gets current channel or fails with NotSerializableException. This method is designed for serialization/deserialization methods in the channel.
      Returns:
      Current channel
      Throws:
      NotSerializableException - the calling thread has no associated channel. In such case the object cannot be serialized.