Instances of HeartbeatPacket and EarthquakesRequestPacket are sent periodically during a connection. However, these two record classes carry no additional information, so it is safe to reuse a single instance for each of them. As ObjectInputStreams and ObjectOutputStreams track all instances involved in them, this can improve memory usage of the application.
Description
Instances of
HeartbeatPacket
andEarthquakesRequestPacket
are sent periodically during a connection. However, these two record classes carry no additional information, so it is safe to reuse a single instance for each of them. AsObjectInputStream
s andObjectOutputStream
s track all instances involved in them, this can improve memory usage of the application.