📄 utilitiesimpl.java
字号:
Exception exception;
exception;
services[i].removeListener(listener);
throw exception;
_L5:
if (ip[0] != null)
{
res = InetAddress.getByName(ip[0]);
break; /* Loop/switch isn't completed */
}
i++;
if (true) goto _L6; else goto _L3
Throwable e;
e;
Debug.printStackTrace(e);
_L3:
if (res == null)
{
res = last_public_ip_address;
} else
{
last_public_ip_address = res;
last_public_ip_address_time = now;
}
return res;
}
public String reverseDNSLookup(InetAddress address)
{
final AESemaphore sem = new AESemaphore("Utilities:reverseDNS");
final String res[] = {
null
};
IPToHostNameResolver.addResolverRequest(address.getHostAddress(), new IPToHostNameResolverListener() {
final String val$res[];
final AESemaphore val$sem;
final UtilitiesImpl this$0;
public void IPResolutionComplete(String result, boolean succeeded)
{
if (succeeded)
res[0] = result;
sem.release();
}
{
this$0 = UtilitiesImpl.this;
res = as;
sem = aesemaphore;
super();
}
});
sem.reserve(60000L);
return res[0];
}
public long getCurrentSystemTime()
{
return SystemTime.getCurrentTime();
}
public ByteArrayWrapper createWrapper(byte data[])
{
return new HashWrapper(data);
}
public AggregatedDispatcher createAggregatedDispatcher(final long idle_dispatch_time, final long max_queue_size)
{
return new AggregatedDispatcher() {
private AggregatedList list;
final long val$idle_dispatch_time;
final long val$max_queue_size;
final UtilitiesImpl this$0;
public void add(Runnable runnable)
{
list.add(runnable);
}
public Runnable remove(Runnable runnable)
{
return (Runnable)list.remove(runnable);
}
public void destroy()
{
list.destroy();
}
{
this$0 = UtilitiesImpl.this;
idle_dispatch_time = l;
max_queue_size = l1;
super();
list = createAggregatedList(new AggregatedListAcceptor() {
final 5 this$1;
public void accept(List l)
{
for (int i = 0; i < l.size(); i++)
try
{
((Runnable)l.get(i)).run();
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
{
this$1 = 5.this;
super();
}
}, idle_dispatch_time, max_queue_size);
}
};
}
public AggregatedList createAggregatedList(final AggregatedListAcceptor acceptor, final long idle_dispatch_time, final long max_queue_size)
{
return new AggregatedList() {
AEMonitor timer_mon;
Timer timer;
TimerEvent event;
List list;
final long val$max_queue_size;
final long val$idle_dispatch_time;
final AggregatedListAcceptor val$acceptor;
final UtilitiesImpl this$0;
public void add(Object obj)
{
List dispatch_now = null;
timer_mon.enter();
if (max_queue_size > 0L && max_queue_size == (long)list.size())
{
dispatch_now = list;
list = new ArrayList();
}
list.add(obj);
long now = SystemTime.getCurrentTime();
if (event != null)
event.cancel();
event = timer.addEvent(now + idle_dispatch_time, new TimerEventPerformer() {
final 6 this$1;
public void perform(TimerEvent event)
{
dispatch();
}
{
this$1 = 6.this;
super();
}
});
timer_mon.exit();
break MISSING_BLOCK_LABEL_128;
Exception exception;
exception;
timer_mon.exit();
throw exception;
if (dispatch_now != null)
dispatch(dispatch_now);
return;
}
public Object remove(Object obj)
{
Object res = null;
timer_mon.enter();
res = list.remove(obj) ? obj : null;
if (res != null)
{
long now = SystemTime.getCurrentTime();
if (event != null)
event.cancel();
if (list.size() == 0)
event = null;
else
event = timer.addEvent(now + idle_dispatch_time, new TimerEventPerformer() {
final 6 this$1;
public void perform(TimerEvent event)
{
dispatch();
}
{
this$1 = 6.this;
super();
}
});
}
timer_mon.exit();
break MISSING_BLOCK_LABEL_117;
Exception exception;
exception;
timer_mon.exit();
throw exception;
return res;
}
protected void dispatch()
{
List dispatch_list;
timer_mon.enter();
dispatch_list = list;
list = new ArrayList();
timer_mon.exit();
break MISSING_BLOCK_LABEL_43;
Exception exception;
exception;
timer_mon.exit();
throw exception;
dispatch(dispatch_list);
return;
}
protected void dispatch(List l)
{
if (l.size() > 0)
try
{
acceptor.accept(l);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
public void destroy()
{
dispatch();
timer.destroy();
}
{
this$0 = UtilitiesImpl.this;
max_queue_size = l;
idle_dispatch_time = l1;
acceptor = aggregatedlistacceptor;
super();
timer_mon = new AEMonitor("aggregatedList");
timer = new Timer("AggregatedList");
list = new ArrayList();
}
};
}
public static final void callWithPluginThreadContext(PluginInterface pi, Runnable target)
{
PluginInterface existing = (PluginInterface)tls.get();
tls.set(pi);
target.run();
tls.set(existing);
break MISSING_BLOCK_LABEL_43;
Exception exception;
exception;
tls.set(existing);
throw exception;
}
public static final void callWithPluginThreadContext(PluginInterface pi, runnableWithException target)
throws Exception
{
PluginInterface existing = (PluginInterface)tls.get();
tls.set(pi);
target.run();
tls.set(existing);
break MISSING_BLOCK_LABEL_43;
Exception exception;
exception;
tls.set(existing);
throw exception;
}
public static final Object callWithPluginThreadContext(PluginInterface pi, runnableWithReturn target)
{
PluginInterface existing = (PluginInterface)tls.get();
Object obj;
tls.set(pi);
obj = target.run();
tls.set(existing);
return obj;
Exception exception;
exception;
tls.set(existing);
throw exception;
}
public static final Object callWithPluginThreadContext(PluginInterface pi, runnableWithReturnAndException target)
throws Exception
{
PluginInterface existing = (PluginInterface)tls.get();
Object obj;
tls.set(pi);
obj = target.run();
tls.set(existing);
return obj;
Exception exception;
exception;
tls.set(existing);
throw exception;
}
public static PluginInterface getPluginThreadContext()
{
return (PluginInterface)tls.get();
}
public Map readResilientBEncodedFile(File parent_dir, String file_name, boolean use_backup)
{
return FileUtil.readResilientFile(parent_dir, file_name, use_backup);
}
public void writeResilientBEncodedFile(File parent_dir, String file_name, Map data, boolean use_backup)
{
FileUtil.writeResilientFile(parent_dir, file_name, data, use_backup);
}
public int compareVersions(String v1, String v2)
{
return Constants.compareVersions(v1, v2);
}
public String normaliseFileName(String f_name)
{
return FileUtil.convertOSSpecificChars(f_name, false);
}
public DelayedTask createDelayedTask(Runnable target)
{
return addDelayedTask(pi.getPluginName(), target);
}
public static DelayedTask addDelayedTask(String name, Runnable r)
{
DelayedTaskImpl res = new DelayedTaskImpl(name);
res.setTask(r);
return res;
}
private static void queueTask(DelayedTaskImpl task)
{
synchronized (delayed_tasks)
{
delayed_tasks.add(task);
delayed_tasks_sem.release();
if (delayed_task_thread == null)
{
delayed_task_thread = new AEThread2("Utilities:delayedTask", true) {
public void run()
{
PluginInitializer.addInitThread();
break MISSING_BLOCK_LABEL_3;
list1;
JVM INSTR monitorexit ;
continue;
label0:
do
{
if (!UtilitiesImpl.delayed_tasks_sem.reserve(5000L))
{
label1:
{
synchronized (UtilitiesImpl.delayed_tasks)
{
if (!UtilitiesImpl.delayed_tasks.isEmpty())
break label1;
UtilitiesImpl.delayed_task_thread = null;
}
break label0;
}
}
DelayedTaskImpl task;
synchronized (UtilitiesImpl.delayed_tasks)
{
task = (DelayedTaskImpl)UtilitiesImpl.delayed_tasks.remove(0);
}
task.run();
} while (true);
PluginInitializer.removeInitThread();
break MISSING_BLOCK_LABEL_105;
Exception exception3;
exception3;
PluginInitializer.removeInitThread();
throw exception3;
}
};
delayed_task_thread.setPriority(1);
delayed_task_thread.start();
}
}
}
public void registerSearchProvider(SearchProvider provider)
throws SearchException
{
List managers;
synchronized (org/gudy/azureus2/pluginsimpl/local/utils/UtilitiesImpl)
{
search_providers.add(((Object) (new Object[] {
pi, provider
})));
managers = new ArrayList(search_managers);
}
for (int i = 0; i < managers.size(); i++)
((searchManager)managers.get(i)).addProvider(pi, provider);
}
public static void addSearchManager(searchManager manager)
{
List providers;
synchronized (org/gudy/azureus2/pluginsimpl/local/utils/UtilitiesImpl)
{
search_managers.add(manager);
providers = new ArrayList(search_providers);
}
for (int i = 0; i < providers.size(); i++)
{
Object entry[] = (Object[])(Object[])providers.get(i);
manager.addProvider((PluginInterface)entry[0], (SearchProvider)entry[1]);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -