org.jicarilla.framework.plumbing
Class Connector

java.lang.Object
  extended byorg.jicarilla.framework.AbstractActive
      extended byorg.jicarilla.framework.AbstractExecutable
          extended byorg.jicarilla.framework.plumbing.Connector
All Implemented Interfaces:
Active

public class Connector
extends AbstractExecutable

Sets up a connection between a source and a sink that will do nothing but continuously move messages from source to sink. In other words, use a Connector to creates a zero-length pipe/channel between a source and a sink. This movement is done by a supplied Executor, so will happen asynchronously.

Note that this class is Active, and extends from AbstractExecutable. As such, you should not override the AbstractActive.initialize() nor the AbstractActive.dispose() methods, but only ever override AbstractExecutable.doInitialize() and/or AbstractExecutable.doDispose(). When you do, make sure to call the overridden methods as well.

Version:
$Id: Connector.java,v 1.1 2004/01/05 15:41:51 lsimons Exp $
Author:
Leo Simons

Nested Class Summary
 
Nested classes inherited from class org.jicarilla.framework.AbstractExecutable
AbstractExecutable.Worker
 
Field Summary
protected  Sink m_sink
          The sink to send messages to.
protected  Source m_source
          The source to retrieve messages from.
 
Fields inherited from class org.jicarilla.framework.AbstractExecutable
m_executor, m_listener, m_worker
 
Fields inherited from class org.jicarilla.framework.AbstractActive
m_running, m_stopped
 
Constructor Summary
Connector(Source source, Sink sink, Executor executor)
          Create a new instance.
 
Method Summary
protected  void work()
          Get a message from the source and send it to the sink.
 
Methods inherited from class org.jicarilla.framework.AbstractExecutable
doDispose, doInitialize
 
Methods inherited from class org.jicarilla.framework.AbstractActive
checkActive, dispose, initialize, isActive, isDisposed, isInitialized, lazyInitialization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_source

protected final Source m_source
The source to retrieve messages from.


m_sink

protected final Sink m_sink
The sink to send messages to.

Constructor Detail

Connector

public Connector(Source source,
                 Sink sink,
                 Executor executor)
Create a new instance.

Parameters:
source - the source to retrieve messages from
sink - the sink to send messages to
executor - the executor to pass on to AbstractExecutable
Method Detail

work

protected void work()
             throws java.lang.InterruptedException
Get a message from the source and send it to the sink.

Overrides:
work in class AbstractExecutable
Throws:
java.lang.InterruptedException - if the current thread has been Thread.interrupt()ed


Copyright © 2004 Leo Simons. All Rights Reserved.