WeatherStatusClient WHILE NOT TERMINATED READ current location and temperature #C1 SEND Location Temperature to WeatherStatusServer RECEIVE message
Question:
WeatherStatusClient WHILE NOT TERMINATED READ current location and temperature #C1 SEND "Location Temperature" to WeatherStatusServer RECEIVE message from WeatherStatusServer IF message = "Do not understand, please try again" THEN GOTO #C1 ELSE IF message = "Details Saved" GOTO #C2 ELSE IF no message received from WeatherStatusServer THEN GOTO #C3 END IF
#C2 SEND "Last temperature at LOCATION" to WeatherStatusServer RECEIVE message from WeatherStatusServer IF message = "Do not understand, please try again" THEN GOTO #C2
ELSE IF no message received from WeatherStatusServer THEN GOTO #C3 ELSE IF message = "last saved temperature at location" THEN Print message END IF
#C3 IF no message received from WeatherStatusServer following three attempts THEN notify user that designated computer is not running END IF
[TERMINATE] END WHILE
WeatherStatuesServer [Start running at port 6464] WHILE NOT TERMINATED RECEIVE message from WeatherStatusClient IF message = "LOCATION TEMPERATURE" THEN GOTO #S1
ELSE IF message = "Last temperature at LOCATION" THEN GOTO #S2
ELSE SEND "Do not understand, please try again" to WeatherStatusClient END IF #S1 SAVE details in database THEN SEND "Details saved" to WeatherStatusClient
#S2 Retrieve last saved temperature from database THEN SEND "last saved temperature at LOCATION" to WeatherStatusClient
[Terminated] END WHILE
Question: how this design could be modified to allow for multiple clients that can safely access a data store containing all the temperature/location data including details how threads and a locking scheme could be used to do this. by using an appropriate state diagram to illustrate how threads can be used to implement concurrency in Java.