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

📄 uttimerimpl.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:   UTTimerImpl.java

package org.gudy.azureus2.pluginsimpl.local.utils;

import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.plugins.PluginInterface;
import org.gudy.azureus2.plugins.utils.*;

// Referenced classes of package org.gudy.azureus2.pluginsimpl.local.utils:
//			UtilitiesImpl

public class UTTimerImpl
	implements UTTimer
{
	protected class timerEvent
		implements UTTimerEvent
	{

		protected TimerEvent ev;
		protected TimerEventPeriodic pev;
		final UTTimerImpl this$0;

		protected void setEvent(TimerEventPeriodic _ev)
		{
			pev = _ev;
		}

		protected void setEvent(TimerEvent _ev)
		{
			ev = _ev;
		}

		protected void perform(UTTimerEventPerformer p)
		{
			p.perform(this);
		}

		public void cancel()
		{
			if (ev != null)
				ev.cancel();
			else
				pev.cancel();
		}

		protected timerEvent()
		{
			this$0 = UTTimerImpl.this;
			super();
		}
	}


	private PluginInterface plugin_interface;
	private Timer timer;
	private boolean destroyed;

	public UTTimerImpl(String name, boolean lightweight)
	{
		if (!lightweight)
			timer = new Timer(name);
	}

	protected UTTimerImpl(PluginInterface pi, String name, boolean lightweight)
	{
		plugin_interface = pi;
		if (!lightweight)
			timer = new Timer((new StringBuilder()).append("Plugin ").append(pi.getPluginID()).append(":").append(name).toString());
	}

	protected UTTimerImpl(PluginInterface pi, String name, int priority)
	{
		plugin_interface = pi;
		timer = new Timer((new StringBuilder()).append("Plugin ").append(pi.getPluginID()).append(":").append(name).toString(), 1, priority);
	}

	public UTTimerEvent addEvent(long when, final UTTimerEventPerformer ext_performer)
	{
		if (destroyed)
			throw new RuntimeException("Timer has been destroyed");
		final timerEvent res = new timerEvent();
		TimerEventPerformer performer = new TimerEventPerformer() {

			final timerEvent val$res;
			final UTTimerEventPerformer val$ext_performer;
			final UTTimerImpl this$0;

			public void perform(TimerEvent ev)
			{
				UtilitiesImpl.callWithPluginThreadContext(plugin_interface, new Runnable() {

					final 1 this$1;

					public void run()
					{
						res.perform(ext_performer);
					}

					
					{
						this$1 = 1.this;
						super();
					}
				});
			}

			
			{
				this$0 = UTTimerImpl.this;
				res = timerevent;
				ext_performer = uttimereventperformer;
				super();
			}
		};
		if (timer == null)
			res.setEvent(SimpleTimer.addEvent((new StringBuilder()).append("Plugin:").append(ext_performer.getClass()).toString(), when, performer));
		else
			res.setEvent(timer.addEvent((new StringBuilder()).append("Plugin:").append(ext_performer.getClass()).toString(), when, performer));
		return res;
	}

	public UTTimerEvent addPeriodicEvent(long periodic_millis, final UTTimerEventPerformer ext_performer)
	{
		if (destroyed)
			throw new RuntimeException("Timer has been destroyed");
		final timerEvent res = new timerEvent();
		TimerEventPerformer performer = new TimerEventPerformer() {

			final timerEvent val$res;
			final UTTimerEventPerformer val$ext_performer;
			final UTTimerImpl this$0;

			public void perform(TimerEvent ev)
			{
				UtilitiesImpl.callWithPluginThreadContext(plugin_interface, new Runnable() {

					final 2 this$1;

					public void run()
					{
						try
						{
							res.perform(ext_performer);
						}
						catch (Throwable e)
						{
							Debug.out((new StringBuilder()).append("Plugin '").append(plugin_interface.getPluginName()).append(" (").append(plugin_interface.getPluginID()).append(" ").append(plugin_interface.getPluginVersion()).append(") caused an error while processing a timer event").toString(), e);
						}
					}

					
					{
						this$1 = 2.this;
						super();
					}
				});
			}

			
			{
				this$0 = UTTimerImpl.this;
				res = timerevent;
				ext_performer = uttimereventperformer;
				super();
			}
		};
		if (timer == null)
			res.setEvent(SimpleTimer.addPeriodicEvent((new StringBuilder()).append("Plugin:").append(ext_performer.getClass()).toString(), periodic_millis, performer));
		else
			res.setEvent(timer.addPeriodicEvent((new StringBuilder()).append("Plugin:").append(ext_performer.getClass()).toString(), periodic_millis, performer));
		return res;
	}

	public void destroy()
	{
		destroyed = true;
		if (timer != null)
			timer.destroy();
	}

}

⌨️ 快捷键说明

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