Commit d4979351 authored by David Feliot's avatar David Feliot
Browse files

Producer message flow control

parent 36590941
......@@ -71,10 +71,8 @@ public class MemoryController {
long currentSize = memorySize.addAndGet(delta);
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "memorySize=" + memorySize.get());
if (delta < 0) {
checkMemory(currentSize);
}
}
private void checkMemory(long currentSize) {
if (currentSize <= memorySizeMax) {
......
......@@ -390,6 +390,8 @@ public final class Message implements Serializable, MessageView, TransactionObje
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Message.save:" + txid);
if (!isPersistent()) return;
// JORAM_PERF_BRANCH
int bodySize;
if (msg.body != null) {
......@@ -399,8 +401,6 @@ public final class Message implements Serializable, MessageView, TransactionObje
}
MemoryController.getMemoryController().add(bodySize);
if (!isPersistent()) return;
if (soft) {
byte[] body = msg.body;
// sets the body to null to save it in an other file
......@@ -464,6 +464,8 @@ public final class Message implements Serializable, MessageView, TransactionObje
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Message.delete:" + txid);
if (!isPersistent()) return;
// JORAM_PERF_BRANCH
int bodySize;
if (msg.body != null) {
......@@ -473,8 +475,6 @@ public final class Message implements Serializable, MessageView, TransactionObje
}
MemoryController.getMemoryController().add(-bodySize);
if (!isPersistent()) return;
AgentServer.getTransaction().delete(txid);
if (soft) {
// JORAM_PERF_BRANCH
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment