/** * {@inhericDoc} * @see org.jboss.ha.framework.server.HAServiceImpl#getReplicant() */ protected Serializable getReplicant() { return new SimpleCachableMarshalledValue(this.drmEntry); }
private Serializable createReplicant(ModClusterServiceDRMEntry entry) { return new SimpleCachableMarshalledValue(entry); }
protected RDBMSStoreBase() { try { Object empty = new SimpleCachableMarshalledValue(new HashMap<String, Object>()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(empty); oos.close(); emptyAttributes = baos.toByteArray(); } catch (IOException e) { throw new RuntimeException("Cannot serialize simple HashMap"); } }
/** * {@inheritDoc} * @see org.jboss.web.tomcat.service.session.distributedcache.spi.SessionAttributeMarshaller#marshal(java.lang.Object) */ @Override public Object marshal(Object value) { if ((value == null) || MarshalledValueHelper.isTypeExcluded(value.getClass())) return value; if (!(value instanceof Serializable)) { throw new IllegalArgumentException(String.format("%s does not implement %s", value, Serializable.class.getName())); } return new SimpleCachableMarshalledValue((Serializable) value, this.source, true); }
private byte[] writeSessionAttributes(OutgoingSessionGranularitySessionData session) throws IOException { Map<String, Object> attrs = session.getSessionAttributes(); if (attrs == null) { return null; } ObjectOutputStream oos = null; ByteArrayOutputStream bos = null; try { bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(new BufferedOutputStream(bos)); oos.writeObject(new SimpleCachableMarshalledValue((Serializable) attrs)); oos.close(); return bos.toByteArray(); } finally { if (oos != null) { oos.close(); } if (bos != null) { bos.close(); } } }