Skip to content

Commit

Permalink
Consistent variable naming and exception handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
kruegersp authored Apr 24, 2024
1 parent dc84974 commit bc5ac14
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ public class CarmaCloudRegistrationReceiver implements Runnable
private final AtomicBoolean running = new AtomicBoolean(false);
private final Logger log = LoggerFactory.getLogger(this.getClass());
private final Queue<CarmaCloudRegistrationMessage> rxQueue = new LinkedList<>();
private ServerSocket m_oSrvr;
private ServerSocket srvr;


/**
* Initialize the listen socket for messages from the CARMA Cloud instance adapter
*
* @throws RuntimeException if socket instantiation fails
*/
public void init()
public void init() throws RuntimeException
{
try
{
m_oSrvr = new ServerSocket(LISTEN_PORT);
srvr = new ServerSocket(LISTEN_PORT);
}
catch (Exception oEx)
{
throw new RuntimeException(oEx);
throw new RuntimeException("server socket instantiation failure", oEx);
}
}

Expand All @@ -77,7 +77,7 @@ public void run()
{
while (running.get())
{
Socket oSock = m_oSrvr.accept();
Socket oSock = srvr.accept();
DataInputStream oIn = new DataInputStream(oSock.getInputStream());

// parse message
Expand Down Expand Up @@ -105,11 +105,11 @@ public void run()
public void stop()
{
running.set(false);
if (m_oSrvr != null)
if (srvr != null)
{
try
{
m_oSrvr.close();
srvr.close();
}
catch (Exception oEx)
{
Expand Down

0 comments on commit bc5ac14

Please sign in to comment.