001package io.ebean.meta; 002 003import java.util.HashSet; 004import java.util.Set; 005 006/** 007 * Initiate query plan collection for plans by their hash or all query plans. 008 */ 009public class QueryPlanInit { 010 011 private boolean all; 012 013 private Set<String> hashes = new HashSet<>(); 014 015 private long thresholdMicros; 016 017 /** 018 * Return true if this initiates bind collection on all query plans. 019 */ 020 public boolean isAll() { 021 return all; 022 } 023 024 /** 025 * Set to true to initiate bind collection on all query plans. 026 */ 027 public void setAll(boolean all) { 028 this.all = all; 029 } 030 031 /** 032 * Return the query execution time threshold which must be exceeded to initiate 033 * query plan collection. 034 */ 035 public long getThresholdMicros() { 036 return thresholdMicros; 037 } 038 039 /** 040 * Set the query execution time threshold which must be exceeded to initiate 041 * query plan collection. 042 */ 043 public void setThresholdMicros(long thresholdMicros) { 044 this.thresholdMicros = thresholdMicros; 045 } 046 047 /** 048 * Return true if the query plan should be initiated based on it's hash. 049 */ 050 public boolean includeHash(String hash) { 051 return all || hashes.contains(hash); 052 } 053 054 /** 055 * Return the specific hashes that we want to collect query plans on. 056 */ 057 public Set<String> getHashes() { 058 return hashes; 059 } 060 061 /** 062 * Set the specific hashes that we want to collect query plans on. 063 */ 064 public void setHashes(Set<String> hashes) { 065 this.hashes = hashes; 066 } 067}