org.instantreality.InstantIO
Interface OutSlot.Listener

All Known Implementing Classes:
InlineNode, NetworkNode, Node, WebNode
Enclosing class:
OutSlot

public static interface OutSlot.Listener

Allows to receive information about the status of an OutSlot.

You can implement this interface by your own classes and add instances of these classes to OutSlots by using the addListener method. In this case, the OutSlot calls methods of this interface when special events occur. These events are:

  1. The first InSlot connects to the OutSlot, i.e. you should start providing data values to the OutSlot. When this event happens, the startOutSlot method of the listener gets called.
  2. The last InSlot disconnects from the OutSlot, i.e. you should stop providing data values to the OutSlot. When this event happens, the stopOutSlot method of the listener gets called.
Please keep in mind that you should not block under any circumstance in these methods, and you should not perform time-consuming tasks. These methods are just meant to do short notifications about the events.

Also keep in mind that these methods do not get called by the main thread of your application, but from other threads created in the device management system. For this reason, you have to ensure that your implementation of these methods is thread-safe!

The following example demonstrates how to create an anonymous class that implemenents the listener interface and calls methods of the enclosing class:

 public class Sender
 {
   private static void startOutSlot(OutSlot outSlot)
   {
     ...
   }
 
   private static void stopOutSlot(OutSlot outSlot)
   {
     ...
   }
 
   public static void main(String[] args)
   {
     ...
     OutSlot outSlot = ...;
     outSlot.addListener(
       new OutSlot.Listener()
       {
         public void startOutSlot(OutSlot outSlot)
         {
           Sender.startOutSlot(outSlot);
         }
         public void stopOutSlot(OutSlot outSlot)
         {
           Sender.stopOutSlot(outSlot);
         }
       }
     );
     ...
   }
 }
 

Author:
Patrick Dähne

Method Summary
 void startOutSlot(OutSlot outSlot)
          Gets called when an OutSlot gets connected to the first InSlot.
 void stopOutSlot(OutSlot outSlot)
          Gets called when an OutSlot gets disconnected from the last InSlot.
 

Method Detail

startOutSlot

void startOutSlot(OutSlot outSlot)
Gets called when an OutSlot gets connected to the first InSlot.

You can use this callback to get a notification when you should start writing values to an OutSlot.

Please keep in mind that you should not block under any circumstance in this methods, and you should not perform time-consuming tasks. This method is just meant to do short notifications about the event.

Also keep in mind that this method does not get called by the main thread of your application, but from other threads created in the device management system. For this reason, you have to ensure that your implementation of this method is thread-safe!

Parameters:
outSlot - The OutSlot that generated the event.

stopOutSlot

void stopOutSlot(OutSlot outSlot)
Gets called when an OutSlot gets disconnected from the last InSlot.

You can use this callback to get a notification when you can stop writing values to an OutSlot.

Please keep in mind that you should not block under any circumstance in this methods, and you should not perform time-consuming tasks. This method is just meant to do short notifications about the event.

Also keep in mind that this method does not get called by the main thread of your application, but from other threads created in the device management system. For this reason, you have to ensure that your implementation of this method is thread-safe!

Parameters:
outSlot - The OutSlot that generated the event.