public static void registerClient(SVNClientImpl client) { synchronized (SVNClientImplTracker.class) { if (ourQueue == null) { ourQueue = new ReferenceQueue(); Thread th = new Thread(new SVNClientImplTracker()); th.setDaemon(true); th.start(); } } synchronized (ourReferences) { SVNClientImpl oldClient = null; for (Iterator refs = ourReferences.keySet().iterator(); refs.hasNext();) { WeakReference reference = (WeakReference) refs.next(); if (reference.get() == Thread.currentThread()) { oldClient = (SVNClientImpl) ourReferences.get(reference); if (oldClient != null) { oldClient.dispose(); } refs.remove(); } } WeakReference ref = new WeakReference(Thread.currentThread(), ourQueue); oldClient = (SVNClientImpl) ourReferences.put(ref, client); if (oldClient != null) { oldClient.dispose(); } } }
public static void registerClient(SVNClientImpl client) { synchronized (SVNClientImplTracker.class) { if (ourQueue == null) { ourQueue = new ReferenceQueue(); Thread th = new Thread(new SVNClientImplTracker()); th.setDaemon(true); th.start(); } } synchronized (ourReferences) { SVNClientImpl oldClient = null; for (Iterator refs = ourReferences.keySet().iterator(); refs.hasNext();) { WeakReference reference = (WeakReference) refs.next(); if (reference.get() == Thread.currentThread()) { oldClient = (SVNClientImpl) ourReferences.get(reference); if (oldClient != null) { oldClient.dispose(); } refs.remove(); } } WeakReference ref = new WeakReference(Thread.currentThread(), ourQueue); oldClient = (SVNClientImpl) ourReferences.put(ref, client); if (oldClient != null) { oldClient.dispose(); } } }
public static void registerClient(SVNClientImpl client) { synchronized (SVNClientImplTracker.class) { if (ourQueue == null) { ourQueue = new ReferenceQueue(); Thread th = new Thread(new SVNClientImplTracker()); th.setDaemon(true); th.start(); } } synchronized (ourReferences) { SVNClientImpl oldClient = null; for (Iterator refs = ourReferences.keySet().iterator(); refs.hasNext();) { WeakReference reference = (WeakReference) refs.next(); if (reference.get() == Thread.currentThread()) { oldClient = (SVNClientImpl) ourReferences.get(reference); if (oldClient != null) { oldClient.dispose(); } refs.remove(); } } WeakReference ref = new WeakReference(Thread.currentThread(), ourQueue); oldClient = (SVNClientImpl) ourReferences.put(ref, client); if (oldClient != null) { oldClient.dispose(); } } }