📄 statswriterperiodicimpl.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: StatsWriterPeriodicImpl.java
package org.gudy.azureus2.core3.stats.impl;
import com.aelitis.azureus.core.AzureusCore;
import java.io.File;
import org.gudy.azureus2.core3.config.COConfigurationListener;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.logging.*;
import org.gudy.azureus2.core3.stats.StatsWriterPeriodic;
import org.gudy.azureus2.core3.util.*;
// Referenced classes of package org.gudy.azureus2.core3.stats.impl:
// StatsWriterImpl
public class StatsWriterPeriodicImpl
implements StatsWriterPeriodic, COConfigurationListener
{
private static final LogIDs LOGID;
private static StatsWriterPeriodicImpl singleton;
private static AEMonitor class_mon = new AEMonitor("StatsWriterPeriodic");
private static int start_count;
private static Thread current_thread;
private long last_write_time;
private AzureusCore core;
private boolean config_enabled;
private int config_period;
private String config_dir;
private String config_file;
public static StatsWriterPeriodic create(AzureusCore _core)
{
StatsWriterPeriodicImpl statswriterperiodicimpl;
class_mon.enter();
if (singleton == null)
singleton = new StatsWriterPeriodicImpl(_core);
statswriterperiodicimpl = singleton;
class_mon.exit();
return statswriterperiodicimpl;
Exception exception;
exception;
class_mon.exit();
throw exception;
}
protected StatsWriterPeriodicImpl(AzureusCore _core)
{
last_write_time = 0L;
core = _core;
COConfigurationManager.addListener(this);
}
protected void update()
{
readConfigValues();
_L2:
class_mon.enter();
if (Thread.currentThread() != current_thread)
{
class_mon.exit();
break; /* Loop/switch isn't completed */
}
writeStats();
class_mon.exit();
break MISSING_BLOCK_LABEL_64;
Throwable e;
e;
Debug.printStackTrace(e);
class_mon.exit();
break MISSING_BLOCK_LABEL_64;
Exception exception;
exception;
class_mon.exit();
throw exception;
try
{
int period;
if (!config_enabled)
period = 30000;
else
period = config_period * 1000;
if (period > 30000)
period = 30000;
Thread.sleep(period);
}
// Misplaced declaration of an exception variable
catch (int period)
{
Debug.printStackTrace(period);
}
if (true) goto _L2; else goto _L1
_L1:
}
protected void readConfigValues()
{
config_enabled = COConfigurationManager.getBooleanParameter("Stats Enable");
config_period = COConfigurationManager.getIntParameter("Stats Period");
config_dir = COConfigurationManager.getStringParameter("Stats Dir");
config_file = COConfigurationManager.getStringParameter("Stats File");
}
protected void writeStats()
{
if (!config_enabled)
return;
int period = config_period;
long now = SystemTime.getCurrentTime() / 1000L;
if (now < last_write_time)
last_write_time = now;
if (now - last_write_time < (long)(period - 1))
return;
last_write_time = now;
try
{
String dir = config_dir;
dir = dir.trim();
if (dir.length() == 0)
dir = File.separator;
String file_name = dir;
if (!file_name.endsWith(File.separator))
file_name = (new StringBuilder()).append(file_name).append(File.separator).toString();
String file = config_file;
if (file.trim().length() == 0)
file = "Azureus_Stats.xml";
file_name = (new StringBuilder()).append(file_name).append(file).toString();
if (Logger.isEnabled())
Logger.log(new LogEvent(LOGID, (new StringBuilder()).append("Stats Logged to '").append(file_name).append("'").toString()));
(new StatsWriterImpl(core)).write(file_name);
}
catch (Throwable e)
{
Logger.log(new LogEvent(LOGID, "Stats Logging fails", e));
}
}
public void configurationSaved()
{
readConfigValues();
writeStats();
}
public void start()
{
class_mon.enter();
start_count++;
if (start_count == 1)
{
current_thread = new AEThread("StatsWriter") {
final StatsWriterPeriodicImpl this$0;
public void runSupport()
{
update();
}
{
this$0 = StatsWriterPeriodicImpl.this;
super(x0);
}
};
current_thread.setDaemon(true);
current_thread.start();
}
class_mon.exit();
break MISSING_BLOCK_LABEL_65;
Exception exception;
exception;
class_mon.exit();
throw exception;
}
public void stop()
{
class_mon.enter();
start_count--;
if (start_count == 0)
current_thread = null;
class_mon.exit();
break MISSING_BLOCK_LABEL_42;
Exception exception;
exception;
class_mon.exit();
throw exception;
}
static
{
LOGID = LogIDs.CORE;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -