support connection stats since FastDFS Server v5.04

dev
Yu Qing 2014-12-07 14:01:57 +08:00
parent 2b7b8a6a7e
commit 1ce334de08
4 changed files with 41 additions and 3 deletions

View File

@ -0,0 +1,3 @@
FastDFS java client SDK

View File

@ -62,6 +62,11 @@ public abstract class StructBase
return (int)ProtoCommon.buff2long(bs, offset + filedInfo.offset);
}
protected int int32Value(byte[] bs, int offset, FieldInfo filedInfo)
{
return ProtoCommon.buff2int(bs, offset + filedInfo.offset);
}
protected byte byteValue(byte[] bs, int offset, FieldInfo filedInfo)
{
return bs[offset + filedInfo.offset];

View File

@ -872,6 +872,33 @@ public class StructStorageStat extends StructBase
return this.ifTrunkServer;
}
/**
* get connection alloc count
* @return connection alloc count
*/
public int getConnectionAllocCount()
{
return this.connectionAllocCount;
}
/**
* get connection current count
* @return connection current count
*/
public int getConnectionCurrentCount()
{
return this.connectionCurrentCount;
}
/**
* get connection max count
* @return connection max count
*/
public int getConnectionMaxCount()
{
return this.connectionMaxCount;
}
/**
* set fields
* @param bs byte array
@ -896,9 +923,9 @@ public class StructStorageStat extends StructBase
this.storageHttpPort = intValue(bs, offset, fieldsArray[FIELD_INDEX_STORAGE_HTTP_PORT]);
this.currentWritePath = intValue(bs, offset, fieldsArray[FIELD_INDEX_CURRENT_WRITE_PATH]);
this.connectionAllocCount = intValue(bs, offset, fieldsArray[FIELD_INDEX_CONNECTION_ALLOC_COUNT]);
this.connectionCurrentCount = intValue(bs, offset, fieldsArray[FIELD_INDEX_CONNECTION_CURRENT_COUNT]);
this.connectionMaxCount = intValue(bs, offset, fieldsArray[FIELD_INDEX_CONNECTION_MAX_COUNT]);
this.connectionAllocCount = int32Value(bs, offset, fieldsArray[FIELD_INDEX_CONNECTION_ALLOC_COUNT]);
this.connectionCurrentCount = int32Value(bs, offset, fieldsArray[FIELD_INDEX_CONNECTION_CURRENT_COUNT]);
this.connectionMaxCount = int32Value(bs, offset, fieldsArray[FIELD_INDEX_CONNECTION_MAX_COUNT]);
this.totalUploadCount = longValue(bs, offset, fieldsArray[FIELD_INDEX_TOTAL_UPLOAD_COUNT]);
this.successUploadCount = longValue(bs, offset, fieldsArray[FIELD_INDEX_SUCCESS_UPLOAD_COUNT]);

View File

@ -118,6 +118,9 @@ public class Monitor
System.out.println("\t\tcurrent_write_path = " + storageStat.getCurrentWritePath());
System.out.println("\t\tsource ip_addr = " + storageStat.getSrcIpAddr());
System.out.println("\t\tif_trunk_server = " + storageStat.isTrunkServer());
System.out.println("\t\tconntion.alloc_count = " + storageStat.getConnectionAllocCount());
System.out.println("\t\tconntion.current_count = " + storageStat.getConnectionCurrentCount());
System.out.println("\t\tconntion.max_count = " + storageStat.getConnectionMaxCount());
System.out.println("\t\ttotal_upload_count = " + storageStat.getTotalUploadCount());
System.out.println("\t\tsuccess_upload_count = " + storageStat.getSuccessUploadCount());
System.out.println("\t\ttotal_append_count = " + storageStat.getTotalAppendCount());