Commit 2d268457 authored by Andre Freyssinet's avatar Andre Freyssinet

Allows to fix a destination in memory (JORAM-358).

parent c9935311
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2019 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2020 ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 Dyade
*
* This library is free software; you can redistribute it and/or
......@@ -221,12 +221,12 @@ public abstract class Destination extends Agent implements DestinationMBean {
/**
* Finalizes the agent before it is garbaged.
*
* @param lastime true if the destination is deleted
* @param last true if the destination is deleted
*/
public void agentFinalize(boolean lastTime) {
public void agentFinalize(boolean last) {
if (task != null) task.cancel();
finalize(lastTime);
finalize(last);
try {
MXWrapper.unregisterMBean(getMBeanName());
......@@ -234,15 +234,15 @@ public abstract class Destination extends Agent implements DestinationMBean {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Destination.agentFinalize", exc);
}
super.agentFinalize(lastTime);
super.agentFinalize(last);
}
/**
* Finalizes the destination before it is garbaged.
*
* @param lastime true if the destination is deleted
* @param last true if the destination is deleted
*/
protected abstract void finalize(boolean lastTime);
protected abstract void finalize(boolean last);
public String getMBeanName() {
StringBuffer strbuf = new StringBuffer();
......@@ -410,10 +410,18 @@ public abstract class Destination extends Agent implements DestinationMBean {
logger.log(BasicLevel.ERROR, this + ": error setting destination period", e);
}
}
boolean fixedInMemory = false;
if (prop != null && prop.containsKey(DestinationConstants.FIXED_IN_MEMORY))
fixedInMemory = ConversionHelper.toBoolean(prop.get(DestinationConstants.FIXED_IN_MEMORY));
if (firstTime) {
period = newPeriod;
fixed = fixedInMemory;
} else {
setPeriod(newPeriod);
if (fixedInMemory)
logger.log(BasicLevel.ERROR, this + ": cannot fix already created destination in memory.");
}
interceptorsProp = null;
......@@ -476,8 +484,11 @@ public abstract class Destination extends Agent implements DestinationMBean {
/**
* Method implementing the reaction to a <code>SetRightRequest</code>
* notification requesting rights to be set for a user.
*
* @param not The notification describing the security modifications.
*
* @param request ACL
* @param replyTo Identifier of the sender
* @param requestMsgId identifier of the request
* @param replyMsgId identifier of the reply
*/
protected void setRight(SetRight request,
AgentId replyTo,
......@@ -901,9 +912,7 @@ public abstract class Destination extends Agent implements DestinationMBean {
* is used in subclass of {@link Queue} and {@link Topic}.
* The incoming messages can be modified or deleted during the processing.
*
* @param from The sender of the message
* @param msgs The incoming messages.
* @return The incoming messages after processing.
*/
protected void postProcess(ClientMessages msgs) {
// nothing to do.
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2009 - 2019 ScalAgent Distributed Technologies
* Copyright (C) 2009 - 2020 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -35,6 +35,12 @@ public final class DestinationConstants {
public static final String REDELIVERY_DELAY = "redeliveryDelay";
public static final String DELIVERY_DELAY = "deliveryDelay";
/**
* Name of property allowing to force the destination to be always in memory.
* By side effect the destination is pre-loaded during server initialization.
*/
public static final String FIXED_IN_MEMORY = "fixedInMemory";
/** The property name for the distribution handler class name. */
public static final String DISTRIBUTION_CLASS_NAME = "distribution.className";
/** */
......
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