Пример #1
0
 /// <exception cref="System.IO.IOException"/>
 public ShortCircuitReplica(ExtendedBlockId key, FileInputStream dataStream, FileInputStream
                            metaStream, ShortCircuitCache cache, long creationTimeMs, ShortCircuitShm.Slot
                            slot)
 {
     this.key        = key;
     this.dataStream = dataStream;
     this.metaStream = metaStream;
     this.metaHeader = BlockMetadataHeader.PreadHeader(metaStream.GetChannel());
     if (metaHeader.GetVersion() != 1)
     {
         throw new IOException("invalid metadata header version " + metaHeader.GetVersion(
                                   ) + ".  Can only handle version 1.");
     }
     this.cache          = cache;
     this.creationTimeMs = creationTimeMs;
     this.slot           = slot;
 }
Пример #2
0
 /// <summary>Convert the replica to a string for debugging purposes.</summary>
 /// <remarks>
 /// Convert the replica to a string for debugging purposes.
 /// Note that we can't take the lock here.
 /// </remarks>
 public override string ToString()
 {
     return(new StringBuilder().Append("ShortCircuitReplica{").Append("key=").Append(key
                                                                                     ).Append(", metaHeader.version=").Append(metaHeader.GetVersion()).Append(", metaHeader.checksum="
                                                                                                                                                              ).Append(metaHeader.GetChecksum()).Append(", ident=").Append("0x").Append(Sharpen.Extensions.ToHexString
                                                                                                                                                                                                                                            (Runtime.IdentityHashCode(this))).Append(", creationTimeMs=").Append(creationTimeMs
                                                                                                                                                                                                                                                                                                                 ).Append("}").ToString());
 }