Remove serialization logging as part of the serialization process
This commit is contained in:
parent
4d50cb462c
commit
e9e4c6b2ee
@ -98,17 +98,19 @@ interface SerializationManager {
|
|||||||
/**
|
/**
|
||||||
* Writes the class and object using an available kryo instance
|
* Writes the class and object using an available kryo instance
|
||||||
*/
|
*/
|
||||||
void writeFullClassAndObject(final Logger logger, Output output, Object value) throws IOException;
|
void writeFullClassAndObject(Output output, Object value) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a class read from the input
|
* Returns a class read from the input
|
||||||
*/
|
*/
|
||||||
Object readFullClassAndObject(final Logger logger, final Input input) throws IOException;
|
Object readFullClassAndObject(final Input input) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when initialization is complete. This is to prevent (and recognize) out-of-order class/serializer registration.
|
* Called when initialization is complete. This is to prevent (and recognize) out-of-order class/serializer registration.
|
||||||
|
*
|
||||||
|
* The loggers are for trace debug output for the wire data
|
||||||
*/
|
*/
|
||||||
void finishInit();
|
void finishInit(final Logger wireReadLogger, final Logger wireWriteLogger);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if our initialization is complete. Some registrations (in the property store, for example) always register for client
|
* @return true if our initialization is complete. Some registrations (in the property store, for example) always register for client
|
||||||
|
@ -66,7 +66,7 @@ class DefaultStorageSerializationManager implements SerializationManager {
|
|||||||
public
|
public
|
||||||
void write(final ByteBuf buffer, final Object message) {
|
void write(final ByteBuf buffer, final Object message) {
|
||||||
final Output output = new Output();
|
final Output output = new Output();
|
||||||
writeFullClassAndObject(null, output, message);
|
writeFullClassAndObject(output, message);
|
||||||
buffer.writeBytes(output.getBuffer());
|
buffer.writeBytes(output.getBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class DefaultStorageSerializationManager implements SerializationManager {
|
|||||||
final Input input = new Input();
|
final Input input = new Input();
|
||||||
buffer.readBytes(input.getBuffer());
|
buffer.readBytes(input.getBuffer());
|
||||||
|
|
||||||
final Object o = readFullClassAndObject(null, input);
|
final Object o = readFullClassAndObject(input);
|
||||||
buffer.skipBytes(input.position());
|
buffer.skipBytes(input.position());
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
@ -84,19 +84,19 @@ class DefaultStorageSerializationManager implements SerializationManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void writeFullClassAndObject(final Logger logger, final Output output, final Object value) {
|
void writeFullClassAndObject(final Output output, final Object value) {
|
||||||
kryo.writeClassAndObject(output, value);
|
kryo.writeClassAndObject(output, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
Object readFullClassAndObject(final Logger logger, final Input input) throws IOException {
|
Object readFullClassAndObject(final Input input) throws IOException {
|
||||||
return kryo.readClassAndObject(input);
|
return kryo.readClassAndObject(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void finishInit() {
|
void finishInit(final Logger logger, final Logger writeLogger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -275,7 +275,7 @@ class Metadata {
|
|||||||
input.setInputStream(input.getInputStream());
|
input.setInputStream(input.getInputStream());
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
T readObject = (T) serializationManager.readFullClassAndObject(null, input);
|
T readObject = (T) serializationManager.readFullClassAndObject(input);
|
||||||
return readObject;
|
return readObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ class Metadata {
|
|||||||
|
|
||||||
output.clear();
|
output.clear();
|
||||||
|
|
||||||
serializationManager.writeFullClassAndObject(null, output, data);
|
serializationManager.writeFullClassAndObject(output, data);
|
||||||
output.flush();
|
output.flush();
|
||||||
|
|
||||||
return (int) output.total();
|
return (int) output.total();
|
||||||
|
@ -483,7 +483,7 @@ class StorageBase {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// this is comparatively slow, since we serialize it first to get the size, then we put it in the file.
|
// this is comparatively slow, since we serialize it first to get the size, then we put it in the file.
|
||||||
ByteArrayOutputStream dataStream = getDataAsByteArray(this.serializationManager, this.logger, object);
|
ByteArrayOutputStream dataStream = getDataAsByteArray(this.serializationManager, object);
|
||||||
|
|
||||||
int size = dataStream.size();
|
int size = dataStream.size();
|
||||||
if (size > metaData.dataCapacity) {
|
if (size > metaData.dataCapacity) {
|
||||||
@ -564,11 +564,11 @@ class StorageBase {
|
|||||||
|
|
||||||
|
|
||||||
private static
|
private static
|
||||||
ByteArrayOutputStream getDataAsByteArray(SerializationManager serializationManager, Logger logger, Object data) throws IOException {
|
ByteArrayOutputStream getDataAsByteArray(SerializationManager serializationManager, Object data) throws IOException {
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
Output output = new Output(outputStream, 1024); // write 1024 at a time
|
Output output = new Output(outputStream, 1024); // write 1024 at a time
|
||||||
|
|
||||||
serializationManager.writeFullClassAndObject(logger, output, data);
|
serializationManager.writeFullClassAndObject(output, data);
|
||||||
output.flush();
|
output.flush();
|
||||||
|
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
|
Loading…
Reference in New Issue
Block a user