Skip to content

Commit

Permalink
Two changes to remove MetaLast functionality which appears to have a …
Browse files Browse the repository at this point in the history
…bug that

chooses the wrong value.  Shows itself with null values being returned in
the NewEvents property.
  • Loading branch information
ajaxx committed Sep 18, 2015
1 parent 5161bec commit d4dee12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 47 deletions.
18 changes: 0 additions & 18 deletions NEsper/NEsper/core/service/EPRuntimeImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ public class EPRuntimeImpl

private IThreadLocal<ThreadLocalData> _threadLocalData;

[ThreadStatic]
private static Pair<EPRuntimeImpl, ThreadLocalData> MetaLast;

#region Nested type: ThreadLocalData

/// <summary>
Expand All @@ -103,22 +100,7 @@ private ThreadLocalData ThreadData
{
get
{
#if false
return _threadLocalData.GetOrCreate();
#else
if (MetaLast == null)
{
return (MetaLast = new Pair<EPRuntimeImpl, ThreadLocalData>(this, _threadLocalData.GetOrCreate())).Second;
}
else if (MetaLast.First == this)
{
return MetaLast.Second;
}
else
{
return MetaLast.Second = _threadLocalData.GetOrCreate();
}
#endif
}
}

Expand Down
32 changes: 3 additions & 29 deletions NEsper/NEsper/core/service/StatementResultServiceImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ public class StatementResultServiceImpl : StatementResultService
private IThreadLocal<LinkedList<UniformPair<EventBean[]>>> _lastResults =
ThreadLocalManager.Create(() => new LinkedList<UniformPair<EventBean[]>>());

[ThreadStatic]
private static Pair<StatementResultServiceImpl, LinkedList<UniformPair<EventBean[]>>> MetaLastResults;

/// <summary>
/// Ctor.
/// </summary>
Expand Down Expand Up @@ -213,28 +210,6 @@ public void SetUpdateListeners(EPStatementListenerSet updateListeners, bool isRe
#if NET45
//[MethodImplOptions.AggressiveInlining]
#endif
private LinkedList<UniformPair<EventBean[]>> MetaLast()
{
#if false
return _lastResults.GetOrCreate();
#else
if (MetaLastResults == null)
{
LinkedList<UniformPair<EventBean[]>> metaLast;
MetaLastResults = new Pair<StatementResultServiceImpl, LinkedList<UniformPair<EventBean[]>>>(
this, metaLast = _lastResults.GetOrCreate());
return metaLast;
}
else if (MetaLastResults.First == this)
{
return MetaLastResults.Second;
}
else
{
return MetaLastResults.Second = _lastResults.GetOrCreate();
}
#endif
}

// Called by OutputProcessView
public void Indicate(UniformPair<EventBean[]> results)
Expand All @@ -248,7 +223,7 @@ public void Indicate(UniformPair<EventBean[]> results)
_metricReportingService.AccountOutput(_statementMetricHandle, numIStream, numRStream);
}

var lastResults = MetaLast();
var lastResults = _lastResults.GetOrCreate();

if ((results.First != null) && (results.First.Length != 0))
{
Expand All @@ -263,7 +238,7 @@ public void Indicate(UniformPair<EventBean[]> results)

public void Execute()
{
var dispatches = MetaLast();
var dispatches = _lastResults.GetOrCreate();
var events = EventBeanUtility.FlattenList(dispatches);

if (_isDebugEnabled)
Expand Down Expand Up @@ -462,7 +437,7 @@ private void DispatchInternal(UniformPair<EventBean[]> events)
/// </summary>
public void DispatchOnStop()
{
var dispatches = MetaLast();
var dispatches = _lastResults.GetOrCreate();
if (dispatches.IsEmpty())
{
return;
Expand All @@ -472,7 +447,6 @@ public void DispatchOnStop()

_lastResults = ThreadLocalManager.Create(
() => new LinkedList<UniformPair<EventBean[]>>());
MetaLastResults = null;
}
}
}

0 comments on commit d4dee12

Please sign in to comment.