Package org.jcsp.net

Class Any2NetChannel

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private One2NetChannel impl
      Implementation
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroyWriter()
      Destroys the write end of a channel and frees any resources used within the JCSP networking infrastructure.
      NetChannelLocation getChannelLocation()
      Public accessor for obtaining the location of the read end of this channel.
      java.lang.Class getFactoryClass()
      Returns the factory class used for constructing this channel end object.
      void poison​(int strength)
      Currently, network channels are unpoisonable so this method has no effect.
      void recreate()
      Requests that the channel recreates itself and reconnects to the other end of the channel.
      void recreate​(NetChannelLocation loc)
      Requests that the channel recreates itself and reconnects to the other end of the channel.
      void write​(java.lang.Object data)
      Output data to this channel.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Any2NetChannel

        public Any2NetChannel​(NetChannelLocation channelLocation)
        Equivalent to the (NetChannelLocation) constructor of One2NetChannel.
        See Also:
        One2NetChannel
      • Any2NetChannel

        public Any2NetChannel​(NetChannelLocation channelLocation,
                              boolean acknowledged)
        Equivalent to the (NetChannelLocation, boolean) constructor of One2NetChannel.
        See Also:
        One2NetChannel
      • Any2NetChannel

        public Any2NetChannel​(NetChannelLocation channelLocation,
                              Profile linkProfile)
        Equivalent to the (NetChannelLocation, Profile) constructor of One2NetChannel.
        See Also:
        One2NetChannel
      • Any2NetChannel

        public Any2NetChannel​(NetChannelLocation channelLocation,
                              boolean acknowledged,
                              Profile linkProfile)
        Equivalent to the (NetChannelLocation, boolean, Profile) constructor of One2NetChannel.
        See Also:
        One2NetChannel
    • Method Detail

      • write

        public void write​(java.lang.Object data)
        Output data to this channel. The data must be Serializable.

        Note that this is merely a thread-safe wrapper around One2NetChannel.write(Object) - see that method for full documentation.

        Specified by:
        write in interface ChannelOutput
        Parameters:
        data - The data to send over the channel. The object should implement the Serializable interface in order to be sent over a network.
      • getChannelLocation

        public NetChannelLocation getChannelLocation()
        Public accessor for obtaining the location of the read end of this channel.
        Specified by:
        getChannelLocation in interface Networked
        Returns:
        a NetChannelLocation object containing information needed to connect to
      • recreate

        public void recreate()
        Requests that the channel recreates itself and reconnects to the other end of the channel.
        Specified by:
        recreate in interface NetChannelOutput
      • recreate

        public void recreate​(NetChannelLocation loc)
        Requests that the channel recreates itself and reconnects to the other end of the channel. A new reader location must be supplied.
        Specified by:
        recreate in interface NetChannelOutput
        Parameters:
        loc - the new location of the reader.
      • destroyWriter

        public void destroyWriter()
        Destroys the write end of a channel and frees any resources used within the JCSP networking infrastructure.
        Specified by:
        destroyWriter in interface NetChannelOutput
      • getFactoryClass

        public java.lang.Class getFactoryClass()
        Description copied from interface: NetChannelOutput

        Returns the factory class used for constructing this channel end object.

        Specified by:
        getFactoryClass in interface NetChannelOutput
        Returns:
        the Class of the
      • poison

        public void poison​(int strength)
        Currently, network channels are unpoisonable so this method has no effect.
        Specified by:
        poison in interface Poisonable
        Parameters:
        strength - the strength of the poison (must be >= 0).