Pessoal, alguém ai tem conhecimento do cache do JBoss, to tentando fazer uns testes aqui utilizando TreeCache, mas não funciona.
Estou fazendo assim.
...
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
Context ctx = new InitialContext(props);
TreeCache tree = new TreeCache();
tree.setCacheMode(TreeCache.REPL_SYNC);
tree.startService();
for (int i = 0; i <= 5; i++) {
String dado = (String) tree.get(Thread.currentThread().getName()+"/"+String.valueOf(i),Thread.currentThread().getName()+"/"+String.valueOf(i));
System.out.println("Recuperando " + Thread.currentThread().getName()+"/"+String.valueOf(i) + " - " + dado);
}
...
Se eu tento recuperar isso depois nesta mesma execução blz, funciona, porém se tento rodar um programa que leia o cache de outra máquina ou até mesmo desta mesma em outro momento não dá certo.
Alguém pode me dizer o que to fazendo errado?