certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] jcerti/src/certi communication/MessageBuffer.ja...


From: CERTI CVS commits
Subject: [certi-cvs] jcerti/src/certi communication/MessageBuffer.ja...
Date: Mon, 28 Nov 2011 12:56:01 +0000

CVSROOT:        /sources/certi
Module name:    jcerti
Changes by:     Eric NOULARD <erk>      11/11/28 12:56:01

Modified files:
        src/certi/communication: MessageBuffer.java CertiMessage.java 
        src/certi/rti/impl: CertiRtiAmbassador.java 

Log message:
        Enhance thread safety of jcerti.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/communication/MessageBuffer.java?cvsroot=certi&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/communication/CertiMessage.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/rti/impl/CertiRtiAmbassador.java?cvsroot=certi&r1=1.3&r2=1.4

Patches:
Index: communication/MessageBuffer.java
===================================================================
RCS file: /sources/certi/jcerti/src/certi/communication/MessageBuffer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- communication/MessageBuffer.java    19 May 2010 14:11:04 -0000      1.3
+++ communication/MessageBuffer.java    28 Nov 2011 12:56:00 -0000      1.4
@@ -296,7 +296,7 @@
      * @throws IOException
      * @throws CertiException
      */
-    public void receiveData() throws IOException, CertiException {
+    synchronized public void receiveData() throws IOException, CertiException {
         this.reset();
 
         //Read endianess
@@ -328,7 +328,7 @@
      * @param out
      * @throws IOException
      */
-    public void send() throws IOException {
+    synchronized public void send() throws IOException {
         //Construct the header
         Vector<Byte> message = new Vector<Byte>();
 

Index: communication/CertiMessage.java
===================================================================
RCS file: /sources/certi/jcerti/src/certi/communication/CertiMessage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- communication/CertiMessage.java     29 Mar 2010 07:53:22 -0000      1.2
+++ communication/CertiMessage.java     28 Nov 2011 12:56:00 -0000      1.3
@@ -66,6 +66,9 @@
      * @param messageBuffer the <code>MessageBuffer</code> in which the method 
will write the state of the <code>CertiMessage</code>
      */
     public void writeMessage(MessageBuffer messageBuffer) {
+        
+        synchronized (messageBuffer) {
+
         //write the header
         messageBuffer.reset();
         //HEADER
@@ -89,6 +92,7 @@
             messageBuffer.write(tag);
         }
     }
+    }
 
     /**
      * Gives the correct values to the message attributes by reading them from 
specified <code>MessageBuffer</code>.
@@ -97,6 +101,9 @@
      * @throws CertiException
      */
     public void readMessage(MessageBuffer messageBuffer) throws CertiException 
{
+        
+        synchronized (messageBuffer) {
+
         this.exception = 
CertiExceptionType.reverse.get(messageBuffer.readInt());
 
         if (this.exception != CertiExceptionType.NO_EXCEPTION) {
@@ -122,6 +129,7 @@
             tag = messageBuffer.readBytes();
         }
     }
+    }
 
     /**
      * Returns the <code>CertiMessageType</code> of this 
<code>CertiMessage</code>.

Index: rti/impl/CertiRtiAmbassador.java
===================================================================
RCS file: /sources/certi/jcerti/src/certi/rti/impl/CertiRtiAmbassador.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- rti/impl/CertiRtiAmbassador.java    19 May 2010 14:11:04 -0000      1.3
+++ rti/impl/CertiRtiAmbassador.java    28 Nov 2011 12:56:00 -0000      1.4
@@ -181,7 +181,7 @@
         return false;
     }
 
-    private boolean tickKernel(boolean multiple, double minimum, double 
maximum) throws SpecifiedSaveLabelDoesNotExist, ConcurrentAccessAttempted, 
RTIinternalError {
+    synchronized private boolean tickKernel(boolean multiple, double minimum, 
double maximum) throws SpecifiedSaveLabelDoesNotExist, 
ConcurrentAccessAttempted, RTIinternalError {
         //TODO Code is hard to read - rewrite
         TickRequest tickRequest;
         CertiMessage tickResponse = null;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]