[JBossCache] - Problems with PojoCache to work and outOfMemory
by yudivian
I have two problems using PojoCache. I have an application tha use PojoCache to replicate data, but when I run the application in one node it seems to work fine but when the time pass I got an OutOfMemory Exception and I don't know why. The other problem is that I can't run fine the application in more than one node. This is the code I use, and the application call the methods putMessage and getMessage all the time. I appreciate any help on this.
This is the code
| public class JBCacheDMS {
|
| private static final Logger log = Logger.getLogger(JBCacheDMS.class);
|
| protected boolean inited;
|
| protected PojoCache queues;
|
| protected HashMap<String, List> proxyQueues;
|
| public void init(String DMSUrl, String[] DMSnodesUrls) {
| try {
| queues = new PojoCache();
| PropertyConfigurator config = new PropertyConfigurator(); // configure tree cache.
| config.configure(queues, "config/replSyncPC-service.xml");
| String platformName = System.getProperty("platformName");
| queues.setClusterName("DMS-" + platformName);
| queues.setCacheMode(PojoCache.REPL_SYNC);
| queues.createService();
| queues.startService();
| // addTreeCacheListener();
| proxyQueues = new HashMap<String, List>();
| inited = true;
| } catch (Exception e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
|
| }
|
| /**
| * To add a TreeCacheListener
| *
| * @param listener
| * The listener to add
| */
| public void addTreeCacheListener(TreeCacheListener listener) {
| queues.addTreeCacheListener(listener);
| }
|
| /**
| * To remove a TreeCacheListener
| *
| * @param listener
| * The listener to remove
| */
| public void removeTreeCacheListener(TreeCacheListener listener) {
| queues.removeTreeCacheListener(listener);
| }
|
| /**
| * Return an instance of DMStorage(the class itself) if the class was
| * inited, if not returns null
| *
| * @return an instance of DMS
| */
| public DMS getDMS() {
| if (inited)
| return this;
| return null;
| }
|
| public void stop() {
| // TODO Auto-generated method stub
|
| }
|
| public void createQueue(String name) {
| try {
| queues.putObject(name, new ArrayList<AbstractMessage>());
| List<AbstractMessage> proxyList = (List) queues.getObject(name);
| proxyQueues.put(name, proxyList);
| // System.out.println(getAgent(name).getName().getName());
| } catch (CacheException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
|
| }
|
| public void deleteQueue(String name) {
| try {
| proxyQueues.remove(name);
| queues.removeObject(name);
| queues.remove(name);
| } catch (CacheException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
|
| }
|
| public void putMessage(String name, AbstractMessage message) {
| if (!queues.exists(name)){
| createQueue(name);
| }
| List<AbstractMessage> proxyList = proxyQueues.get(name);
| proxyList.add(message);
| }
|
| public AbstractMessage getMessageBusy(String name) {
| if (!queues.exists(name)){
| createQueue(name);
| }
| List<AbstractMessage> proxyList = proxyQueues.get(name);
| AbstractMessage message = proxyList.remove(0);
| while(message == null){
| message = proxyList.remove(0);
| try {
| Thread.sleep(10);
| } catch (InterruptedException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| }
| return message;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969023#3969023
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969023
19 years, 7 months
[Beginners Corner] - Basic CMR Question
by ianfmc
Hi Everyone:
I'm fairly new to J2EE, so this may be a very basic question. I apologize in advance.
I have successfully defined an EJB that reads a table in the HSQL, and correctly reports the values from that table.
As an exercise, I added a second table with a 1:1 relationship to the first, which both have a common ID field. In the first table (Player) this is primary-key (PlayerID), and in the second table (Ranking), it is the foreign-key (also PlayerID). The other two fields in the Player Table are: FirstName and LastName. In the Ranking Table, there are two fields: PlayerID and Ranking.
I created a container managed relation (CMR) using the wizard in Jboss-IDE, but when I now try to get all Player records, I get the following Exception
| java.sql.SQLException: Column not found: RANKING in statement [SELECT playerID, lastName, firstName, ranking FROM PLAYER WHERE (playerID=?) OR (playerID=?) OR (playerID=?)]
|
I define the method findAllPlayers() using XDoclet as follows
| * @ejb.finder
| * query = "SELECT OBJECT(b) FROM Player AS b"
| * signature = "java.util.Collection findAllPlayers()"
|
the XDoclet tag in the first Bean (PlayerBean) looks like this:
/**
| * Getter for CMR Relationship
| *
| * @ejb.interface-method view-type="remote"
| * @ejb.relation name = "Player-Ranking"
| * role-name = "Player_Has_A_Ranking"
| * target-ejb = "Ranking"
| * target-role-name = "Ranking"
| * target-multiple = "no"
| */
| public abstract String getRanking();
|
Any advice would be greatly appreciated!
Thanks, Ian.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969020#3969020
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969020
19 years, 7 months
[JBoss Portal] - Preview link on Management portlet broken
by sandeeppujar
Greetings,
I am running Jbossportal 2.4-GA, and here is the issue.
Login as admin and go to management portlet.
Steps to repro:
1. Create a new Page.
2. Hit "Preview" link or the new Page link on the nav bar.
3. The new page shows up with no portlets on it , so far so good.
4. Go back to management portlet and add a portlet on this new page.
5. Hit "Preview" link or the new Page link on the nav bar, the newly added portlet does not show up on the new page.
More info: if you copy the link to this new page and paste it in another instance of the browser then the new page shows up with the new portlet on it.
If you are thinking about browser cache, yes I did clean up my browser cache and hit refresh and still it did not work.
Something funky going on here with sessions and cache.
Any pointers on what might be going wrong ?
Thanks,
Sandeep
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969017#3969017
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969017
19 years, 7 months