Skip to content

Commit

Permalink
Fix naming
Browse files Browse the repository at this point in the history
  • Loading branch information
zsxwing committed Oct 9, 2014
1 parent 0b8a61c commit 1d5aed5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ abstract class Connection(val channel: SocketChannel, val selector: Selector,
onKeyInterestChangeCallback = callback
}

def callOnExceptionCallback(e: Throwable) {
def callOnExceptionCallbacks(e: Throwable) {
onExceptionCallbacks foreach {
callback =>
try {
callback(this, e)
} catch {
case NonFatal(e) => {
logWarning("Ignore error", e)
logWarning("Ignored error in onExceptionCallback", e)
}
}
}
Expand Down Expand Up @@ -330,7 +330,7 @@ class SendingConnection(val address: InetSocketAddress, selector_ : Selector,
} catch {
case e: Exception => {
logError("Error connecting to " + address, e)
callOnExceptionCallback(e)
callOnExceptionCallbacks(e)
}
}
}
Expand All @@ -355,7 +355,7 @@ class SendingConnection(val address: InetSocketAddress, selector_ : Selector,
} catch {
case e: Exception => {
logWarning("Error finishing connection to " + address, e)
callOnExceptionCallback(e)
callOnExceptionCallbacks(e)
}
}
true
Expand Down Expand Up @@ -400,7 +400,7 @@ class SendingConnection(val address: InetSocketAddress, selector_ : Selector,
} catch {
case e: Exception => {
logWarning("Error writing in connection to " + getRemoteConnectionManagerId(), e)
callOnExceptionCallback(e)
callOnExceptionCallbacks(e)
close()
return false
}
Expand All @@ -427,7 +427,7 @@ class SendingConnection(val address: InetSocketAddress, selector_ : Selector,
case e: Exception =>
logError("Exception while reading SendingConnection to " + getRemoteConnectionManagerId(),
e)
callOnExceptionCallback(e)
callOnExceptionCallbacks(e)
close()
}

Expand Down Expand Up @@ -584,7 +584,7 @@ private[spark] class ReceivingConnection(
} catch {
case e: Exception => {
logWarning("Error reading from connection to " + getRemoteConnectionManagerId(), e)
callOnExceptionCallback(e)
callOnExceptionCallbacks(e)
close()
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private[nio] class ConnectionManager(
}
}

def receiveNonAck() {
def failWithoutAck() {
completionHandler(scala.util.Failure(new IOException("Failed without being ACK'd")))
}

Expand All @@ -87,7 +87,7 @@ private[nio] class ConnectionManager(

override def afterExecute(r: Runnable, t: Throwable): Unit = {
super.afterExecute(r, t)
if (t != null) {
if (t != null && NonFatal(t)) {
logError("Error in handleMessageExecutor is not handled properly", t)
}
}
Expand All @@ -103,7 +103,7 @@ private[nio] class ConnectionManager(

override def afterExecute(r: Runnable, t: Throwable): Unit = {
super.afterExecute(r, t)
if (t != null) {
if (t != null && NonFatal(t)) {
logError("Error in handleReadWriteExecutor is not handled properly", t)
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ private[nio] class ConnectionManager(
} catch {
case NonFatal(e) => {
logError("Error when writing to " + conn.getRemoteConnectionManagerId(), e)
conn.callOnExceptionCallback(e)
conn.callOnExceptionCallbacks(e)
}
}
}
Expand Down Expand Up @@ -238,7 +238,7 @@ private[nio] class ConnectionManager(
} catch {
case NonFatal(e) => {
logError("Error when reading from " + conn.getRemoteConnectionManagerId(), e)
conn.callOnExceptionCallback(e)
conn.callOnExceptionCallbacks(e)
}
}
}
Expand Down Expand Up @@ -272,7 +272,7 @@ private[nio] class ConnectionManager(
} catch {
case NonFatal(e) => {
logError("Error when finishConnect for " + conn.getRemoteConnectionManagerId(), e)
conn.callOnExceptionCallback(e)
conn.callOnExceptionCallbacks(e)
}
}
}
Expand All @@ -295,7 +295,7 @@ private[nio] class ConnectionManager(
handleConnectExecutor.execute(new Runnable {
override def run() {
try {
conn.callOnExceptionCallback(e)
conn.callOnExceptionCallbacks(e)
} catch {
// ignore exceptions
case NonFatal(e) => logDebug("Ignoring exception", e)
Expand Down Expand Up @@ -497,7 +497,7 @@ private[nio] class ConnectionManager(
messageStatuses.values.filter(_.connectionManagerId == sendingConnectionManagerId)
.foreach(status => {
logInfo("Notifying " + status)
status.receiveNonAck()
status.failWithoutAck()
})

messageStatuses.retain((i, status) => {
Expand Down Expand Up @@ -526,7 +526,7 @@ private[nio] class ConnectionManager(
for (s <- messageStatuses.values
if s.connectionManagerId == sendingConnectionManagerId) {
logInfo("Notifying " + s)
s.receiveNonAck()
s.failWithoutAck()
}

messageStatuses.retain((i, status) => {
Expand Down Expand Up @@ -567,7 +567,7 @@ private[nio] class ConnectionManager(
case NonFatal(e) => {
logError("Error when handling messages from " +
connection.getRemoteConnectionManagerId(), e)
connection.callOnExceptionCallback(e)
connection.callOnExceptionCallbacks(e)
}
}
}
Expand Down Expand Up @@ -848,7 +848,7 @@ private[nio] class ConnectionManager(
try {
checkSendAuthFirst(connectionManagerId, connection)
} catch {
case e: Exception => {
case NonFatal(e) => {
reportSendingMessageFailure(message.id, e)
}
}
Expand Down

0 comments on commit 1d5aed5

Please sign in to comment.