Skip to content

Commit

Permalink
WFLY-11975 Distributed web session metadata payload contains unnecess…
Browse files Browse the repository at this point in the history
…ary nanosecond precision
  • Loading branch information
pferraro committed Apr 11, 2019
1 parent ababc29 commit aed54b6
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -30,7 +30,6 @@

import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.marshalling.Externalizer;
import org.wildfly.clustering.marshalling.spi.DefaultExternalizer;
import org.wildfly.clustering.marshalling.spi.IndexSerializer;

/**
Expand All @@ -43,13 +42,14 @@ public class SessionCreationMetaDataEntryExternalizer implements Externalizer<Se
@Override
public void writeObject(ObjectOutput output, SessionCreationMetaDataEntry<Object> entry) throws IOException {
SessionCreationMetaData metaData = entry.getMetaData();
DefaultExternalizer.INSTANT.cast(Instant.class).writeObject(output, metaData.getCreationTime());
// We only need millisecond precision
output.writeLong(metaData.getCreationTime().toEpochMilli());
IndexSerializer.VARIABLE.writeInt(output, (int) metaData.getMaxInactiveInterval().getSeconds());
}

@Override
public SessionCreationMetaDataEntry<Object> readObject(ObjectInput input) throws IOException, ClassNotFoundException {
SessionCreationMetaData metaData = new SimpleSessionCreationMetaData(DefaultExternalizer.INSTANT.cast(Instant.class).readObject(input));
SessionCreationMetaData metaData = new SimpleSessionCreationMetaData(Instant.ofEpochMilli(input.readLong()));
metaData.setMaxInactiveInterval(Duration.ofSeconds(IndexSerializer.VARIABLE.readInt(input)));
return new SessionCreationMetaDataEntry<>(metaData);
}
Expand Down

0 comments on commit aed54b6

Please sign in to comment.