PHOENIX-2715 Query Log (Ankit Singhal)
[phoenix.git] / phoenix-core / src / main / java / org / apache / phoenix / log / RingBufferEvent.java
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.phoenix.log;
19
20 import com.google.common.collect.ImmutableMap;
21 import com.lmax.disruptor.EventFactory;
22
23 class RingBufferEvent {
24 private String queryId;
25 private QueryLogState logState;
26 private LogLevel connectionLogLevel;
27 private ImmutableMap<QueryLogInfo, Object> queryInfo;
28
29 public static final Factory FACTORY = new Factory();
30
31 /**
32 * Creates the events that will be put in the RingBuffer.
33 */
34 private static class Factory implements EventFactory<RingBufferEvent> {
35 @Override
36 public RingBufferEvent newInstance() {
37 final RingBufferEvent result = new RingBufferEvent();
38 return result;
39 }
40 }
41
42 public void clear() {
43 this.logState=null;
44 this.queryInfo=null;
45 this.queryId=null;
46 }
47
48
49 public String getQueryId() {
50 return queryId;
51 }
52
53 public static Factory getFactory() {
54 return FACTORY;
55 }
56
57 public QueryLogState getLogState() {
58 return logState;
59 }
60
61 public void setQueryInfo(ImmutableMap<QueryLogInfo, Object> queryInfo) {
62 this.queryInfo=queryInfo;
63
64 }
65
66 public void setQueryId(String queryId) {
67 this.queryId=queryId;
68
69 }
70
71 public ImmutableMap<QueryLogInfo, Object> getQueryInfo() {
72 return queryInfo;
73
74 }
75
76 public void setLogState(QueryLogState logState) {
77 this.logState=logState;
78
79 }
80
81
82 public LogLevel getConnectionLogLevel() {
83 return connectionLogLevel;
84 }
85
86
87 public void setConnectionLogLevel(LogLevel connectionLogLevel) {
88 this.connectionLogLevel = connectionLogLevel;
89 }
90
91
92
93 }