| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Decorates an {@link ReadableTransaction} with additional trace logging. |
| | | */ |
| | | /** Decorates an {@link ReadableTransaction} with additional trace logging. */ |
| | | private final class TracedReadableStorage implements ReadableTransaction |
| | | { |
| | | private final ReadableTransaction txn; |
| | |
| | | return value; |
| | | } |
| | | |
| | | @Override |
| | | public void close() |
| | | { |
| | | logger.trace("Storage@%s.ReadableStorage@%s.close()", storageId(), id()); |
| | | } |
| | | |
| | | private int id() |
| | | { |
| | | return System.identityHashCode(this); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Decorates an {@link WriteableTransaction} with additional trace logging. |
| | | */ |
| | | /** Decorates an {@link WriteableTransaction} with additional trace logging. */ |
| | | private final class TracedWriteableStorage implements WriteableTransaction |
| | | { |
| | | private final WriteableTransaction txn; |
| | |
| | | return isUpdated; |
| | | } |
| | | |
| | | @Override |
| | | public void close() |
| | | { |
| | | logger.trace("Storage@%s.WriteableStorage@%s.close()", storageId(), id()); |
| | | } |
| | | |
| | | private int id() |
| | | { |
| | | return System.identityHashCode(this); |
| | |
| | | storage.write(op); |
| | | } |
| | | |
| | | @Override |
| | | public WriteableTransaction getWriteableTransaction() |
| | | { |
| | | final WriteableTransaction writeableStorage = storage.getWriteableTransaction(); |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | return new TracedWriteableStorage(writeableStorage); |
| | | } |
| | | return writeableStorage; |
| | | } |
| | | |
| | | private String hex(final ByteSequence bytes) |
| | | { |
| | | return bytes != null ? bytes.toByteString().toHexString() : null; |