Package com.yahoo.vespa.http.client
Interface Session
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface Session extends java.lang.AutoCloseable
A Session is an entity used to feed operations (like documents, removes or updates) to one Vespa cluster or several clusters in parallel. Current implementations are fail-fast, i.e. all feeding errors are propagated to the user as quickly as possible and with as much detail as possible. Implementations of this interface are required to be thread safe. ASessionFactory
is provided to instantiate Sessions.- Author:
- Einar M R Rosenvinge
- See Also:
SessionFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes this Session.java.lang.String
getStatsAsJson()
Returns stats about the cluster.java.util.concurrent.BlockingQueue<Result>
results()
ReturnsResult
s for all operations enqueued bystream(CharSequence)
.java.io.OutputStream
stream(java.lang.CharSequence documentId)
Returns an OutputStream that can be used to write ONE operation, identified by the given document ID.
-
-
-
Method Detail
-
stream
java.io.OutputStream stream(java.lang.CharSequence documentId)
Returns an OutputStream that can be used to write ONE operation, identified by the given document ID. The data format must match theFeedParams.DataFormat
given when this Session was instantiated. Note that most data formats include the document ID in the actual buffer, which must match the document ID given as a parameter to this method. It is (as always) important to close the OutputStream returned - nothing is written to the wire until this is done. Note also that the Session holds a certain, dynamically determined maximum number of document operations in memory. When this threshold is reached,OutputStream.close()
will block.- Parameters:
documentId
- the unique ID identifying this operation in the system- Returns:
- an OutputStream to write the operation payload into
-
results
java.util.concurrent.BlockingQueue<Result> results()
ReturnsResult
s for all operations enqueued bystream(CharSequence)
. Note that the order of results is non-deterministic, with one exception - results for one document ID are returned in the order they were enqueued. In all other cases Results may appear out-of-order.- Returns:
- a blocking queue for retrieving results
- See Also:
Result
-
close
void close()
Closes this Session. All resources are freed, persistent connections are closed and internal threads are stopped.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.RuntimeException
- in cases where underlying resources throw on shutdown/close
-
getStatsAsJson
java.lang.String getStatsAsJson()
Returns stats about the cluster.- Returns:
- JSON string with information about cluster.
-
-