blob: 1668ac1d1ce72f811727ada7dec092414ca5331d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_40) on Thu Jul 20 13:15:38 PDT 2017 -->
<title>gobblin.util.callbacks (gobblin-utility 0.11.0 API)</title>
<meta name="date" content="2017-07-20">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="gobblin.util.callbacks (gobblin-utility 0.11.0 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../gobblin/util/binpacking/package-summary.html">Prev&nbsp;Package</a></li>
<li><a href="../../../gobblin/util/concurrent/package-summary.html">Next&nbsp;Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?gobblin/util/callbacks/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package&nbsp;gobblin.util.callbacks</h1>
<div class="docSummary">
<div class="block">This package provides some simple instrumentation to handling callback execution.</div>
</div>
<p>See:&nbsp;<a href="#package.description">Description</a></p>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../gobblin/util/callbacks/Callback.html" title="class in gobblin.util.callbacks">Callback</a>&lt;L,R&gt;</td>
<td class="colLast">
<div class="block">A helper class to wrap a function and provide a name for logging purposes</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../gobblin/util/callbacks/CallbackResult.html" title="class in gobblin.util.callbacks">CallbackResult</a>&lt;R&gt;</td>
<td class="colLast">
<div class="block">A helper class to simplify the access the result of a callback (if any)</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../gobblin/util/callbacks/CallbacksDispatcher.html" title="class in gobblin.util.callbacks">CallbacksDispatcher</a>&lt;L&gt;</td>
<td class="colLast">
<div class="block">A helper to dispatch callbacks to a set of listeners.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../gobblin/util/callbacks/CallbacksDispatcher.CallbackResults.html" title="class in gobblin.util.callbacks">CallbacksDispatcher.CallbackResults</a>&lt;L,R&gt;</td>
<td class="colLast">&nbsp;</td>
</tr>
</tbody>
</table>
</li>
</ul>
<a name="package.description">
<!-- -->
</a>
<h2 title="Package gobblin.util.callbacks Description">Package gobblin.util.callbacks Description</h2>
<div class="block">This package provides some simple instrumentation to handling callback execution.
<dl>
<dt>Listeners</dt>
<dd>Listeners are the object to which the callbacks are sent. This package does not impose
too many restrictions on what listeners should look like. For a given
<a href="../../../gobblin/util/callbacks/CallbacksDispatcher.html" title="class in gobblin.util.callbacks"><code>CallbacksDispatcher</code></a>, they should all implement the same
interface. </dd>
<dt>Callbacks</dt>
<dd>Callbacks are represented as <a href="http://google.github.io/guava/releases/15.0/api/docs/com/google/common/base/Function.html?is-external=true" title="class or interface in com.google.common.base"><code>Function</code></a><L, R> instances which
take one L parameter, the listener to be applied on, and can return a result of type R. If no
meaningful result is returned, R should be Void. There is a helper class
<a href="../../../gobblin/util/callbacks/Callback.html" title="class in gobblin.util.callbacks"><code>Callback</code></a> which allows to assign a meaningful string to the
callback. Typically, this is the name of the callback and short description of any bound
arguments.
<p>Note that callback instances as defined above can't take any arguments to be passed to the
listeners. They should be viewed as a binding of the actual callback method call to a specific
set of arguments.
<p>For example, if we want to define a callback <code>void onNewJob(JobSpec newJob)</code> to
be sent to JobCatalogListener interface, we need:
<ul>
<li>Define the <code>NewJobCallback implements Callback<JobCatalogListener, Void> </code>
<li>In the constructor, the above class should take and save a parameter for the JobSpec.
<li>The apply method, should look something like <code>input.onNewJob(this.newJob)</code>
</ul>
</dd>
<dt>Callbacks Dispatcher</dt>
<dd> The <a href="../../../gobblin/util/callbacks/CallbacksDispatcher.html" title="class in gobblin.util.callbacks"><code>CallbacksDispatcher</code></a><L> is responsible for:
<ul>
<li>Maintaining a list of listeners of type L.
<li>Dispatch callbacks invoked through <a href="../../../gobblin/util/callbacks/CallbacksDispatcher.html#execCallbacks-com.google.common.base.Function-"><code>CallbacksDispatcher.execCallbacks(com.google.common.base.Function)</code></a>
to each of the above listeners.
<li>Provide parallelism of the callbacks if necessary.
<li>Guarantee isolation of failures in callbacks.
<li>Provide logging for debugging purposes.
<li>Classify callback results in <a href="../../../gobblin/util/callbacks/CallbacksDispatcher.CallbackResults.html" title="class in gobblin.util.callbacks"><code>CallbacksDispatcher.CallbackResults</code></a>
for easier upstream processing.
</ul>
</dd>
</dl></div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../gobblin/util/binpacking/package-summary.html">Prev&nbsp;Package</a></li>
<li><a href="../../../gobblin/util/concurrent/package-summary.html">Next&nbsp;Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?gobblin/util/callbacks/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>