⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 diskmanagerrecheckscheduler.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   DiskManagerRecheckScheduler.java

package org.gudy.azureus2.core3.disk.impl;

import java.util.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.config.ParameterListener;
import org.gudy.azureus2.core3.torrent.TOTorrent;
import org.gudy.azureus2.core3.util.AEMonitor;
import org.gudy.azureus2.core3.util.RealTimeInfo;

// Referenced classes of package org.gudy.azureus2.core3.disk.impl:
//			DiskManagerHelper, DiskManagerRecheckInstance

public class DiskManagerRecheckScheduler
{

	private static boolean friendly_hashing;
	private static boolean smallest_first;
	private List instances;
	private AEMonitor instance_mon;

	public DiskManagerRecheckScheduler()
	{
		instances = new ArrayList();
		instance_mon = new AEMonitor("DiskManagerRecheckScheduler");
	}

	public DiskManagerRecheckInstance register(DiskManagerHelper helper, boolean low_priority)
	{
		DiskManagerRecheckInstance diskmanagerrecheckinstance;
		instance_mon.enter();
		DiskManagerRecheckInstance res = new DiskManagerRecheckInstance(this, helper.getTorrent().getSize(), (int)helper.getTorrent().getPieceLength(), low_priority);
		instances.add(res);
		if (smallest_first)
			Collections.sort(instances, new Comparator() {

				final DiskManagerRecheckScheduler this$0;

				public int compare(Object o1, Object o2)
				{
					long comp = ((DiskManagerRecheckInstance)o1).getMetric() - ((DiskManagerRecheckInstance)o2).getMetric();
					if (comp < 0L)
						return -1;
					return comp != 0L ? 1 : 0;
				}

			
			{
				this$0 = DiskManagerRecheckScheduler.this;
				super();
			}
			});
		diskmanagerrecheckinstance = res;
		instance_mon.exit();
		return diskmanagerrecheckinstance;
		Exception exception;
		exception;
		instance_mon.exit();
		throw exception;
	}

	protected boolean getPermission(DiskManagerRecheckInstance instance)
	{
		boolean result;
		int delay;
		result = false;
		delay = 250;
		instance_mon.enter();
		if (instances.get(0) == instance)
		{
			boolean low_priority = instance.isLowPriority();
			if (low_priority && RealTimeInfo.isRealTimeTaskActive())
			{
				result = false;
			} else
			{
				if (friendly_hashing)
					delay = 0;
				else
				if (!low_priority)
				{
					delay = 1;
				} else
				{
					delay = instance.getPieceLength() / 1024 / 10;
					delay = Math.min(delay, 409);
					delay = Math.max(delay, 12);
				}
				result = true;
			}
		}
		instance_mon.exit();
		break MISSING_BLOCK_LABEL_121;
		Exception exception;
		exception;
		instance_mon.exit();
		throw exception;
		if (delay > 0)
			try
			{
				Thread.sleep(delay);
			}
			catch (Throwable e) { }
		return result;
	}

	protected void unregister(DiskManagerRecheckInstance instance)
	{
		instance_mon.enter();
		instances.remove(instance);
		instance_mon.exit();
		break MISSING_BLOCK_LABEL_38;
		Exception exception;
		exception;
		instance_mon.exit();
		throw exception;
	}

	static 
	{
		ParameterListener param_listener = new ParameterListener() {

			public void parameterChanged(String str)
			{
				DiskManagerRecheckScheduler.friendly_hashing = COConfigurationManager.getBooleanParameter("diskmanager.friendly.hashchecking");
				DiskManagerRecheckScheduler.smallest_first = COConfigurationManager.getBooleanParameter("diskmanager.hashchecking.smallestfirst");
			}

		};
		COConfigurationManager.addAndFireParameterListeners(new String[] {
			"diskmanager.friendly.hashchecking", "diskmanager.hashchecking.smallestfirst"
		}, param_listener);
	}


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -