You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/10/08 19:09:30 UTC

svn commit: r1530353 - in /tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard: Client.java DrawMessage.java DrawboardEndpoint.java Room.java wsmessages/CloseWebsocketMessage.java

Author: markt
Date: Tue Oct  8 17:09:29 2013
New Revision: 1530353

URL: http://svn.apache.org/r1530353
Log:
Add missing license header.
Remove trailing whitespace.
Fix Javadoc errors.
Remove some blank lines.

Modified:
    tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
    tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
    tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
    tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
    tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java

Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java?rev=1530353&r1=1530352&r2=1530353&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java Tue Oct  8 17:09:29 2013
@@ -78,7 +78,7 @@ public class Client {
      * Sends the given message asynchronously to the client.
      * If there is already a async sending in progress, then the message
      * will be buffered and sent when possible.<br><br>
-     * 
+     *
      * This method can be called from multiple threads.
      * @param msg
      */
@@ -111,7 +111,7 @@ public class Client {
                         }
 
                     } else {
-    
+
                         // Check if the last message and the new message are
                         // String messages - in that case we concatenate them
                         // to reduce TCP overhead (using ";" as separator).

Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java?rev=1530353&r1=1530352&r2=1530353&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java Tue Oct  8 17:09:29 2013
@@ -24,13 +24,12 @@ import java.awt.Graphics2D;
  * A message that represents a drawing action.
  * Note that we use primitive types instead of Point, Color etc.
  * to reduce object allocation.<br><br>
- * 
+ *
  * TODO: But a Color objects needs to be created anyway for drawing this
  * onto a Graphics2D object, so this probably does not save much.
  */
 public final class DrawMessage {
 
-
     private int type;
     private byte colorR, colorG, colorB, colorA;
     private double thickness;
@@ -38,7 +37,6 @@ public final class DrawMessage {
 
     /**
      * The type. 1: Line.
-     * @return
      */
     public int getType() {
         return type;
@@ -156,7 +154,7 @@ public final class DrawMessage {
     public static DrawMessage parseFromString(String str)
             throws ParseException {
 
-        int type; 
+        int type;
         byte[] colors = new byte[4];
         double thickness;
         int[] coords = new int[4];

Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java?rev=1530353&r1=1530352&r2=1530353&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java Tue Oct  8 17:09:29 2013
@@ -49,7 +49,7 @@ public final class DrawboardEndpoint ext
     /**
      * The player that is associated with this Endpoint and the current room.
      * Note that this variable is only accessed from the Room Thread.<br><br>
-     * 
+     *
      * TODO: Currently, Tomcat uses an Endpoint instance once - however
      * the java doc of endpoint says:
      * "Each instance of a websocket endpoint is guaranteed not to be called by
@@ -193,7 +193,7 @@ public final class DrawboardEndpoint ext
                         } catch (RuntimeException|ParseException ex) {
                             // Client sent invalid data.
                             // Ignore, TODO: maybe close connection
-                            if (dontSwallowException 
+                            if (dontSwallowException
                                     && ex instanceof RuntimeException) {
                                 throw (RuntimeException) ex;
                             }

Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java?rev=1530353&r1=1530352&r2=1530353&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java Tue Oct  8 17:09:29 2013
@@ -40,7 +40,7 @@ import websocket.drawboard.wsmessages.St
 /**
  * A Room represents a drawboard where a number of
  * users participate.<br><br>
- * 
+ *
  * Each Room has its own "Room Thread" which manages all the actions
  * to be done in this Room. Instance methods should only be invoked
  * from this Room's thread by calling {@link #invoke(Runnable)} or
@@ -52,7 +52,7 @@ public final class Room {
      * Specifies the type of a room message that is sent to a client.<br>
      * Note: Currently we are sending simple string messages - for production
      * apps, a JSON lib should be used for object-level messages.<br><br>
-     * 
+     *
      * The number (single char) will be prefixed to the string when sending
      * the message.
      */
@@ -96,7 +96,7 @@ public final class Room {
      * drawmessageBroadcastTimer ticks. Otherwise they will be sent
      * immediately.
      */
-    private static final boolean BUFFER_DRAW_MESSAGES = true; 
+    private static final boolean BUFFER_DRAW_MESSAGES = true;
 
     /**
      * A single-threaded ExecutorService where tasks
@@ -163,8 +163,7 @@ public final class Room {
 
     /**
      * Creates a Player from the given Client and adds it to this room.
-     * @param c the client
-     * @return
+     * @param client the client
      */
     public Player createAndAddPlayer(Client client) {
         if (players.size() >= MAX_PLAYER_COUNT) {
@@ -294,7 +293,7 @@ public final class Room {
 
                     sb.append(s);
                 }
-                drawMessages.clear();            
+                drawMessages.clear();
 
                 p.sendRoomMessage(MessageType.DRAW_MESSAGE, sb.toString());
             }
@@ -302,11 +301,9 @@ public final class Room {
     }
 
 
-
-
     /**
      * Submits the given Runnable to the Room Executor.
-     * @param run
+     * @param task
      */
     public void invoke(Runnable task) {
         roomExecutor.submit(task);
@@ -318,7 +315,7 @@ public final class Room {
      * @param task
      * @throws InterruptedException if the current thread was interrupted
      * while waiting
-     * @throws ExecutionException if the computation threw an exception 
+     * @throws ExecutionException if the computation threw an exception
      */
     public void invokeAndWait(Runnable task)
             throws InterruptedException, ExecutionException {
@@ -335,11 +332,10 @@ public final class Room {
     }
 
 
-
     /**
      * A Player participates in a Room. It is the interface between the
      * {@link Room} and the {@link Client}.<br><br>
-     * 
+     *
      * Note: This means a player object is actually a join between Room and
      * Endpoint.
      */
@@ -370,8 +366,6 @@ public final class Room {
             return bufferedDrawMessages;
         }
 
-
-
         private Player(Room room, Client client) {
             this.room = room;
             this.client = client;
@@ -408,7 +402,6 @@ public final class Room {
         /**
          * Handles the given DrawMessage by drawing it onto this Room's
          * image and by broadcasting it to the connected players.
-         * @param sender
          * @param msg
          * @param msgId
          */
@@ -430,10 +423,5 @@ public final class Room {
 
             client.sendMessage(new StringWebsocketMessage(completeMsg));
         }
-
-
-
     }
-
-
 }

Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java?rev=1530353&r1=1530352&r2=1530353&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java Tue Oct  8 17:09:29 2013
@@ -1,3 +1,19 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package websocket.drawboard.wsmessages;
 
 /**



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org