internal static Identity FindOrCreateIdentity(string objURI, string URL, ObjRef objectRef) { Identity idObj = null; bool flag = URL != null; idObj = ResolveIdentity(flag ? URL : objURI); if ((flag && (idObj != null)) && (idObj is ServerIdentity)) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_WellKnown_CantDirectlyConnect"), new object[] { URL })); } if (idObj == null) { idObj = new Identity(objURI, URL); ReaderWriterLock tableLock = TableLock; bool flag2 = !tableLock.IsWriterLockHeld; RuntimeHelpers.PrepareConstrainedRegions(); try { if (flag2) { tableLock.AcquireWriterLock(0x7fffffff); } idObj = SetIdentity(idObj, null, DuplicateIdentityOption.UseExisting); idObj.RaceSetObjRef(objectRef); } finally { if (flag2 && tableLock.IsWriterLockHeld) { tableLock.ReleaseWriterLock(); } } } return(idObj); }
internal static Identity FindOrCreateIdentity(string objURI, string URL, ObjRef objectRef) { int num = URL != null ? 1 : 0; Identity idObj = IdentityHolder.ResolveIdentity(num != 0 ? URL : objURI); if (num != 0 && idObj != null && idObj is ServerIdentity) { throw new RemotingException(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_WellKnown_CantDirectlyConnect"), (object)URL)); } if (idObj == null) { idObj = new Identity(objURI, URL); ReaderWriterLock tableLock = IdentityHolder.TableLock; bool flag = !tableLock.IsWriterLockHeld; RuntimeHelpers.PrepareConstrainedRegions(); try { if (flag) { tableLock.AcquireWriterLock(int.MaxValue); } idObj = IdentityHolder.SetIdentity(idObj, (string)null, DuplicateIdentityOption.UseExisting); idObj.RaceSetObjRef(objectRef); } finally { if (flag && tableLock.IsWriterLockHeld) { tableLock.ReleaseWriterLock(); } } } return(idObj); }
[System.Security.SecurityCritical] // auto-generated internal static Identity FindOrCreateIdentity( String objURI, String URL, ObjRef objectRef) { Identity idObj = null; Contract.Assert(null != objURI,"null != objURI"); bool bWellKnown = (URL != null); // Lookup the object in the identity table // for well-known objects we user the URL // as the hash-key (instead of just the objUri) idObj = ResolveIdentity(bWellKnown ? URL : objURI); if (bWellKnown && (idObj != null) && (idObj is ServerIdentity)) { // We are trying to do a connect to a server wellknown object. throw new RemotingException( String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "Remoting_WellKnown_CantDirectlyConnect"), URL)); } if (null == idObj) { // There is no entry for this uri in the IdTable. Message.DebugOut("RemotingService::FindOrCreateIdentity: Creating Identity\n"); // This identity is being encountered for the first time. // We have to do the following things // (1) Create an identity object for the proxy // (2) Add the identity to the identity table // (3) Create a proxy for the object represented by the objref // Create a new identity // <EMAIL>GopalK:</EMAIL> Identity should get only one string that is used for everything idObj = new Identity(objURI, URL); // We need to guarantee that finally is not interrupted so that the lock is released. // TableLock has a long path without reliability contract. To avoid adding contract on // the path, we will use ReaderWriterLock directly. ReaderWriterLock rwlock = TableLock; bool takeAndRelease = !rwlock.IsWriterLockHeld; RuntimeHelpers.PrepareConstrainedRegions(); try { // Add it to the identity table if (takeAndRelease) rwlock.AcquireWriterLock(INFINITE); // SetIdentity will give the correct Id if we ----d // between the ResolveIdentity call above and now. // (we are unmarshaling, and the server should guarantee // that the uri is unique, so we will use an existing identity // in case of a ----) idObj = SetIdentity(idObj, null, DuplicateIdentityOption.UseExisting); idObj.RaceSetObjRef(objectRef); } finally { if (takeAndRelease && rwlock.IsWriterLockHeld) { rwlock.ReleaseWriterLock(); } } } else { Message.DebugOut("RemotingService::FindOrCreateIdentity: Found Identity!\n"); } Contract.Assert(null != idObj,"null != idObj"); return idObj; }
// // // This is typically called when we are unmarshaling an objectref // in order to create a client side identity for a remote server // object. internal static Identity FindOrCreateIdentity( String objURI, String URL, ObjRef objectRef) { Identity idObj = null; bool bLock = false; BCLDebug.Assert(null != objURI,"null != objURI"); try { bool bWellKnown = (URL != null); // Lookup the object in the identity table // for well-known objects we user the URL // as the hash-key (instead of just the objUri) idObj = ResolveIdentity(bWellKnown ? URL : objURI); if (bWellKnown && (idObj != null) && (idObj is ServerIdentity)) { // We are trying to do a connect to a server wellknown object. throw new RemotingException( String.Format( Environment.GetResourceString( "Remoting_WellKnown_CantDirectlyConnect"), URL)); } if (null == idObj) { // There is no entry for this uri in the IdTable. Message.DebugOut("RemotingService::FindOrCreateIdentity: Creating Identity\n"); // This identity is being encountered for the first time. // We have to do the following things // (1) Create an identity object for the proxy // (2) Add the identity to the identity table // (3) Create a proxy for the object represented by the objref // Create a new identity // Identity should get only one string that is used for everything idObj = new Identity(objURI, URL); // Add it to the identity table TableLock.AcquireWriterLock(INFINITE); bLock = true; // SetIdentity will give the correct Id if we raced // between the ResolveIdentity call above and now. // (we are unmarshaling, and the server should guarantee // that the uri is unique, so we will use an existing identity // in case of a race) idObj = SetIdentity(idObj, null, DuplicateIdentityOption.UseExisting); idObj.RaceSetObjRef(objectRef); } else { Message.DebugOut("RemotingService::FindOrCreateIdentity: Found Identity!\n"); } } finally { if (bLock) { TableLock.ReleaseWriterLock(); } } BCLDebug.Assert(null != idObj,"null != idObj"); return idObj; }
// // // This is typically called when we are unmarshaling an objectref // in order to create a client side identity for a remote server // object. internal static Identity FindOrCreateIdentity( String objURI, String URL, ObjRef objectRef) { Identity idObj = null; bool bLock = false; BCLDebug.Assert(null != objURI, "null != objURI"); try { bool bWellKnown = (URL != null); // Lookup the object in the identity table // for well-known objects we user the URL // as the hash-key (instead of just the objUri) idObj = ResolveIdentity(bWellKnown ? URL : objURI); if (bWellKnown && (idObj != null) && (idObj is ServerIdentity)) { // We are trying to do a connect to a server wellknown object. throw new RemotingException( String.Format( Environment.GetResourceString( "Remoting_WellKnown_CantDirectlyConnect"), URL)); } if (null == idObj) { // There is no entry for this uri in the IdTable. Message.DebugOut("RemotingService::FindOrCreateIdentity: Creating Identity\n"); // This identity is being encountered for the first time. // We have to do the following things // (1) Create an identity object for the proxy // (2) Add the identity to the identity table // (3) Create a proxy for the object represented by the objref // Create a new identity // Identity should get only one string that is used for everything idObj = new Identity(objURI, URL); // Add it to the identity table TableLock.AcquireWriterLock(INFINITE); bLock = true; // SetIdentity will give the correct Id if we raced // between the ResolveIdentity call above and now. // (we are unmarshaling, and the server should guarantee // that the uri is unique, so we will use an existing identity // in case of a race) idObj = SetIdentity(idObj, null, DuplicateIdentityOption.UseExisting); idObj.RaceSetObjRef(objectRef); } else { Message.DebugOut("RemotingService::FindOrCreateIdentity: Found Identity!\n"); } } finally { if (bLock) { TableLock.ReleaseWriterLock(); } } BCLDebug.Assert(null != idObj, "null != idObj"); return(idObj); }
[System.Security.SecurityCritical] // auto-generated internal static Identity FindOrCreateIdentity( String objURI, String URL, ObjRef objectRef) { Identity idObj = null; Contract.Assert(null != objURI, "null != objURI"); bool bWellKnown = (URL != null); // Lookup the object in the identity table // for well-known objects we user the URL // as the hash-key (instead of just the objUri) idObj = ResolveIdentity(bWellKnown ? URL : objURI); if (bWellKnown && (idObj != null) && (idObj is ServerIdentity)) { // We are trying to do a connect to a server wellknown object. throw new RemotingException( String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "Remoting_WellKnown_CantDirectlyConnect"), URL)); } if (null == idObj) { // There is no entry for this uri in the IdTable. Message.DebugOut("RemotingService::FindOrCreateIdentity: Creating Identity\n"); // This identity is being encountered for the first time. // We have to do the following things // (1) Create an identity object for the proxy // (2) Add the identity to the identity table // (3) Create a proxy for the object represented by the objref // Create a new identity // <EMAIL>GopalK:</EMAIL> Identity should get only one string that is used for everything idObj = new Identity(objURI, URL); // We need to guarantee that finally is not interrupted so that the lock is released. // TableLock has a long path without reliability contract. To avoid adding contract on // the path, we will use ReaderWriterLock directly. ReaderWriterLock rwlock = TableLock; bool takeAndRelease = !rwlock.IsWriterLockHeld; RuntimeHelpers.PrepareConstrainedRegions(); try { // Add it to the identity table if (takeAndRelease) { rwlock.AcquireWriterLock(INFINITE); } // SetIdentity will give the correct Id if we raced // between the ResolveIdentity call above and now. // (we are unmarshaling, and the server should guarantee // that the uri is unique, so we will use an existing identity // in case of a ----) idObj = SetIdentity(idObj, null, DuplicateIdentityOption.UseExisting); idObj.RaceSetObjRef(objectRef); } finally { if (takeAndRelease && rwlock.IsWriterLockHeld) { rwlock.ReleaseWriterLock(); } } } else { Message.DebugOut("RemotingService::FindOrCreateIdentity: Found Identity!\n"); } Contract.Assert(null != idObj, "null != idObj"); return(idObj); }
internal static Identity FindOrCreateIdentity(string objURI, string URL, ObjRef objectRef) { Identity idObj = null; bool flag = URL != null; idObj = ResolveIdentity(flag ? URL : objURI); if ((flag && (idObj != null)) && (idObj is ServerIdentity)) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_WellKnown_CantDirectlyConnect"), new object[] { URL })); } if (idObj == null) { idObj = new Identity(objURI, URL); ReaderWriterLock tableLock = TableLock; bool flag2 = !tableLock.IsWriterLockHeld; RuntimeHelpers.PrepareConstrainedRegions(); try { if (flag2) { tableLock.AcquireWriterLock(0x7fffffff); } idObj = SetIdentity(idObj, null, DuplicateIdentityOption.UseExisting); idObj.RaceSetObjRef(objectRef); } finally { if (flag2 && tableLock.IsWriterLockHeld) { tableLock.ReleaseWriterLock(); } } } return idObj; }