X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.tmf.core%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Ftmf%2Fcore%2Fcomponent%2FTmfDataProvider.java;h=0341ef56c576803e6887c530b27dcc0aa81df3c7;hb=6f4e8ec0ae816788e83accc0de316f7bd783c35c;hp=2252a8bfb8f58aff59e2e90a13ce7225f583df25;hpb=73ecde7e60983031eeab2c961701b97b10f2616d;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfDataProvider.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfDataProvider.java index 2252a8bfb8..0341ef56c5 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfDataProvider.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfDataProvider.java @@ -61,12 +61,21 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr // Attributes // ------------------------------------------------------------------------ + /** The type of event handled by this provider */ protected Class fType; + + /** Is there some data being logged? */ protected boolean fLogData; + + /** Are errors being logged? */ protected boolean fLogError; - protected int fQueueSize = DEFAULT_QUEUE_SIZE; + /** Queue of events */ protected BlockingQueue fDataQueue; + + /** Size of the fDataQueue */ + protected int fQueueSize = DEFAULT_QUEUE_SIZE; + private TmfRequestExecutor fExecutor; private int fSignalDepth = 0; @@ -110,6 +119,16 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr TmfProviderManager.register(fType, this); } + /** + * Constructor specifying the event type and the queue size. + * + * @param name + * Name of the provider + * @param type + * Type of event that will be handled + * @param queueSize + * Size of the event queue + */ protected TmfDataProvider(String name, Class type, int queueSize) { this(); fQueueSize = queueSize; @@ -232,8 +251,16 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr // Coalescing (primitive test...) // ------------------------------------------------------------------------ + /** List of coalesced requests */ protected Vector fPendingCoalescedRequests = new Vector(); + /** + * Create a new request from an existing one, and add it to the coalesced + * requests + * + * @param request + * The request to copy + */ protected void newCoalescedDataRequest(ITmfDataRequest request) { synchronized (fLock) { TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(request.getDataType(), request.getIndex(), @@ -247,6 +274,12 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr } } + /** + * Add an existing requests to the list of coalesced ones + * + * @param request + * The request to add to the list + */ protected void coalesceDataRequest(ITmfDataRequest request) { synchronized (fLock) { for (TmfCoalescedDataRequest coalescedRequest : fPendingCoalescedRequests) { @@ -275,6 +308,12 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr } } + /** + * Queue a request. + * + * @param request + * The data request + */ protected void queueRequest(final ITmfDataRequest request) { if (fExecutor.isShutdown()) { @@ -355,10 +394,20 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr TmfCoreTracer.traceRequest(request, "QUEUED"); //$NON-NLS-1$ } fExecutor.execute(thread); - } - protected void queueBackgroundRequest(final ITmfDataRequest request, final int blockSize, final boolean indexing) { + /** + * Queue a background request + * + * @param request + * The request + * @param blockSize + * The request should be split in chunks of this size + * @param indexing + * Should we index the chunks + */ + protected void queueBackgroundRequest(final ITmfDataRequest request, + final int blockSize, final boolean indexing) { final TmfDataProvider provider = this; @@ -445,7 +494,9 @@ public abstract class TmfDataProvider extends TmfComponent implements ITmfDataPr * specific and will be updated by getNext(). * * @param request - * @return an application specific context; null if request can't be serviced + * The request + * @return Sn application specific context; null if request can't be + * serviced */ protected abstract ITmfContext armRequest(ITmfDataRequest request);