Exemplo n.º 1
0
  @Override
  public V put(final K key, final V value) {
    final Entry<K, V>[] table = this.table;
    final int hash = key.hashCode();
    final int index = HashUtil.indexFor(hash, table.length, shift, mask);

    for (Entry<K, V> e = table[index]; e != null; e = e.hashNext) {
      final K entryKey;
      if (e.keyHash == hash && ((entryKey = e.key) == key || entryKey.equals(key))) {
        moveToTop(e);
        return e.setValue(value);
      }
    }

    final Entry<K, V> e = new Entry<K, V>(key, value);
    e.hashNext = table[index];
    table[index] = e;
    final Entry<K, V> top = this.top;
    e.next = top;
    if (top != null) {
      top.previous = e;
    } else {
      back = e;
    }
    this.top = e;
    size = size + 1;

    if (removeEldestEntry(back)) {
      remove(back.key);
    } else if (size > capacity) {
      rehash(HashUtil.nextCapacity(capacity));
    }
    return null;
  }
 public String hash(Map<String, ?> map) {
   MessageDigest digest = HashUtil.createDigester();
   List<String> keys = getSortedKeys(map);
   for (String key : keys) {
     Object value = getKeyValue(key, map);
     appendObject(digest, key);
     digest.update("=".getBytes());
     appendObject(digest, value);
     digest.update(",".getBytes());
   }
   return HashUtil.toHexString(digest.digest());
 }
Exemplo n.º 3
0
 private void rehash(int capacity) {
   final int length = HashUtil.adjustTableLength((int) (capacity / loadFactor));
   this.capacity = capacity;
   if (length != table.length) {
     allocateTable(length);
     final Entry<K, V>[] table = this.table;
     final int shift = this.shift;
     final int mask = this.mask;
     for (Entry<K, V> e = back; e != null; e = e.previous) {
       final int index = HashUtil.indexFor(e.keyHash, length, shift, mask);
       e.hashNext = table[index];
       table[index] = e;
     }
   }
 }
Exemplo n.º 4
0
  @Override
  public V remove(final Object key) {
    final Entry<K, V>[] table = this.table;
    final int hash = key.hashCode();
    final int index = HashUtil.indexFor(hash, table.length, shift, mask);
    Entry<K, V> e = table[index];

    if (e == null) return null;

    K entryKey;
    if (e.keyHash == hash && ((entryKey = e.key) == key || entryKey.equals(key))) {
      table[index] = e.hashNext;
    } else {
      for (; ; ) {
        final Entry<K, V> last = e;
        e = e.hashNext;
        if (e == null) return null;
        if (e.keyHash == hash && ((entryKey = e.key) == key || entryKey.equals(key))) {
          last.hashNext = e.hashNext;
          break;
        }
      }
    }
    unlink(e);
    size = size - 1;
    return e.value;
  }
Exemplo n.º 5
0
 private void rehash(int capacity) {
   final int length = HashUtil.getCeilingPrime((int) (capacity / loadFactor));
   this.capacity = capacity;
   if (length != table.length) {
     final Iterator<Map.Entry<Integer, V>> entries = entrySet().iterator();
     allocateTable(length);
     final Entry<V>[] table = this.table;
     final int mask = this.mask;
     while (entries.hasNext()) {
       final Entry<V> e = (Entry<V>) entries.next();
       final int index = HashUtil.indexFor(e.key, length, mask);
       e.hashNext = table[index];
       table[index] = e;
     }
   }
 }
Exemplo n.º 6
0
 private void rehash(int capacity) {
   final int length = HashUtil.getCeilingPrime((int) (capacity / loadFactor));
   this.capacity = capacity;
   if (length != table.length) {
     final Iterator<Entry> entries = new RehashIterator();
     allocateTable(length);
     final Entry[] table = this.table;
     final int shift = this.shift;
     final int mask = this.mask;
     while (entries.hasNext()) {
       final Entry e = entries.next();
       final int index = HashUtil.indexFor(e.key, length, shift, mask);
       e.hashNext = table[index];
       table[index] = e;
     }
   }
 }
Exemplo n.º 7
0
 private void init(int capacity) {
   if (capacity < HashUtil.MIN_CAPACITY) {
     capacity = HashUtil.MIN_CAPACITY;
   }
   allocateTable(HashUtil.getCeilingPrime((int) (capacity / loadFactor)));
   this.capacity = capacity;
   size = 0;
 }
Exemplo n.º 8
0
 private void initialize(int capacity) {
   int size = HashUtil.getPrime(capacity); // TODO--Prime size
   buckets = new int[size];
   for (int i = 0; i < buckets.length; i++) buckets[i] = -1;
   entries = new Entry[size];
   setNullsToDefault(entries);
   freeList = -1;
 }
Exemplo n.º 9
0
  @Test
  public void testCalculatedSha512IsCorrect()
      throws UnsupportedEncodingException, NoSuchAlgorithmException {
    String message = "1337";
    String expectedHash =
        "6f0ac65fe01188660aad900bfe16c566ebf0e56c0a7d4a15bd831049108de80bd3a2fbf1a8b91662433a40458ec208a207cab073f190bd65b889e95e4fca8e09";

    assertEquals(expectedHash, HashUtil.calculateHash(message, HashUtil.SHA512, HashUtil.UTF8));
  }
Exemplo n.º 10
0
 @Override
 protected void init(int capacity) {
   if (capacity < HashUtil.MIN_CAPACITY) {
     capacity = HashUtil.MIN_CAPACITY;
   }
   allocateTable(HashUtil.adjustTableLength((int) (capacity / loadFactor)));
   top = back = null;
   this.capacity = capacity;
   size = 0;
 }
Exemplo n.º 11
0
  public boolean add(final int key) {
    final Entry[] table = this.table;
    final int index = HashUtil.indexFor(key, table.length, shift, mask);

    for (Entry e = table[index]; e != null; e = e.hashNext) {
      if (e.key == key) {
        return false;
      }
    }

    final Entry e = new Entry(key);
    e.hashNext = table[index];
    table[index] = e;
    size += 1;

    if (size > capacity) {
      rehash(HashUtil.nextCapacity(capacity));
    }
    return true;
  }
Exemplo n.º 12
0
  public V put(final int key, final V value) {
    final Entry<V>[] table = this.table;
    final int index = HashUtil.indexFor(key, table.length, mask);

    for (Entry<V> e = table[index]; e != null; e = e.hashNext) {
      if (e.key == key) {
        return e.setValue(value);
      }
    }

    final Entry<V> e = new Entry<>(key, value);
    e.hashNext = table[index];
    table[index] = e;
    size += 1;

    if (size > capacity) {
      rehash(HashUtil.nextCapacity(capacity));
    }
    return null;
  }
Exemplo n.º 13
0
  private Entry<V> getEntry(final int key) {
    final Entry<V>[] table = this.table;
    final int index = HashUtil.indexFor(key, table.length, mask);

    for (Entry<V> e = table[index]; e != null; e = e.hashNext) {
      if (e.key == key) {
        return e;
      }
    }

    return null;
  }
Exemplo n.º 14
0
  public boolean contains(final int key) {
    final Entry[] table = this.table;
    final int index = HashUtil.indexFor(key, table.length, shift, mask);

    for (Entry e = table[index]; e != null; e = e.hashNext) {
      if (e.key == key) {
        return true;
      }
    }

    return false;
  }
Exemplo n.º 15
0
 public synchronized void resetObjInfo() {
   String detected =
       ObjTypeDetector.drivedType != null
           ? ObjTypeDetector.drivedType
           : ObjTypeDetector.objType != null ? ObjTypeDetector.objType : CounterConstants.JAVA;
   this.obj_type = getValue("obj_type", detected);
   detected = CounterConstants.HOST;
   if (SystemUtil.IS_LINUX) {
     detected = CounterConstants.LINUX;
   } else if (SystemUtil.IS_WINDOWS) {
     detected = CounterConstants.WINDOWS;
   } else if (SystemUtil.IS_MAC_OSX) {
     detected = CounterConstants.OSX;
   } else if (SystemUtil.IS_AIX) {
     detected = CounterConstants.AIX;
   } else if (SystemUtil.IS_HP_UX) {
     detected = CounterConstants.HPUX;
   }
   this.obj_host_type = getValue("obj_host_type", detected);
   this.obj_host_name = getValue("obj_host_name", SysJMX.getHostName());
   this.objHostName = "/" + this.obj_host_name;
   this.objHostHash = HashUtil.hash(objHostName);
   this.obj_name_auto_pid_enabled = getBoolean("obj_name_auto_pid_enabled", false);
   String defaultName;
   if (this.obj_name_auto_pid_enabled == true) {
     defaultName = "" + SysJMX.getProcessPID();
   } else {
     defaultName = this.obj_type + "1";
   }
   this.obj_name = getValue("obj_name", System.getProperty("jvmRoute", defaultName));
   this.objName = objHostName + "/" + this.obj_name;
   this.objHash = HashUtil.hash(objName);
   System.setProperty("scouter.objname", this.objName);
   System.setProperty("scouter.objtype", this.obj_type);
   System.setProperty("scouter.dir", new File(".").getAbsolutePath());
 }
Exemplo n.º 16
0
 protected File getDeploymentHashDir(final byte[] deploymentHash, final boolean validate) {
   final String sha1 = HashUtil.bytesToHexString(deploymentHash);
   final String partA = sha1.substring(0, 2);
   final String partB = sha1.substring(2);
   final File base = new File(getRepoRoot(), partA);
   if (validate) {
     validateDir(base);
   }
   final File hashDir = new File(base, partB);
   if (validate && !hashDir.exists() && !hashDir.mkdirs()) {
     throw DeploymentRepositoryMessages.MESSAGES.cannotCreateDirectory(
         hashDir.getAbsolutePath());
   }
   return hashDir;
 }
Exemplo n.º 17
0
  @Override
  protected Map.Entry<K, V> getEntry(Object key) {
    final Entry<K, V>[] table = this.table;
    final int hash = key.hashCode();
    final int index = HashUtil.indexFor(hash, table.length, shift, mask);

    for (Entry<K, V> e = table[index]; e != null; e = e.hashNext) {
      final K entryKey;
      if (e.keyHash == hash && ((entryKey = e.key) == key || entryKey.equals(key))) {
        moveToTop(e);
        return e;
      }
    }

    return null;
  }
Exemplo n.º 18
0
  public V remove(final int key) {
    final Entry<V>[] table = this.table;
    final int index = HashUtil.indexFor(key, table.length, mask);
    Entry<V> e = table[index];

    if (e == null) return null;

    if (e.key == key) {
      table[index] = e.hashNext;
    } else {
      for (; ; ) {
        final Entry<V> last = e;
        e = e.hashNext;
        if (e == null) return null;
        if (e.key == key) {
          last.hashNext = e.hashNext;
          break;
        }
      }
    }
    size -= 1;
    return e.value;
  }
Exemplo n.º 19
0
  public boolean remove(int key) {
    final Entry[] table = this.table;
    final int index = HashUtil.indexFor(key, table.length, shift, mask);
    Entry e = table[index];

    if (e == null) return false;

    if (e.key == key) {
      table[index] = e.hashNext;
    } else {
      for (; ; ) {
        final Entry last = e;
        e = e.hashNext;
        if (e == null) return false;
        if (e.key == key) {
          last.hashNext = e.hashNext;
          break;
        }
      }
    }
    size -= 1;
    return true;
  }
Exemplo n.º 20
0
 public static String hash(String password, String userId) {
   String mix = StringObfustation.mix(password, userId);
   byte[] digest = HashUtil.secureHash(mix);
   return bytesToHex(digest);
 }
Exemplo n.º 21
0
public class Configure extends Thread {
  public static boolean JDBC_REDEFINED = false;
  private static Configure instance = null;

  public static final synchronized Configure getInstance() {
    if (instance == null) {
      instance = new Configure();
      instance.setDaemon(true);
      instance.setName(ThreadUtil.getName(instance));
      instance.start();
    }
    return instance;
  }

  // Network
  public String net_local_udp_ip = null;
  public int net_local_udp_port;
  public String net_collector_ip = "127.0.0.1";
  public int net_collector_udp_port = NetConstants.SERVER_UDP_PORT;
  public int net_collector_tcp_port = NetConstants.SERVER_TCP_PORT;
  public int net_collector_tcp_session_count = 1;
  public int net_collector_tcp_so_timeout_ms = 60000;
  public int net_collector_tcp_connection_timeout_ms = 3000;
  public int net_udp_packet_max_bytes = 60000;
  public long net_udp_collection_interval_ms = 100;

  // Object
  public String obj_type = "";
  public String obj_name = "";
  public String obj_host_type = "";
  public String obj_host_name = "";
  public boolean obj_name_auto_pid_enabled = false;
  public boolean obj_type_inherit_to_child_enabled = false;

  // profile
  public boolean profile_http_querystring_enabled;
  public boolean profile_http_header_enabled;
  public String profile_http_header_url_prefix = "/";
  public boolean profile_http_parameter_enabled;
  public String profile_http_parameter_url_prefix = "/";
  public boolean profile_summary_mode_enabled = false;
  public boolean profile_thread_cputime_enabled = false;
  public boolean profile_socket_open_fullstack_enabled = false;
  public int profile_socket_open_fullstack_port = 0;
  public boolean profile_sqlmap_name_enabled = true;
  public boolean profile_connection_open_enabled = true;
  public boolean profile_connection_open_fullstack_enabled = false;
  public boolean profile_connection_autocommit_status_enabled = false;
  public boolean profile_method_enabled = true;
  public int profile_step_max_count = 1024;
  public boolean profile_fullstack_service_error_enabled = false;
  public boolean profile_fullstack_apicall_error_enabled = false;
  public boolean profile_fullstack_sql_error_enabled = false;
  public boolean profile_fullstack_sql_commit_enabled = false;
  public int profile_fullstack_max_lines = 0;
  public boolean profile_sql_escape_enabled = true;
  public boolean _profile_fullstack_sql_connection_enabled = false;

  // Trace
  public int trace_user_mode = 2; // 0:Remote IP, 1:JSessionID, 2:SetCookie
  public boolean trace_background_socket_enabled = true;
  public String trace_service_name_header_key;
  public String trace_service_name_get_key;
  public String trace_service_name_post_key;
  public long trace_activeserivce_yellow_time = 3000;
  public long trace_activeservice_red_time = 8000;
  public String trace_http_client_ip_header_key = "";
  public boolean trace_interservice_enabled = false;
  public String _trace_interservice_gxid_header_key = "X-Scouter-Gxid";
  public boolean trace_response_gxid_enabled = false;
  public String _trace_interservice_callee_header_key = "X-Scouter-Callee";
  public String _trace_interservice_caller_header_key = "X-Scouter-Caller";
  public String trace_user_session_key = "JSESSIONID";
  public boolean _trace_auto_service_enabled = false;
  public boolean _trace_auto_service_backstack_enabled = true;
  public boolean trace_db2_enabled = true;
  public boolean trace_webserver_enabled = false;
  public String trace_webserver_name_header_key = "X-Forwarded-Host";
  public String trace_webserver_time_header_key = "X-Forwarded-Time";
  public int _trace_fullstack_socket_open_port = 0;

  // Dir
  public File plugin_dir = new File("./plugin");
  public File dump_dir = new File("./dump");
  // public File mgr_agent_lib_dir = new File("./_scouter_");

  // Manager
  public String mgr_static_content_extensions = "js, htm, html, gif, png, jpg, css";
  public String mgr_log_ignore_ids = "";

  // Autodump
  public boolean autodump_enabled = false;
  public int autodump_trigger_active_service_cnt = 10000;
  public long autodump_interval_ms = 30000;
  public int autodump_level = 1; // 1:ThreadDump, 2:ActiveService, 3:ThreadList
  public int autodump_stuck_thread_ms = 0;

  // XLog
  public int xlog_lower_bound_time_ms = 0;
  public int xlog_error_jdbc_fetch_max = 10000;
  public int xlog_error_sql_time_max_ms = 30000;
  public boolean xlog_error_check_user_transaction_enabled = true;

  // Alert
  public int alert_message_length = 3000;
  public long alert_send_interval_ms = 3000;
  public int alert_perm_warning_pct = 90;

  // Log
  public boolean _log_asm_enabled;
  public boolean _log_udp_xlog_enabled;
  public boolean _log_udp_object_enabled;
  public boolean _log_udp_counter_enabled;
  public boolean _log_datasource_lookup_enabled = true;
  public boolean _log_background_sql = false;
  public String log_dir = "";
  public boolean log_rotation_enabled = true;
  public int log_keep_days = 7;
  public boolean _log_trace_enabled = false;
  public boolean _log_trace_use_logger = false;

  // Hook
  public String hook_args_patterns = "";
  public String hook_return_patterns = "";
  public String hook_constructor_patterns = "";
  public String hook_connection_open_patterns = "";
  public String hook_context_classes = "javax/naming/InitialContext";
  public String hook_method_patterns = "";
  public String hook_method_ignore_prefixes = "get,set";
  public String hook_method_ignore_classes = "";
  private StringSet _hook_method_ignore_classes = new StringSet();
  public boolean hook_method_access_public_enabled = true;
  public boolean hook_method_access_private_enabled = false;
  public boolean hook_method_access_protected_enabled = false;
  public boolean hook_method_access_none_enabled = false;
  public String hook_service_patterns = "";
  public String hook_apicall_patterns = "";
  public String hook_apicall_info_patterns = "";
  public String hook_jsp_patterns = "";
  public String hook_jdbc_pstmt_classes = "";
  public String hook_jdbc_stmt_classes = "";
  public String hook_jdbc_rs_classes = "";
  public String hook_jdbc_wrapping_driver_patterns = "";
  public String hook_add_fields = "";
  public boolean _hook_serivce_enabled = true;
  public boolean _hook_dbsql_enabled = true;
  public boolean _hook_dbconn_enabled = true;
  public boolean _hook_cap_enabled = true;
  public boolean _hook_methods_enabled = true;
  public boolean _hook_socket_enabled = true;
  public boolean _hook_jsp_enabled = true;
  public boolean _hook_async_enabled = true;
  public boolean _hook_usertx_enabled = true;
  public String _hook_direct_patch_classes = "";
  public boolean _hook_spring_rest_enabled = false;

  // Control
  public boolean control_reject_service_enabled = false;
  public int control_reject_service_max_count = 10000;
  public boolean control_reject_redirect_url_enabled = false;
  public String control_reject_text = "too many request!!";
  public String control_reject_redirect_url = "/error.html";

  // Counter
  public boolean counter_enabled = true;
  public long counter_recentuser_valid_ms = DateUtil.MILLIS_PER_FIVE_MINUTE;
  public String counter_object_registry_path = "/tmp/scouter";

  // SFA(Stack Frequency Analyzer)
  public boolean sfa_dump_enabled = false;
  public int sfa_dump_interval_ms = 10000;

  // Summary
  public boolean summary_enabled = true;
  public boolean _summary_connection_leak_fullstack_enabled = false;
  public int _summary_service_max_count = 5000;
  public int _summary_sql_max_count = 5000;
  public int _summary_api_max_count = 5000;
  public int _summary_ip_max_count = 5000;
  public int _summary_useragent_max_count = 5000;
  public int _summary_error_max_count = 500;
  public int _summary_enduser_nav_max_count = 5000;
  public int _summary_enduser_ajax_max_count = 5000;
  public int _summary_enduser_error_max_count = 5000;

  // EndUser
  public String enduser_trace_endpoint_url = "/_scouter_browser.jsp";

  // Experimental(ignoreset)
  public boolean __experimental = false;
  public boolean __control_connection_leak_autoclose_enabled = false;

  // internal variables
  private int objHash;
  private String objName;
  private int objHostHash;
  private String objHostName;
  private Set<String> static_contents = new HashSet<String>();
  private StringSet log_ignore_set = new StringSet();
  private String[] _hook_method_ignore_prefix = null;
  private int _hook_method_ignore_prefix_len = 0;
  private int hook_signature;
  private int enduser_perf_endpoint_hash = HashUtil.hash(enduser_trace_endpoint_url);

  /** sometimes call by sample application, at that time normally set some properties directly */
  private Configure() {
    Properties p = new Properties();
    Map args = new HashMap();
    args.putAll(System.getenv());
    args.putAll(System.getProperties());
    p.putAll(args);
    this.property = p;
    reload(false);
  }

  private Configure(boolean b) {}

  private long last_load_time = -1;
  public Properties property = new Properties();
  private boolean running = true;

  public void run() {
    Logger.println("Version " + Version.getAgentFullVersion());
    long dateUnit = DateUtil.getDateUnit();
    while (running) {
      reload(false);
      // Text Data Reset..
      long nowUnit = DateUtil.getDateUnit();
      if (dateUnit != nowUnit) {
        dateUnit = nowUnit;
        DataProxy.reset();
      }
      ThreadUtil.sleep(3000);
    }
  }

  private File propertyFile;

  public File getPropertyFile() {
    if (propertyFile != null) {
      return propertyFile;
    }
    String s = System.getProperty("scouter.config", "./scouter.conf");
    propertyFile = new File(s.trim());
    return propertyFile;
  }

  long last_check = 0;

  public synchronized boolean reload(boolean force) {
    long now = System.currentTimeMillis();
    if (force == false && now < last_check + 3000) return false;
    last_check = now;
    File file = getPropertyFile();
    if (file.lastModified() == last_load_time) {
      return false;
    }
    last_load_time = file.lastModified();
    Properties temp = new Properties();
    if (file.canRead()) {
      FileInputStream in = null;
      try {
        in = new FileInputStream(file);
        temp.load(in);
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        FileUtil.close(in);
      }
    }
    property = ConfigValueUtil.replaceSysProp(temp);
    apply();
    ConfObserver.run();
    return true;
  }

  private void apply() {
    this.profile_http_querystring_enabled = getBoolean("profile_http_querystring_enabled", false);
    this.profile_http_header_enabled = getBoolean("profile_http_header_enabled", false);
    this.profile_http_parameter_enabled = getBoolean("profile_http_parameter_enabled", false);
    this.profile_summary_mode_enabled = getBoolean("profile_summary_mode_enabled", false);
    this.xlog_lower_bound_time_ms = getInt("xlog_lower_bound_time_ms", 0);
    this.trace_service_name_header_key = getValue("trace_service_name_header_key", null);
    this.trace_service_name_get_key = getValue("trace_service_name_get_key");
    this.trace_service_name_post_key = getValue("trace_service_name_post_key");
    this.dump_dir = new File(getValue("dump_dir", "./dump"));
    try {
      this.dump_dir.mkdirs();
    } catch (Exception e) {
    }
    //		this.mgr_agent_lib_dir = new File(getValue("mgr_agent_lib_dir", "./_scouter_"));
    //		try {
    //			this.mgr_agent_lib_dir.mkdirs();
    //		} catch (Exception e) {
    //		}
    this.plugin_dir = new File(getValue("plugin_dir", "./plugin"));

    this.autodump_enabled = getBoolean("autodump_enabled", false);
    this.autodump_trigger_active_service_cnt = getInt("autodump_trigger_active_service_cnt", 10000);
    if (this.autodump_trigger_active_service_cnt < 1) {
      this.autodump_trigger_active_service_cnt = 1;
    }
    this.autodump_level = getInt("autodump_level", 1);
    this.autodump_interval_ms = getInt("autodump_interval_ms", 30000);
    if (this.autodump_interval_ms < 5000) {
      this.autodump_interval_ms = 5000;
    }
    this.autodump_stuck_thread_ms = getInt("autodump_stuck_thread_ms", 0);
    this.mgr_static_content_extensions =
        getValue("mgr_static_content_extensions", "js, htm, html, gif, png, jpg, css");
    this.profile_thread_cputime_enabled = getBoolean("profile_thread_cputime_enabled", false);
    this.profile_socket_open_fullstack_enabled =
        getBoolean("profile_socket_open_fullstack_enabled", false);
    this.trace_background_socket_enabled = getBoolean("trace_background_socket_enabled", true);
    this.profile_socket_open_fullstack_port = getInt("profile_socket_open_fullstack_port", 0);
    this.profile_sql_escape_enabled = getBoolean("profile_sql_escape_enabled", true);
    this.profile_sqlmap_name_enabled = getBoolean("profile_sqlmap_name_enabled", true);
    this.net_udp_packet_max_bytes = getInt("net_udp_packet_max_bytes", 60000);
    this.trace_activeserivce_yellow_time = getLong("trace_activeserivce_yellow_time", 3000);
    this.trace_activeservice_red_time = getLong("trace_activeservice_red_time", 8000);
    this.mgr_log_ignore_ids = getValue("mgr_log_ignore_ids", "");
    this.log_ignore_set = getStringSet("mgr_log_ignore_ids", ",");
    this._log_udp_xlog_enabled = getBoolean("_log_udp_xlog_enabled", false);
    this._log_udp_counter_enabled = getBoolean("_log_udp_counter_enabled", false);
    this._log_udp_object_enabled = getBoolean("_log_udp_object_enabled", false);
    this.net_local_udp_ip = getValue("net_local_udp_ip");
    this.net_local_udp_port = getInt("net_local_udp_port", 0);
    this.net_collector_ip = getValue("net_collector_ip", "127.0.0.1");
    this.net_collector_udp_port = getInt("net_collector_udp_port", NetConstants.SERVER_UDP_PORT);
    this.net_collector_tcp_port = getInt("net_collector_tcp_port", NetConstants.SERVER_TCP_PORT);
    this.net_collector_tcp_session_count = getInt("net_collector_tcp_session_count", 1, 1);
    this.net_collector_tcp_connection_timeout_ms =
        getInt("net_collector_tcp_connection_timeout_ms", 3000);
    this.net_collector_tcp_so_timeout_ms = getInt("net_collector_tcp_so_timeout_ms", 60000);
    this.hook_signature = 0;
    this.hook_args_patterns = getValue("hook_args_patterns", "");
    this.hook_return_patterns = getValue("hook_return_patterns", "");
    this.hook_constructor_patterns = getValue("hook_constructor_patterns", "");
    this.hook_connection_open_patterns = getValue("hook_connection_open_patterns", "");

    this._log_datasource_lookup_enabled = getBoolean("_log_datasource_lookup_enabled", true);
    this.profile_connection_open_enabled = getBoolean("profile_connection_open_enabled", true);
    this._summary_connection_leak_fullstack_enabled =
        getBoolean("_summary_connection_leak_fullstack_enabled", false);
    this.hook_method_patterns = getValue("hook_method_patterns", "");
    this.hook_method_access_public_enabled = getBoolean("hook_method_access_public_enabled", true);
    this.hook_method_access_protected_enabled =
        getBoolean("hook_method_access_protected_enabled", false);
    this.hook_method_access_private_enabled =
        getBoolean("hook_method_access_private_enabled", false);
    this.hook_method_access_none_enabled = getBoolean("hook_method_access_none_enabled", false);
    this.hook_method_ignore_prefixes =
        StringUtil.removeWhitespace(getValue("hook_method_ignore_prefixes", "get,set"));
    this._hook_method_ignore_prefix = StringUtil.split(this.hook_method_ignore_prefixes, ",");
    this._hook_method_ignore_prefix_len =
        this._hook_method_ignore_prefix == null ? 0 : this._hook_method_ignore_prefix.length;
    this.hook_method_ignore_classes =
        StringUtil.trimEmpty(
            StringUtil.removeWhitespace(getValue("hook_method_ignore_classes", "")));
    this._hook_method_ignore_classes =
        new StringSet(StringUtil.tokenizer(this.hook_method_ignore_classes.replace('.', '/'), ","));
    this.profile_method_enabled = getBoolean("profile_method_enabled", true);
    this.hook_service_patterns = getValue("hook_service_patterns", "");
    this.hook_apicall_patterns = getValue("hook_apicall_patterns", "");
    this.hook_apicall_info_patterns = getValue("hook_apicall_info_patterns", "");
    this.hook_jsp_patterns = getValue("hook_jsp_patterns", "");

    this.hook_jdbc_pstmt_classes = getValue("hook_jdbc_pstmt_classes", "");
    this.hook_jdbc_stmt_classes = getValue("hook_jdbc_stmt_classes", "");
    this.hook_jdbc_rs_classes = getValue("hook_jdbc_rs_classes", "");
    this.hook_jdbc_wrapping_driver_patterns = getValue("hook_jdbc_wrapping_driver_patterns", "");
    this.hook_add_fields = getValue("hook_add_fields", "");
    this.hook_context_classes = getValue("hook_context_classes", "javax/naming/InitialContext");

    this.hook_signature ^= this.hook_args_patterns.hashCode();
    this.hook_signature ^= this.hook_return_patterns.hashCode();
    this.hook_signature ^= this.hook_constructor_patterns.hashCode();
    this.hook_signature ^= this.hook_connection_open_patterns.hashCode();
    this.hook_signature ^= this.hook_method_patterns.hashCode();
    this.hook_signature ^= this.hook_service_patterns.hashCode();
    this.hook_signature ^= this.hook_apicall_patterns.hashCode();
    this.hook_signature ^= this.hook_jsp_patterns.hashCode();
    this.hook_signature ^= this.hook_jdbc_wrapping_driver_patterns.hashCode();

    this.control_reject_service_enabled = getBoolean("control_reject_service_enabled", false);
    this.control_reject_service_max_count = getInt("control_reject_service_max_count", 10000);
    this.control_reject_redirect_url_enabled =
        getBoolean("control_reject_redirect_url_enabled", false);
    this.control_reject_text = getValue("control_reject_text", "too many request!!");
    this.control_reject_redirect_url = getValue("control_reject_redirect_url", "/error.html");

    this.profile_step_max_count = getInt("profile_step_max_count", 1024);
    if (this.profile_step_max_count < 100) this.profile_step_max_count = 100;
    this._log_background_sql = getBoolean("_log_background_sql", false);
    this.profile_fullstack_service_error_enabled =
        getBoolean("profile_fullstack_service_error_enabled", false);
    this.profile_fullstack_apicall_error_enabled =
        getBoolean("profile_fullstack_apicall_error_enabled", false);
    this.profile_fullstack_sql_error_enabled =
        getBoolean("profile_fullstack_sql_error_enabled", false);
    this.profile_fullstack_sql_commit_enabled =
        getBoolean("profile_fullstack_sql_commit_enabled", false);
    this.profile_fullstack_max_lines = getInt("profile_fullstack_max_lines", 0);
    this.net_udp_collection_interval_ms = getInt("net_udp_collection_interval_ms", 100);
    this.profile_http_parameter_url_prefix = getValue("profile_http_parameter_url_prefix", "/");
    this.profile_http_header_url_prefix = getValue("profile_http_header_url_prefix", "/");
    this.trace_http_client_ip_header_key = getValue("trace_http_client_ip_header_key", "");
    this.trace_interservice_enabled = getBoolean("trace_interservice_enabled", false);
    this.trace_response_gxid_enabled = getBoolean("trace_response_gxid_enabled", false);
    this._trace_interservice_gxid_header_key =
        getValue("_trace_interservice_gxid_header_key", "X-Scouter-Gxid");
    this._trace_interservice_callee_header_key =
        getValue("_trace_interservice_callee_header_key", "X-Scouter-Callee");
    this._trace_interservice_caller_header_key =
        getValue("_trace_interservice_caller_header_key", "X-Scouter-Caller");
    this.profile_connection_open_fullstack_enabled =
        getBoolean("profile_connection_open_fullstack_enabled", false);
    this.profile_connection_autocommit_status_enabled =
        getBoolean("profile_connection_autocommit_status_enabled", false);
    this.trace_user_mode = getInt("trace_user_mode", 2);
    this.trace_user_session_key = getValue("trace_user_session_key", "JSESSIONID");
    this._trace_auto_service_enabled = getBoolean("_trace_auto_service_enabled", false);
    this._trace_auto_service_backstack_enabled =
        getBoolean("_trace_auto_service_backstack_enabled", true);
    this.counter_enabled = getBoolean("counter_enabled", true);
    this._hook_serivce_enabled = getBoolean("_hook_serivce_enabled", true);
    this._hook_dbsql_enabled = getBoolean("_hook_dbsql_enabled", true);
    this._hook_dbconn_enabled = getBoolean("_hook_dbconn_enabled", true);
    this._hook_cap_enabled = getBoolean("_hook_cap_enabled", true);
    this._hook_methods_enabled = getBoolean("_hook_methods_enabled", true);
    this._hook_socket_enabled = getBoolean("_hook_socket_enabled", true);
    this._hook_jsp_enabled = getBoolean("_hook_jsp_enabled", true);
    this._hook_async_enabled = getBoolean("_hook_async_enabled", true);
    this.trace_db2_enabled = getBoolean("trace_db2_enabled", true);
    this._hook_usertx_enabled = getBoolean("_hook_usertx_enabled", true);
    this._hook_direct_patch_classes = getValue("_hook_direct_patch_classes", "");
    this.counter_recentuser_valid_ms =
        getLong("counter_recentuser_valid_ms", DateUtil.MILLIS_PER_FIVE_MINUTE);
    this.counter_object_registry_path = getValue("counter_object_registry_path", "/tmp/scouter");
    this.sfa_dump_enabled = getBoolean("sfa_dump_enabled", false);
    this.sfa_dump_interval_ms = getInt("sfa_dump_interval_ms", 10000);
    // 웹시스템으로 부터 WAS 사이의 성능과 어떤 웹서버가 요청을 보내 왔는지를 추적하는 기능을 ON/OFF하고
    // 관련 키정보를 지정한다.
    this.trace_webserver_enabled = getBoolean("trace_webserver_enabled", false);
    this.trace_webserver_name_header_key =
        getValue("trace_webserver_name_header_key", "X-Forwarded-Host");
    this.trace_webserver_time_header_key =
        getValue("trace_webserver_time_header_key", "X-Forwarded-Time");
    // SUMMARY최대 갯수를 관리한다.
    this.summary_enabled = getBoolean("summary_enabled", true);
    this._summary_sql_max_count = getInt("_summary_sql_max_count", 5000);
    this._summary_api_max_count = getInt("_summary_api_max_count", 5000);
    this._summary_service_max_count = getInt("_summary_service_max_count", 5000);
    this._summary_ip_max_count = getInt("_summary_ip_max_count", 5000);
    this._summary_useragent_max_count = getInt("_summary_useragent_max_count", 5000);
    this._summary_error_max_count = getInt("_summary_error_max_count", 500);

    this._summary_enduser_nav_max_count = getInt("_summary_enduser_nav_max_count", 5000);
    this._summary_enduser_ajax_max_count = getInt("_summary_enduser_ajax_max_count", 5000);
    this._summary_enduser_error_max_count = getInt("_summary_enduser_error_max_count", 5000);

    // Experimental(ignoreset)
    this.__experimental = getBoolean("__experimental", false);
    this.__control_connection_leak_autoclose_enabled =
        getBoolean("_control_connection_leak_autoclose_enabled", false);

    this.alert_perm_warning_pct = getInt("alert_perm_warning_pct", 90);
    this._hook_spring_rest_enabled = getBoolean("_hook_spring_rest_enabled", false);
    this.alert_message_length = getInt("alert_message_length", 3000);
    this.alert_send_interval_ms = getInt("alert_send_interval_ms", 3000);
    this.xlog_error_jdbc_fetch_max = getInt("xlog_error_jdbc_fetch_max", 10000);
    this.xlog_error_sql_time_max_ms = getInt("xlog_error_sql_time_max_ms", 30000);
    this._log_asm_enabled = getBoolean("_log_asm_enabled", false);
    this.obj_type_inherit_to_child_enabled = getBoolean("obj_type_inherit_to_child_enabled", false);
    this._profile_fullstack_sql_connection_enabled =
        getBoolean("_profile_fullstack_sql_connection_enabled", false);
    this._trace_fullstack_socket_open_port = getInt("_trace_fullstack_socket_open_port", 0);
    this.log_dir = getValue("log_dir", "");
    this.log_rotation_enabled = getBoolean("log_rotation_enabled", true);
    this.log_keep_days = getInt("log_keep_days", 7);
    this._log_trace_enabled = getBoolean("_log_trace_enabled", false);
    this._log_trace_use_logger = getBoolean("_log_trace_use_logger", false);

    this.enduser_trace_endpoint_url =
        getValue("enduser_trace_endpoint_url", "_scouter_browser.jsp");
    this.enduser_perf_endpoint_hash = HashUtil.hash(this.enduser_trace_endpoint_url);

    this.xlog_error_check_user_transaction_enabled =
        getBoolean("xlog_error_check_user_transaction_enabled", true);

    resetObjInfo();
    setStaticContents();
  }

  public int getObjHash() {
    return this.objHash;
  }

  public String getObjName() {
    return this.objName;
  }

  public int getObjHostHash() {
    return this.objHostHash;
  }

  public String getObjHostName() {
    return this.objHostName;
  }

  public int getEndUserPerfEndpointHash() {
    return this.enduser_perf_endpoint_hash;
  }

  public boolean isIgnoreLog(String id) {
    return log_ignore_set.hasKey(id);
  }

  private StringSet getStringSet(String key, String deli) {
    StringSet set = new StringSet();
    String v = getValue(key);
    if (v != null) {
      String[] vv = StringUtil.split(v, deli);
      for (String x : vv) {
        x = StringUtil.trimToEmpty(x);
        if (x.length() > 0) set.put(x);
      }
    }
    return set;
  }

  private void setStaticContents() {
    Set<String> tmp = new HashSet<String>();
    String[] s = StringUtil.split(this.mgr_static_content_extensions, ',');
    for (int i = 0; i < s.length; i++) {
      String ss = s[i].trim();
      if (ss.length() > 0) {
        tmp.add(ss);
      }
    }
    static_contents = tmp;
  }

  public boolean isStaticContents(String content) {
    return static_contents.contains(content);
  }

  public boolean isIgnoreMethodPrefix(String name) {
    for (int i = 0; i < this._hook_method_ignore_prefix_len; i++) {
      if (name.startsWith(this._hook_method_ignore_prefix[i])) return true;
    }
    return false;
  }

  public boolean isIgnoreMethodClass(String classname) {
    return _hook_method_ignore_classes.hasKey(classname);
  }

  public synchronized void resetObjInfo() {
    String detected =
        ObjTypeDetector.drivedType != null
            ? ObjTypeDetector.drivedType
            : ObjTypeDetector.objType != null ? ObjTypeDetector.objType : CounterConstants.JAVA;
    this.obj_type = getValue("obj_type", detected);
    detected = CounterConstants.HOST;
    if (SystemUtil.IS_LINUX) {
      detected = CounterConstants.LINUX;
    } else if (SystemUtil.IS_WINDOWS) {
      detected = CounterConstants.WINDOWS;
    } else if (SystemUtil.IS_MAC_OSX) {
      detected = CounterConstants.OSX;
    } else if (SystemUtil.IS_AIX) {
      detected = CounterConstants.AIX;
    } else if (SystemUtil.IS_HP_UX) {
      detected = CounterConstants.HPUX;
    }
    this.obj_host_type = getValue("obj_host_type", detected);
    this.obj_host_name = getValue("obj_host_name", SysJMX.getHostName());
    this.objHostName = "/" + this.obj_host_name;
    this.objHostHash = HashUtil.hash(objHostName);
    this.obj_name_auto_pid_enabled = getBoolean("obj_name_auto_pid_enabled", false);
    String defaultName;
    if (this.obj_name_auto_pid_enabled == true) {
      defaultName = "" + SysJMX.getProcessPID();
    } else {
      defaultName = this.obj_type + "1";
    }
    this.obj_name = getValue("obj_name", System.getProperty("jvmRoute", defaultName));
    this.objName = objHostName + "/" + this.obj_name;
    this.objHash = HashUtil.hash(objName);
    System.setProperty("scouter.objname", this.objName);
    System.setProperty("scouter.objtype", this.obj_type);
    System.setProperty("scouter.dir", new File(".").getAbsolutePath());
  }

  public String getValue(String key) {
    return StringUtil.trim(property.getProperty(key));
  }

  public String getValue(String key, String def) {
    return StringUtil.trim(property.getProperty(key, def));
  }

  public int getInt(String key, int def) {
    try {
      String v = getValue(key);
      if (v != null) return Integer.parseInt(v);
    } catch (Exception e) {
    }
    return def;
  }

  public int getInt(String key, int def, int min) {
    try {
      String v = getValue(key);
      if (v != null) {
        return Math.max(Integer.parseInt(v), min);
      }
    } catch (Exception e) {
    }
    return Math.max(def, min);
  }

  public long getLong(String key, long def) {
    try {
      String v = getValue(key);
      if (v != null) return Long.parseLong(v);
    } catch (Exception e) {
    }
    return def;
  }

  public boolean getBoolean(String key, boolean def) {
    try {
      String v = getValue(key);
      if (v != null) return Boolean.parseBoolean(v);
    } catch (Exception e) {
    }
    return def;
  }

  public String loadText() {
    File file = getPropertyFile();
    InputStream fin = null;
    try {
      fin = new FileInputStream(file);
      byte[] buff = FileUtil.readAll(fin);
      return new String(buff);
    } catch (Exception e) {
    } finally {
      FileUtil.close(fin);
    }
    return null;
  }

  public boolean saveText(String text) {
    File file = getPropertyFile();
    OutputStream out = null;
    try {
      out = new FileOutputStream(file);
      out.write(text.getBytes());
      return true;
    } catch (Exception e) {
    } finally {
      FileUtil.close(out);
    }
    return false;
  }

  public void printConfig() {
    Logger.info("Configure -Dscouter.config=" + propertyFile);
  }

  private static HashSet<String> ignoreSet = new HashSet<String>();

  static {
    ignoreSet.add("property");
    ignoreSet.add("__experimental");
  }

  public MapValue getKeyValueInfo() {
    StringKeyLinkedMap<Object> defMap = ConfigValueUtil.getConfigDefault(new Configure(true));
    StringKeyLinkedMap<Object> curMap = ConfigValueUtil.getConfigDefault(this);
    MapValue m = new MapValue();
    ListValue nameList = m.newList("key");
    ListValue valueList = m.newList("value");
    ListValue defList = m.newList("default");
    StringEnumer enu = defMap.keys();
    while (enu.hasMoreElements()) {
      String key = enu.nextString();
      if (ignoreSet.contains(key)) continue;
      nameList.add(key);
      valueList.add(ConfigValueUtil.toValue(curMap.get(key)));
      defList.add(ConfigValueUtil.toValue(defMap.get(key)));
    }
    return m;
  }

  public int getHookSignature() {
    return this.hook_signature;
  }

  public static void main(String[] args) {
    StringKeyLinkedMap<Object> defMap = ConfigValueUtil.getConfigDefault(new Configure(true));
    StringEnumer enu = defMap.keys();
    while (enu.hasMoreElements()) {
      String key = enu.nextString();
      if (ignoreSet.contains(key)) continue;
      System.out.println(key + " : " + ConfigValueUtil.toValue(defMap.get(key)));
    }
  }
}
Exemplo n.º 22
0
 private void Resize() {
   Resize(HashUtil.expandPrime(count), false);
 }
Exemplo n.º 23
0
 public static String generateHash(
     LocaleId locale, String content, String pos, String description) {
   String hashBase = locale + SEPARATOR + content + SEPARATOR + pos + SEPARATOR + description;
   return HashUtil.generateHash(hashBase);
 }
Exemplo n.º 24
0
 private void allocateTable(int length) {
   table = new Entry[length];
   shift = HashUtil.shift(table.length);
   mask = (1 << shift) - 1;
 }
Exemplo n.º 25
0
  private void apply() {
    this.profile_http_querystring_enabled = getBoolean("profile_http_querystring_enabled", false);
    this.profile_http_header_enabled = getBoolean("profile_http_header_enabled", false);
    this.profile_http_parameter_enabled = getBoolean("profile_http_parameter_enabled", false);
    this.profile_summary_mode_enabled = getBoolean("profile_summary_mode_enabled", false);
    this.xlog_lower_bound_time_ms = getInt("xlog_lower_bound_time_ms", 0);
    this.trace_service_name_header_key = getValue("trace_service_name_header_key", null);
    this.trace_service_name_get_key = getValue("trace_service_name_get_key");
    this.trace_service_name_post_key = getValue("trace_service_name_post_key");
    this.dump_dir = new File(getValue("dump_dir", "./dump"));
    try {
      this.dump_dir.mkdirs();
    } catch (Exception e) {
    }
    //		this.mgr_agent_lib_dir = new File(getValue("mgr_agent_lib_dir", "./_scouter_"));
    //		try {
    //			this.mgr_agent_lib_dir.mkdirs();
    //		} catch (Exception e) {
    //		}
    this.plugin_dir = new File(getValue("plugin_dir", "./plugin"));

    this.autodump_enabled = getBoolean("autodump_enabled", false);
    this.autodump_trigger_active_service_cnt = getInt("autodump_trigger_active_service_cnt", 10000);
    if (this.autodump_trigger_active_service_cnt < 1) {
      this.autodump_trigger_active_service_cnt = 1;
    }
    this.autodump_level = getInt("autodump_level", 1);
    this.autodump_interval_ms = getInt("autodump_interval_ms", 30000);
    if (this.autodump_interval_ms < 5000) {
      this.autodump_interval_ms = 5000;
    }
    this.autodump_stuck_thread_ms = getInt("autodump_stuck_thread_ms", 0);
    this.mgr_static_content_extensions =
        getValue("mgr_static_content_extensions", "js, htm, html, gif, png, jpg, css");
    this.profile_thread_cputime_enabled = getBoolean("profile_thread_cputime_enabled", false);
    this.profile_socket_open_fullstack_enabled =
        getBoolean("profile_socket_open_fullstack_enabled", false);
    this.trace_background_socket_enabled = getBoolean("trace_background_socket_enabled", true);
    this.profile_socket_open_fullstack_port = getInt("profile_socket_open_fullstack_port", 0);
    this.profile_sql_escape_enabled = getBoolean("profile_sql_escape_enabled", true);
    this.profile_sqlmap_name_enabled = getBoolean("profile_sqlmap_name_enabled", true);
    this.net_udp_packet_max_bytes = getInt("net_udp_packet_max_bytes", 60000);
    this.trace_activeserivce_yellow_time = getLong("trace_activeserivce_yellow_time", 3000);
    this.trace_activeservice_red_time = getLong("trace_activeservice_red_time", 8000);
    this.mgr_log_ignore_ids = getValue("mgr_log_ignore_ids", "");
    this.log_ignore_set = getStringSet("mgr_log_ignore_ids", ",");
    this._log_udp_xlog_enabled = getBoolean("_log_udp_xlog_enabled", false);
    this._log_udp_counter_enabled = getBoolean("_log_udp_counter_enabled", false);
    this._log_udp_object_enabled = getBoolean("_log_udp_object_enabled", false);
    this.net_local_udp_ip = getValue("net_local_udp_ip");
    this.net_local_udp_port = getInt("net_local_udp_port", 0);
    this.net_collector_ip = getValue("net_collector_ip", "127.0.0.1");
    this.net_collector_udp_port = getInt("net_collector_udp_port", NetConstants.SERVER_UDP_PORT);
    this.net_collector_tcp_port = getInt("net_collector_tcp_port", NetConstants.SERVER_TCP_PORT);
    this.net_collector_tcp_session_count = getInt("net_collector_tcp_session_count", 1, 1);
    this.net_collector_tcp_connection_timeout_ms =
        getInt("net_collector_tcp_connection_timeout_ms", 3000);
    this.net_collector_tcp_so_timeout_ms = getInt("net_collector_tcp_so_timeout_ms", 60000);
    this.hook_signature = 0;
    this.hook_args_patterns = getValue("hook_args_patterns", "");
    this.hook_return_patterns = getValue("hook_return_patterns", "");
    this.hook_constructor_patterns = getValue("hook_constructor_patterns", "");
    this.hook_connection_open_patterns = getValue("hook_connection_open_patterns", "");

    this._log_datasource_lookup_enabled = getBoolean("_log_datasource_lookup_enabled", true);
    this.profile_connection_open_enabled = getBoolean("profile_connection_open_enabled", true);
    this._summary_connection_leak_fullstack_enabled =
        getBoolean("_summary_connection_leak_fullstack_enabled", false);
    this.hook_method_patterns = getValue("hook_method_patterns", "");
    this.hook_method_access_public_enabled = getBoolean("hook_method_access_public_enabled", true);
    this.hook_method_access_protected_enabled =
        getBoolean("hook_method_access_protected_enabled", false);
    this.hook_method_access_private_enabled =
        getBoolean("hook_method_access_private_enabled", false);
    this.hook_method_access_none_enabled = getBoolean("hook_method_access_none_enabled", false);
    this.hook_method_ignore_prefixes =
        StringUtil.removeWhitespace(getValue("hook_method_ignore_prefixes", "get,set"));
    this._hook_method_ignore_prefix = StringUtil.split(this.hook_method_ignore_prefixes, ",");
    this._hook_method_ignore_prefix_len =
        this._hook_method_ignore_prefix == null ? 0 : this._hook_method_ignore_prefix.length;
    this.hook_method_ignore_classes =
        StringUtil.trimEmpty(
            StringUtil.removeWhitespace(getValue("hook_method_ignore_classes", "")));
    this._hook_method_ignore_classes =
        new StringSet(StringUtil.tokenizer(this.hook_method_ignore_classes.replace('.', '/'), ","));
    this.profile_method_enabled = getBoolean("profile_method_enabled", true);
    this.hook_service_patterns = getValue("hook_service_patterns", "");
    this.hook_apicall_patterns = getValue("hook_apicall_patterns", "");
    this.hook_apicall_info_patterns = getValue("hook_apicall_info_patterns", "");
    this.hook_jsp_patterns = getValue("hook_jsp_patterns", "");

    this.hook_jdbc_pstmt_classes = getValue("hook_jdbc_pstmt_classes", "");
    this.hook_jdbc_stmt_classes = getValue("hook_jdbc_stmt_classes", "");
    this.hook_jdbc_rs_classes = getValue("hook_jdbc_rs_classes", "");
    this.hook_jdbc_wrapping_driver_patterns = getValue("hook_jdbc_wrapping_driver_patterns", "");
    this.hook_add_fields = getValue("hook_add_fields", "");
    this.hook_context_classes = getValue("hook_context_classes", "javax/naming/InitialContext");

    this.hook_signature ^= this.hook_args_patterns.hashCode();
    this.hook_signature ^= this.hook_return_patterns.hashCode();
    this.hook_signature ^= this.hook_constructor_patterns.hashCode();
    this.hook_signature ^= this.hook_connection_open_patterns.hashCode();
    this.hook_signature ^= this.hook_method_patterns.hashCode();
    this.hook_signature ^= this.hook_service_patterns.hashCode();
    this.hook_signature ^= this.hook_apicall_patterns.hashCode();
    this.hook_signature ^= this.hook_jsp_patterns.hashCode();
    this.hook_signature ^= this.hook_jdbc_wrapping_driver_patterns.hashCode();

    this.control_reject_service_enabled = getBoolean("control_reject_service_enabled", false);
    this.control_reject_service_max_count = getInt("control_reject_service_max_count", 10000);
    this.control_reject_redirect_url_enabled =
        getBoolean("control_reject_redirect_url_enabled", false);
    this.control_reject_text = getValue("control_reject_text", "too many request!!");
    this.control_reject_redirect_url = getValue("control_reject_redirect_url", "/error.html");

    this.profile_step_max_count = getInt("profile_step_max_count", 1024);
    if (this.profile_step_max_count < 100) this.profile_step_max_count = 100;
    this._log_background_sql = getBoolean("_log_background_sql", false);
    this.profile_fullstack_service_error_enabled =
        getBoolean("profile_fullstack_service_error_enabled", false);
    this.profile_fullstack_apicall_error_enabled =
        getBoolean("profile_fullstack_apicall_error_enabled", false);
    this.profile_fullstack_sql_error_enabled =
        getBoolean("profile_fullstack_sql_error_enabled", false);
    this.profile_fullstack_sql_commit_enabled =
        getBoolean("profile_fullstack_sql_commit_enabled", false);
    this.profile_fullstack_max_lines = getInt("profile_fullstack_max_lines", 0);
    this.net_udp_collection_interval_ms = getInt("net_udp_collection_interval_ms", 100);
    this.profile_http_parameter_url_prefix = getValue("profile_http_parameter_url_prefix", "/");
    this.profile_http_header_url_prefix = getValue("profile_http_header_url_prefix", "/");
    this.trace_http_client_ip_header_key = getValue("trace_http_client_ip_header_key", "");
    this.trace_interservice_enabled = getBoolean("trace_interservice_enabled", false);
    this.trace_response_gxid_enabled = getBoolean("trace_response_gxid_enabled", false);
    this._trace_interservice_gxid_header_key =
        getValue("_trace_interservice_gxid_header_key", "X-Scouter-Gxid");
    this._trace_interservice_callee_header_key =
        getValue("_trace_interservice_callee_header_key", "X-Scouter-Callee");
    this._trace_interservice_caller_header_key =
        getValue("_trace_interservice_caller_header_key", "X-Scouter-Caller");
    this.profile_connection_open_fullstack_enabled =
        getBoolean("profile_connection_open_fullstack_enabled", false);
    this.profile_connection_autocommit_status_enabled =
        getBoolean("profile_connection_autocommit_status_enabled", false);
    this.trace_user_mode = getInt("trace_user_mode", 2);
    this.trace_user_session_key = getValue("trace_user_session_key", "JSESSIONID");
    this._trace_auto_service_enabled = getBoolean("_trace_auto_service_enabled", false);
    this._trace_auto_service_backstack_enabled =
        getBoolean("_trace_auto_service_backstack_enabled", true);
    this.counter_enabled = getBoolean("counter_enabled", true);
    this._hook_serivce_enabled = getBoolean("_hook_serivce_enabled", true);
    this._hook_dbsql_enabled = getBoolean("_hook_dbsql_enabled", true);
    this._hook_dbconn_enabled = getBoolean("_hook_dbconn_enabled", true);
    this._hook_cap_enabled = getBoolean("_hook_cap_enabled", true);
    this._hook_methods_enabled = getBoolean("_hook_methods_enabled", true);
    this._hook_socket_enabled = getBoolean("_hook_socket_enabled", true);
    this._hook_jsp_enabled = getBoolean("_hook_jsp_enabled", true);
    this._hook_async_enabled = getBoolean("_hook_async_enabled", true);
    this.trace_db2_enabled = getBoolean("trace_db2_enabled", true);
    this._hook_usertx_enabled = getBoolean("_hook_usertx_enabled", true);
    this._hook_direct_patch_classes = getValue("_hook_direct_patch_classes", "");
    this.counter_recentuser_valid_ms =
        getLong("counter_recentuser_valid_ms", DateUtil.MILLIS_PER_FIVE_MINUTE);
    this.counter_object_registry_path = getValue("counter_object_registry_path", "/tmp/scouter");
    this.sfa_dump_enabled = getBoolean("sfa_dump_enabled", false);
    this.sfa_dump_interval_ms = getInt("sfa_dump_interval_ms", 10000);
    // 웹시스템으로 부터 WAS 사이의 성능과 어떤 웹서버가 요청을 보내 왔는지를 추적하는 기능을 ON/OFF하고
    // 관련 키정보를 지정한다.
    this.trace_webserver_enabled = getBoolean("trace_webserver_enabled", false);
    this.trace_webserver_name_header_key =
        getValue("trace_webserver_name_header_key", "X-Forwarded-Host");
    this.trace_webserver_time_header_key =
        getValue("trace_webserver_time_header_key", "X-Forwarded-Time");
    // SUMMARY최대 갯수를 관리한다.
    this.summary_enabled = getBoolean("summary_enabled", true);
    this._summary_sql_max_count = getInt("_summary_sql_max_count", 5000);
    this._summary_api_max_count = getInt("_summary_api_max_count", 5000);
    this._summary_service_max_count = getInt("_summary_service_max_count", 5000);
    this._summary_ip_max_count = getInt("_summary_ip_max_count", 5000);
    this._summary_useragent_max_count = getInt("_summary_useragent_max_count", 5000);
    this._summary_error_max_count = getInt("_summary_error_max_count", 500);

    this._summary_enduser_nav_max_count = getInt("_summary_enduser_nav_max_count", 5000);
    this._summary_enduser_ajax_max_count = getInt("_summary_enduser_ajax_max_count", 5000);
    this._summary_enduser_error_max_count = getInt("_summary_enduser_error_max_count", 5000);

    // Experimental(ignoreset)
    this.__experimental = getBoolean("__experimental", false);
    this.__control_connection_leak_autoclose_enabled =
        getBoolean("_control_connection_leak_autoclose_enabled", false);

    this.alert_perm_warning_pct = getInt("alert_perm_warning_pct", 90);
    this._hook_spring_rest_enabled = getBoolean("_hook_spring_rest_enabled", false);
    this.alert_message_length = getInt("alert_message_length", 3000);
    this.alert_send_interval_ms = getInt("alert_send_interval_ms", 3000);
    this.xlog_error_jdbc_fetch_max = getInt("xlog_error_jdbc_fetch_max", 10000);
    this.xlog_error_sql_time_max_ms = getInt("xlog_error_sql_time_max_ms", 30000);
    this._log_asm_enabled = getBoolean("_log_asm_enabled", false);
    this.obj_type_inherit_to_child_enabled = getBoolean("obj_type_inherit_to_child_enabled", false);
    this._profile_fullstack_sql_connection_enabled =
        getBoolean("_profile_fullstack_sql_connection_enabled", false);
    this._trace_fullstack_socket_open_port = getInt("_trace_fullstack_socket_open_port", 0);
    this.log_dir = getValue("log_dir", "");
    this.log_rotation_enabled = getBoolean("log_rotation_enabled", true);
    this.log_keep_days = getInt("log_keep_days", 7);
    this._log_trace_enabled = getBoolean("_log_trace_enabled", false);
    this._log_trace_use_logger = getBoolean("_log_trace_use_logger", false);

    this.enduser_trace_endpoint_url =
        getValue("enduser_trace_endpoint_url", "_scouter_browser.jsp");
    this.enduser_perf_endpoint_hash = HashUtil.hash(this.enduser_trace_endpoint_url);

    this.xlog_error_check_user_transaction_enabled =
        getBoolean("xlog_error_check_user_transaction_enabled", true);

    resetObjInfo();
    setStaticContents();
  }