Skip to content

Commit

Permalink
fix(websocket): cleanup some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
notthetup committed Oct 3, 2024
1 parent 91a4e6f commit a381db3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/java/org/arl/fjage/connectors/WebSocketConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class WebSocketConnector implements Connector, WebSocketCreator {
protected ContextHandler handler;
protected List<WSHandler> wsHandlers = new CopyOnWriteArrayList<WSHandler>();
protected OutputThread outThread = null;
protected PseudoInputStream pin = new PseudoInputStream();
protected final PseudoInputStream pin = new PseudoInputStream();
protected PseudoOutputStream pout = new PseudoOutputStream();
protected ConnectionListener listener = null;
protected Logger log = Logger.getLogger(getClass().getName());
Expand Down Expand Up @@ -143,8 +143,6 @@ public void close() {
handler = null;
pin.close();
pout.close();
pin = null;
pout = null;
}

@Override
Expand Down Expand Up @@ -197,9 +195,9 @@ void close() {

}

// servlets to manage web socket connections
// POJO for each web socket connection

@WebSocket(maxIdleTime = Integer.MAX_VALUE)
@WebSocket(maxIdleTime = Integer.MAX_VALUE, batchMode = BatchMode.OFF)
public class WSHandler {

Session session = null;
Expand Down Expand Up @@ -232,12 +230,12 @@ public void onError(Throwable t) {
@OnWebSocketMessage
public void onMessage(String message) {
byte[] buf = message.getBytes();
synchronized (pin) {
synchronized (conn.pin) {
for (int c : buf) {
if (c < 0) c += 256;
if (c == 4) continue; // ignore ^D
try {
pin.write(c);
conn.pin.write(c);
} catch (IOException ex) {
// do nothing
}
Expand Down

0 comments on commit a381db3

Please sign in to comment.