public override Object Clone() { // Since we are a derived class use the base's Clone() // to perform the shallow copy. Since it is shallow it // will include our derived class. Since we are derived, // this method is an override. ActiveMQTempDestination o = (ActiveMQTempDestination)base.Clone(); // Now do the deep work required // If any new variables are added then this routine will // likely need updating return(o); }
internal bool IsInUse(ActiveMQTempDestination dest) { lock(this.consumers.SyncRoot) { foreach(MessageConsumer consumer in this.consumers.Values) { if(consumer.IsInUse(dest)) { return true; } } } return false; }
internal bool IsInUse(ActiveMQTempDestination dest) { return this.info.Destination.Equals(dest); }
public void Close() { if(!this.closed.Value && !transportFailed.Value) { this.Stop(); } lock(myLock) { if(this.closed.Value) { return; } try { Tracer.InfoFormat("Connection[{0}]: Closing Connection Now.", this.ConnectionId); this.closing.Value = true; if(this.advisoryConsumer != null) { this.advisoryConsumer.Dispose(); this.advisoryConsumer = null; } lock(sessions.SyncRoot) { foreach(Session session in sessions) { session.Shutdown(); } } sessions.Clear(); if(this.tempDests.Count > 0) { // Make a copy of the destinations to delete, because the act of deleting // them will modify the collection. ActiveMQTempDestination[] tempDestsToDelete = new ActiveMQTempDestination[this.tempDests.Count]; this.tempDests.Values.CopyTo(tempDestsToDelete, 0); foreach(ActiveMQTempDestination dest in tempDestsToDelete) { dest.Delete(); } } // Connected is true only when we've successfully sent our ConnectionInfo // to the broker, so if we haven't announced ourselves there's no need to // inform the broker of a remove, and if the transport is failed, why bother. if(connected.Value && !transportFailed.Value) { DisposeOf(ConnectionId); ShutdownInfo shutdowninfo = new ShutdownInfo(); transport.Oneway(shutdowninfo); } executor.Shutdown(); Tracer.DebugFormat("Connection[{0}]: Disposing of the Transport.", this.ConnectionId); transport.Dispose(); } catch(Exception ex) { Tracer.ErrorFormat("Connection[{0}]: Error during connection close: {1}", ConnectionId, ex); } finally { if(executor != null) { executor.Shutdown(); } this.transport = null; this.closed.Value = true; this.connected.Value = false; this.closing.Value = false; } } }
internal bool IsTempDestinationActive(ActiveMQTempDestination dest) { if(this.advisoryConsumer == null) { return true; } return this.tempDests.Contains(dest); }
internal void RemoveTempDestination(ActiveMQTempDestination dest) { this.tempDests.Remove(dest); }
internal ActiveMQTempDestination AddTempDestination(ActiveMQTempDestination dest) { ActiveMQTempDestination addedDest = dest; // .NET lacks a putIfAbsent operation for Maps. lock(tempDests.SyncRoot) { if(!this.tempDests.Contains(dest)) { this.tempDests.Add(dest, dest); } else { addedDest = this.tempDests[dest] as ActiveMQTempDestination; } } return addedDest; }