📄 mmaxaccessstatus.java
字号:
package net.jumperz.app.MGuardian.console;
import net.jumperz.util.*;
import java.awt.Color;
import java.util.*;
import net.jumperz.app.MGuardian.*;
public final class MMaxAccessStatus
extends MAbstractStatus
implements MObserver2
{
int max = 0;
Map ipCountMap = new HashMap();
//--------------------------------------------------------------------------------
public void update( Object eventName, Object source )
{
if( eventName.equals( "getAccessLog" ) )
{
String clientRemoteAddr = ( ( MSession )source ).getClientRemoteAddr();
MCount count;
synchronized( ipCountMap )
{
count = ( MCount )ipCountMap.get( clientRemoteAddr );
}
if( count == null )
{
synchronized( ipCountMap )
{
ipCountMap.put( clientRemoteAddr, new MCount() );
}
}
else
{
count.inc();
int countInt = count.getValue();
if( countInt > max )
{
max = countInt;
}
}
}
}
//--------------------------------------------------------------------------------
public String getStatusName()
{
return "maxAccess";
}
//--------------------------------------------------------------------------------
public String getStatusValue()
{
synchronized( ipCountMap )
{
ipCountMap.clear();
}
String value = Integer.toString( max );
max = 0;
return value;
}
//--------------------------------------------------------------------------------
public String getTitle()
{
return "Max Access";
}
//--------------------------------------------------------------------------------
public Color getAreaColor()
{
return new Color( 0x94, 0x8C, 0xB5 );
}
//--------------------------------------------------------------------------------
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -