7 |
import java.sql.Statement; |
import java.sql.Statement; |
8 |
import java.util.ArrayList; |
import java.util.ArrayList; |
9 |
import java.util.List; |
import java.util.List; |
10 |
|
import java.util.logging.Logger; |
11 |
|
|
12 |
public class StationDAO { |
public class StationDAO { |
13 |
final static int LOCATION_LIMIT = 5; |
final static int LOCATION_LIMIT = 5; |
14 |
|
static final Logger logger = Logger.getLogger(StationDAO.class.getName()); |
15 |
|
|
16 |
|
|
17 |
private StationBean convertSingleRow(ResultSet res) throws SQLException { |
private StationBean convertSingleRow(ResultSet res) throws SQLException { |
18 |
StationBean station = new StationBean(); |
StationBean station = new StationBean(); |
158 |
List<StationBean> result = getByLocationWorker(latitude, longitude, true); |
List<StationBean> result = getByLocationWorker(latitude, longitude, true); |
159 |
|
|
160 |
if (result.size() < LOCATION_LIMIT) { //failover |
if (result.size() < LOCATION_LIMIT) { //failover |
161 |
|
logger.info("getByLocation failover: " +latitude + "," + longitude); |
162 |
|
|
163 |
result = getByLocationWorker(latitude, longitude, false); |
result = getByLocationWorker(latitude, longitude, false); |
164 |
} |
} |
165 |
|
|