protected void storeEntity (Object id, Object obj) throws Exception { try { // Store fields java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream (); java.io.ObjectOutputStream out = new org.jboss.ejb.plugins.CMPClusteredInMemoryPersistenceManager.CMPObjectOutputStream (baos); Field[] f = obj.getClass ().getFields (); for (int i = 0; i < f.length; i++) { out.writeObject (f[i].get (obj)); } out.close (); this.ds.set (this.DS_CATEGORY, id.toString (), baos.toByteArray (), false); } catch (Exception e) { throw new EJBException ("Store failed", e); } }
@SuppressWarnings("unchecked") protected synchronized void publishLocalInvalidationGroups() throws Exception { this.localGroups = this.invalMgr.getInvalidationGroups(); this.log.debug("Publishing locally available invalidation groups: " + this.localGroups); ArrayList<InvalidationGroup> content = new ArrayList<InvalidationGroup>(this.localGroups); ArrayList<String> result = new ArrayList<String>(content.size()); for (int i = 0; i < content.size(); i++) { String aGroup = content.get(i).getGroupName(); result.add(aGroup); } String nodeName = this.partition.getNodeName(); DistributedState ds = this.partition.getDistributedStateService(); if (result.size() > 0) { NodeInfo info = new NodeInfo(result, nodeName); ds.set(this.RPC_HANDLER_NAME, nodeName, info, true); } else { ds.remove(this.RPC_HANDLER_NAME, nodeName, true); } }
/** * * * Convenience method for sharing state across a cluster partition. * Delegates to the DistributedStateService * * @param key key for the distributed object * @param value the distributed object * */ public void setDistributedState(String key, Serializable value) throws Exception { DistributedState ds = this.getHAPartition().getDistributedStateService(); ds.set(this.getHAServiceKey(), key, value); }
try this.entryMap.set(this.category, skey, entry);