cascading.lingual.platform
Class LingualConnectionFlowListener

java.lang.Object
  extended by cascading.lingual.platform.LingualConnectionFlowListener
All Implemented Interfaces:
FlowListener

public class LingualConnectionFlowListener
extends Object
implements FlowListener

Used to manage the LingualConnection list of what flows are running at a given time.

The Lingual/Cascading notions for Flow, LingualStatement and LingualConnection do not map precisely to JDBC notions of the same hence this workaround.

In JDBC there can be only one Statement active for a Connection at a given instant. While Optiq and Lingual honor this in practice with one Flow to LingualStatement to LingualConnection the class structure allows for a hypothetical case where LingualConnection.createStatement() and similar methods can be called multiple times and then each return value has LingualStatement.execute(String) called.

Since Lingual defers Flow creation until statement execution, we can't know for sure that there's only one Hadoop Flow tied to a LingualConnection. Rather than risk a case where we cancel the wrong flow when LingualStatement.cancel() is called this class keeps a collection of all running Flow objects and only allows access to the "current" Flow when collection has only one is running. LingualConnectionFlowListener is used to manage registering and unregistering a Flow when appropriate.


Constructor Summary
LingualConnectionFlowListener(LingualConnection lingualConnection)
           
 
Method Summary
 void onCompleted(Flow flow)
           
 void onStarting(Flow flow)
           
 void onStopping(Flow flow)
           
 boolean onThrowable(Flow flow, Throwable throwable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LingualConnectionFlowListener

public LingualConnectionFlowListener(LingualConnection lingualConnection)
Method Detail

onStarting

public void onStarting(Flow flow)
Specified by:
onStarting in interface FlowListener

onStopping

public void onStopping(Flow flow)
Specified by:
onStopping in interface FlowListener

onCompleted

public void onCompleted(Flow flow)
Specified by:
onCompleted in interface FlowListener

onThrowable

public boolean onThrowable(Flow flow,
                           Throwable throwable)
Specified by:
onThrowable in interface FlowListener


Copyright © 2007-2013 Concurrent, Inc. All Rights Reserved.