JavaDoc corrections
This commit is contained in:
parent
7d044a1f95
commit
bc91529721
@ -256,6 +256,8 @@ public class UraClient implements Serializable {
|
|||||||
*
|
*
|
||||||
* @param query The query.
|
* @param query The query.
|
||||||
* @param consumer Consumer(s) for single trips.
|
* @param consumer Consumer(s) for single trips.
|
||||||
|
* @return Trip reader.
|
||||||
|
* @throws IOException Error reading response.
|
||||||
* @see #getTripsStream(Query, List)
|
* @see #getTripsStream(Query, List)
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*/
|
*/
|
||||||
@ -268,6 +270,8 @@ public class UraClient implements Serializable {
|
|||||||
*
|
*
|
||||||
* @param query The query.
|
* @param query The query.
|
||||||
* @param consumers Consumer(s) for single trips.
|
* @param consumers Consumer(s) for single trips.
|
||||||
|
* @return Trip reader.
|
||||||
|
* @throws IOException Error retrieving stream response.
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*/
|
*/
|
||||||
public AsyncUraTripReader getTripsStream(final Query query, final List<Consumer<Trip>> consumers) throws IOException {
|
public AsyncUraTripReader getTripsStream(final Query query, final List<Consumer<Trip>> consumers) throws IOException {
|
||||||
@ -286,7 +290,7 @@ public class UraClient implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Get list of stops without filters.
|
* Get list of stops without filters.
|
||||||
*
|
*
|
||||||
* @return Lhe list.
|
* @return The list of stops.
|
||||||
*/
|
*/
|
||||||
public List<Stop> getStops() {
|
public List<Stop> getStops() {
|
||||||
return getStops(new Query());
|
return getStops(new Query());
|
||||||
@ -564,6 +568,8 @@ public class UraClient implements Serializable {
|
|||||||
* Get trips for set filters.
|
* Get trips for set filters.
|
||||||
*
|
*
|
||||||
* @param consumer Consumer for single trips.
|
* @param consumer Consumer for single trips.
|
||||||
|
* @return Trip reader.
|
||||||
|
* @throws IOException Errors retrieving stream response.
|
||||||
* @see #getTripsStream(List)
|
* @see #getTripsStream(List)
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*/
|
*/
|
||||||
@ -575,6 +581,8 @@ public class UraClient implements Serializable {
|
|||||||
* Get trips for set filters.
|
* Get trips for set filters.
|
||||||
*
|
*
|
||||||
* @param consumers Consumers for single trips.
|
* @param consumers Consumers for single trips.
|
||||||
|
* @return Trip reader.
|
||||||
|
* @throws IOException Errors retrieving stream response.
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*/
|
*/
|
||||||
public AsyncUraTripReader getTripsStream(List<Consumer<Trip>> consumers) throws IOException {
|
public AsyncUraTripReader getTripsStream(List<Consumer<Trip>> consumers) throws IOException {
|
||||||
|
@ -30,7 +30,7 @@ import java.util.concurrent.*;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronous stream reader foR URA stream API.
|
* Asynchronous stream reader for URA stream API.
|
||||||
* <p>
|
* <p>
|
||||||
* This reader provides a handler for asynchronous stream events.
|
* This reader provides a handler for asynchronous stream events.
|
||||||
*
|
*
|
||||||
@ -44,7 +44,7 @@ public class AsyncUraTripReader implements AutoCloseable {
|
|||||||
private final List<Consumer<Trip>> consumers;
|
private final List<Consumer<Trip>> consumers;
|
||||||
private final URL url;
|
private final URL url;
|
||||||
private CompletableFuture<Void> future;
|
private CompletableFuture<Void> future;
|
||||||
private boolean cancelled;
|
private boolean canceled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize trip reader.
|
* Initialize trip reader.
|
||||||
@ -82,7 +82,7 @@ public class AsyncUraTripReader implements AutoCloseable {
|
|||||||
BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
|
BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
|
||||||
String version = null;
|
String version = null;
|
||||||
String line = br.readLine();
|
String line = br.readLine();
|
||||||
while (line != null && !this.cancelled) {
|
while (line != null && !this.canceled) {
|
||||||
List l = mapper.readValue(line, List.class);
|
List l = mapper.readValue(line, List.class);
|
||||||
// Check if result exists and has correct response type.
|
// Check if result exists and has correct response type.
|
||||||
if (l != null && !l.isEmpty()) {
|
if (l != null && !l.isEmpty()) {
|
||||||
@ -114,7 +114,7 @@ public class AsyncUraTripReader implements AutoCloseable {
|
|||||||
/**
|
/**
|
||||||
* Close the reader.
|
* Close the reader.
|
||||||
* This is done by signaling cancel to the asynchronous task. If the task is not completed
|
* This is done by signaling cancel to the asynchronous task. If the task is not completed
|
||||||
* within 1 second however it is cancelled hard.
|
* within 1 second however it is canceled hard.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
@ -124,7 +124,7 @@ public class AsyncUraTripReader implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Signal cancelling to gracefully stop future.
|
// Signal cancelling to gracefully stop future.
|
||||||
cancelled = true;
|
canceled = true;
|
||||||
try {
|
try {
|
||||||
future.get(1, TimeUnit.SECONDS);
|
future.get(1, TimeUnit.SECONDS);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user