Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions transitime/src/main/java/org/transitime/db/structs/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.transitime.db.structs;

import java.io.Serializable;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.text.ParseException;
import java.util.ArrayList;
Expand Down Expand Up @@ -857,12 +858,15 @@ public List<Trip> getTrips() {
trips.get(0);
} catch (JDBCException e) {
// If root cause of exception is a SocketTimeoutException
// then somehow lost connection to the database. Might have
// or a SocketException then somehow lost connection to the
// database. It is a bit peculiar but have encountered both
// types of exceptions so both must be handled. Might have
// been rebooted or such. For this situation need to attach
// object to new session.
Throwable rootCause = HibernateUtils.getRootCause(e);
if (rootCause instanceof SocketTimeoutException) {
logger.error("Socket timeout in getTrips() for "
if (rootCause instanceof SocketTimeoutException
|| rootCause instanceof SocketException) {
logger.error("Socket exception in getTrips() for "
+ "blockId={}. Database might have been "
+ "rebooted. Creating a new session.",
this.getId(), e);
Expand Down