40
40
* performing various operations.
41
41
*/
42
42
public final class SynchronousGeo {
43
+ private static final int TIMEOUT = 20 * 1000 ;
43
44
private final GeoCategoryBehavior asyncDelegate ;
44
45
45
46
private SynchronousGeo (GeoCategoryBehavior asyncDelegate ) {
@@ -76,7 +77,7 @@ public static SynchronousGeo delegatingToAmplify() {
76
77
* @throws GeoException if maps are not configured.
77
78
*/
78
79
public Collection <MapStyle > getAvailableMaps () throws GeoException {
79
- return Await .result (asyncDelegate ::getAvailableMaps );
80
+ return Await .result (TIMEOUT , asyncDelegate ::getAvailableMaps );
80
81
}
81
82
82
83
/**
@@ -86,7 +87,7 @@ public Collection<MapStyle> getAvailableMaps() throws GeoException {
86
87
* @throws GeoException if default map is not configured.
87
88
*/
88
89
public MapStyle getDefaultMap () throws GeoException {
89
- return Await .result (asyncDelegate ::getDefaultMap );
90
+ return Await .result (TIMEOUT , asyncDelegate ::getDefaultMap );
90
91
}
91
92
92
93
/**
@@ -99,7 +100,7 @@ public MapStyle getDefaultMap() throws GeoException {
99
100
public MapStyleDescriptor getMapStyleDescriptor (
100
101
GetMapStyleDescriptorOptions options
101
102
) throws GeoException {
102
- return Await .<MapStyleDescriptor , GeoException >result ((onResult , onError ) ->
103
+ return Await .<MapStyleDescriptor , GeoException >result (TIMEOUT , (onResult , onError ) ->
103
104
asyncDelegate .getMapStyleDescriptor (options , onResult , onError ));
104
105
}
105
106
@@ -115,7 +116,7 @@ public GeoSearchResult searchByText(
115
116
String query ,
116
117
GeoSearchByTextOptions options
117
118
) throws GeoException {
118
- return Await .<GeoSearchResult , GeoException >result ((onResult , onError ) ->
119
+ return Await .<GeoSearchResult , GeoException >result (TIMEOUT , (onResult , onError ) ->
119
120
asyncDelegate .searchByText (query , options , onResult , onError ));
120
121
}
121
122
@@ -131,7 +132,7 @@ public GeoSearchResult searchByCoordinates(
131
132
Coordinates coordinates ,
132
133
GeoSearchByCoordinatesOptions options
133
134
) throws GeoException {
134
- return Await .<GeoSearchResult , GeoException >result ((onResult , onError ) ->
135
+ return Await .<GeoSearchResult , GeoException >result (TIMEOUT , (onResult , onError ) ->
135
136
asyncDelegate .searchByCoordinates (coordinates , options , onResult , onError ));
136
137
}
137
138
}
0 commit comments