But later have found out the root cause was happened when reading the properties values from configurable service defined in Message Broker. As according to the documentation, whenever reading the properties values with BrokerProxy as shown in the following code, it is advisable to invoke brokerProxy.disconnect() to free up resources, otherwise the memory will keep piling up causing memory leaks.
public class JavaNode extends MbJavaComputeNode { @Override public void evaluate(MbMessageAssembly inAssembly) throws MbException { BrokerProxy brokerProxy; try { brokerProxy = BrokerProxy.getLocalInstance(); brokerProxy.getConfigurableService("USERDEFINED", "key"); } catch (ConfigManagerProxyLoggedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (ConfigManagerProxyPropertyNotInitializedException e) { // TODO Auto-generated catch block e.printStackTrace(); } ... } }
Thus what I did is to invoke the disconnect() in finally clause. But have to be aware that after the resources had been freed, brokerProxy will no longer usable and have to be renew. Below are some useful resources I have read in solving the issue:
No comments:
Post a Comment