📄 iptohostnameresolver.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: IPToHostNameResolver.java
package org.gudy.azureus2.core3.util;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
// Referenced classes of package org.gudy.azureus2.core3.util:
// AEMonitor, AESemaphore, AEThread2, IPToHostNameResolverRequest,
// IPToHostNameResolverListener, Debug
public class IPToHostNameResolver
{
protected static AEThread2 resolver_thread;
protected static List request_queue = new ArrayList();
protected static AEMonitor request_mon = new AEMonitor("IPToHostNameResolver");
protected static AESemaphore request_semaphore = new AESemaphore("IPToHostNameResolver");
public IPToHostNameResolver()
{
}
public static IPToHostNameResolverRequest addResolverRequest(String ip, IPToHostNameResolverListener l)
{
IPToHostNameResolverRequest iptohostnameresolverrequest;
request_mon.enter();
IPToHostNameResolverRequest request = new IPToHostNameResolverRequest(ip, l);
request_queue.add(request);
request_semaphore.release();
if (resolver_thread == null)
{
resolver_thread = new AEThread2("IPToHostNameResolver", true) {
public void run()
{
_L2:
IPToHostNameResolver.request_semaphore.reserve(30000L);
IPToHostNameResolver.request_mon.enter();
if (!IPToHostNameResolver.request_queue.isEmpty())
break MISSING_BLOCK_LABEL_40;
IPToHostNameResolver.resolver_thread = null;
IPToHostNameResolver.request_mon.exit();
break; /* Loop/switch isn't completed */
IPToHostNameResolverRequest req = (IPToHostNameResolverRequest)IPToHostNameResolver.request_queue.remove(0);
IPToHostNameResolver.request_mon.exit();
break MISSING_BLOCK_LABEL_71;
Exception exception1;
exception1;
IPToHostNameResolver.request_mon.exit();
throw exception1;
IPToHostNameResolverListener listener = req.getListener();
if (listener != null)
try
{
InetAddress addr = InetAddress.getByName(req.getIP());
req.getListener().IPResolutionComplete(addr.getHostName(), true);
}
catch (Throwable e)
{
req.getListener().IPResolutionComplete(req.getIP(), false);
}
continue; /* Loop/switch isn't completed */
Throwable e;
e;
Debug.printStackTrace(e);
if (true) goto _L2; else goto _L1
_L1:
}
};
resolver_thread.start();
}
iptohostnameresolverrequest = request;
request_mon.exit();
return iptohostnameresolverrequest;
Exception exception;
exception;
request_mon.exit();
throw exception;
}
public static String syncResolve(String ip, int timeout)
throws Exception
{
Object result[];
AESemaphore sem = new AESemaphore("IPToHostNameREsolver:sync");
result = (new Object[] {
null
});
addResolverRequest(ip, new IPToHostNameResolverListener(result, sem) {
final Object val$result[];
final AESemaphore val$sem;
public void IPResolutionComplete(String resolved_ip, boolean succeeded)
{
synchronized (result)
{
if (succeeded)
result[0] = resolved_ip;
}
sem.release();
break MISSING_BLOCK_LABEL_52;
Exception exception2;
exception2;
sem.release();
throw exception2;
}
{
result = aobj;
sem = aesemaphore;
super();
}
});
if (!sem.reserve(timeout))
throw new Exception("Timeout");
Object aobj[] = result;
JVM INSTR monitorenter ;
if (result[0] != null)
return (String)result[0];
else
throw new UnknownHostException(ip);
Exception exception;
exception;
throw exception;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -