| | |
| | | |
| | | /** |
| | | * This class Implement a protocol session using a basic socket and relying on |
| | | * the innate encoding/decoding capabilities of the SynchronizationMessage |
| | | * the innate encoding/decoding capabilities of the ReplicationMessage |
| | | * by using the getBytes() and generateMsg() methods of those classes. |
| | | * |
| | | * TODO : should have some versioning in the packets so that |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public synchronized void publish(SynchronizationMessage msg) |
| | | public synchronized void publish(ReplicationMessage msg) |
| | | throws IOException |
| | | { |
| | | byte[] buffer = msg.getBytes(); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public SynchronizationMessage receive() throws IOException, |
| | | public ReplicationMessage receive() throws IOException, |
| | | ClassNotFoundException, DataFormatException |
| | | { |
| | | /* Read the first 8 bytes containing the packet length */ |
| | |
| | | /* We do not want the heartbeat to close the session when */ |
| | | /* we are processing a message even a time consuming one. */ |
| | | lastReceiveTime=0; |
| | | return SynchronizationMessage.generateMsg(buffer); |
| | | return ReplicationMessage.generateMsg(buffer); |
| | | } |
| | | catch (OutOfMemoryError e) |
| | | { |