net.esper.view.stream
Class StreamFactorySvcReuse

java.lang.Object
  extended by net.esper.view.stream.StreamFactorySvcReuse

public class StreamFactorySvcReuse
extends Object

Service implementation to reuse event streams and existing filters using reference counting to remove filters when not used.

This can be very effective in that if a client applications creates a large number of very similar statements in terms of filters and views used then these resources are all re-used across statements.

The re-use is multithread-safe in that (A) statement start/stop is locked against other engine processing (B) the first statement supplies the lock for shared filters and views, protecting multiple threads from entering into the same view. (C) joins statements do not participate in filter and view reuse


Constructor Summary
StreamFactorySvcReuse()
          Ctor.
 
Method Summary
 EventStream createStream(FilterSpec filterSpec, FilterService filterService, EPStatementHandle epStatementHandle)
          See the method of the same name in StreamFactoryService.
 void dropStream(FilterSpec filterSpec, FilterService filterService)
          See the method of the same name in StreamFactoryService.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamFactorySvcReuse

public StreamFactorySvcReuse()
Ctor.

Method Detail

createStream

public EventStream createStream(FilterSpec filterSpec,
                                FilterService filterService,
                                EPStatementHandle epStatementHandle)
See the method of the same name in StreamFactoryService. Always attempts to reuse an existing event stream. May thus return a new event stream or an existing event stream depending on whether filter criteria match.

Parameters:
filterSpec - is the filter definition
filterService - is the filtering service
epStatementHandle - is the statement resource lock
Returns:
newly created event stream, not reusing existing instances

dropStream

public void dropStream(FilterSpec filterSpec,
                       FilterService filterService)
See the method of the same name in StreamFactoryService.

Parameters:
filterSpec - is the filter definition
filterService - is the filtering service