Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Bug 460 - Fix warning throughout netconf subsystem
[controller.git]
/
opendaylight
/
netconf
/
netconf-ssh
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
ssh
/
NetconfSSHServer.java
diff --git
a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/NetconfSSHServer.java
b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/NetconfSSHServer.java
index 45807a83334f8e655b268c00bcb9c9e163ccf88f..51054dd938ac8349447e694ea5c2698a7bc6d5c8 100644
(file)
--- a/
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/NetconfSSHServer.java
+++ b/
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/NetconfSSHServer.java
@@
-7,19
+7,20
@@
*/
package org.opendaylight.controller.netconf.ssh;
*/
package org.opendaylight.controller.netconf.ssh;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.concurrent.ThreadSafe;
import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
import org.opendaylight.controller.netconf.ssh.threads.SocketThread;
import org.opendaylight.controller.usermanager.IUserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
import org.opendaylight.controller.netconf.ssh.threads.SocketThread;
import org.opendaylight.controller.usermanager.IUserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.annotation.concurrent.ThreadSafe;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.util.concurrent.atomic.AtomicLong;
+
@ThreadSafe
@ThreadSafe
-public class NetconfSSHServer implements Runnable {
+public
final
class NetconfSSHServer implements Runnable {
private ServerSocket ss = null;
private static final Logger logger = LoggerFactory.getLogger(NetconfSSHServer.class);
private ServerSocket ss = null;
private static final Logger logger = LoggerFactory.getLogger(NetconfSSHServer.class);
@@
-28,12
+29,12
@@
public class NetconfSSHServer implements Runnable {
private final AuthProvider authProvider;
private boolean up = false;
private final AuthProvider authProvider;
private boolean up = false;
- private NetconfSSHServer(int serverPort,InetSocketAddress clientAddress, AuthProvider authProvider) throws
Exception
{
+ private NetconfSSHServer(int serverPort,InetSocketAddress clientAddress, AuthProvider authProvider) throws
IllegalStateException, IOException
{
logger.trace("Creating SSH server socket on port {}",serverPort);
this.ss = new ServerSocket(serverPort);
if (!ss.isBound()){
logger.trace("Creating SSH server socket on port {}",serverPort);
this.ss = new ServerSocket(serverPort);
if (!ss.isBound()){
- throw new Exception("Socket can't be bound to requested port :"+serverPort);
+ throw new
IllegalState
Exception("Socket can't be bound to requested port :"+serverPort);
}
logger.trace("Server socket created.");
this.clientAddress = clientAddress;
}
logger.trace("Server socket created.");
this.clientAddress = clientAddress;
@@
-41,11
+42,11
@@
public class NetconfSSHServer implements Runnable {
this.up = true;
}
this.up = true;
}
- public static NetconfSSHServer start(int serverPort, InetSocketAddress clientAddress,AuthProvider authProvider) throws Exception {
+ public static NetconfSSHServer start(int serverPort, InetSocketAddress clientAddress,AuthProvider authProvider) throws
IllegalStateException, IO
Exception {
return new NetconfSSHServer(serverPort, clientAddress,authProvider);
}
return new NetconfSSHServer(serverPort, clientAddress,authProvider);
}
- public void stop() throws Exception {
+ public void stop() throws
IO
Exception {
up = false;
logger.trace("Closing SSH server socket.");
ss.close();
up = false;
logger.trace("Closing SSH server socket.");
ss.close();
@@
-69,7
+70,7
@@
public class NetconfSSHServer implements Runnable {
try {
SocketThread.start(ss.accept(), clientAddress, sesssionId.incrementAndGet(),authProvider);
} catch (IOException e) {
try {
SocketThread.start(ss.accept(), clientAddress, sesssionId.incrementAndGet(),authProvider);
} catch (IOException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ logger.error("Exception occurred during socket thread initialization {}",e);
}
}
}
}
}
}