Clean up years ago legacy codes (#185)
This commit is contained in:
parent
5bc1d1d1f1
commit
7dcc695f3e
|
|
@ -30,4 +30,6 @@ public class Constants {
|
|||
// The name of the layer that represents agent-installed services,
|
||||
// which is defined at https://github.com/apache/skywalking/blob/85ce1645be53e46286f36c0ea206c60db2d1a716/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java#L30
|
||||
public static String EVENT_LAYER_NAME = "GENERAL";
|
||||
|
||||
public static int NULL_VALUE = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Constants;
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.TracingContext;
|
||||
import org.apache.skywalking.apm.agent.core.context.status.StatusCheckService;
|
||||
|
|
@ -32,7 +33,6 @@ import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
|||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.ThrowableTransformer;
|
||||
import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil;
|
||||
import org.apache.skywalking.apm.network.language.agent.v3.SpanObject;
|
||||
import org.apache.skywalking.apm.network.language.agent.v3.SpanType;
|
||||
import org.apache.skywalking.apm.network.trace.component.Component;
|
||||
|
|
@ -274,7 +274,7 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
|
|||
if (this.layer != null) {
|
||||
spanBuilder.setSpanLayerValue(this.layer.getCode());
|
||||
}
|
||||
if (componentId != DictionaryUtil.nullValue()) {
|
||||
if (componentId != Constants.NULL_VALUE) {
|
||||
spanBuilder.setComponentId(componentId);
|
||||
}
|
||||
spanBuilder.setIsError(errorOccurred);
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
package org.apache.skywalking.apm.agent.core.context.trace;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.conf.Constants;
|
||||
import org.apache.skywalking.apm.agent.core.context.TracingContext;
|
||||
import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil;
|
||||
import org.apache.skywalking.apm.network.trace.component.Component;
|
||||
|
||||
/**
|
||||
|
|
@ -105,7 +105,7 @@ public class EntrySpan extends StackBasedTracingSpan {
|
|||
}
|
||||
|
||||
private void clearWhenRestart() {
|
||||
this.componentId = DictionaryUtil.nullValue();
|
||||
this.componentId = Constants.NULL_VALUE;
|
||||
this.layer = null;
|
||||
this.logs = null;
|
||||
this.tags = null;
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.agent.core.dictionary;
|
||||
|
||||
public class DictionaryUtil {
|
||||
public static int nullValue() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean isNull(int id) {
|
||||
return id == nullValue();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.agent.core.dictionary;
|
||||
|
||||
public class Found extends PossibleFound {
|
||||
public Found(int value) {
|
||||
super(value);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.agent.core.dictionary;
|
||||
|
||||
public class NotFound extends PossibleFound {
|
||||
public NotFound() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.agent.core.dictionary;
|
||||
|
||||
/**
|
||||
* The <code>PossibleFound</code> represents a value, which may needEnhance or not.
|
||||
*/
|
||||
public abstract class PossibleFound {
|
||||
private boolean found;
|
||||
private int value;
|
||||
|
||||
PossibleFound(int value) {
|
||||
this.found = true;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
PossibleFound() {
|
||||
this.found = false;
|
||||
}
|
||||
|
||||
public void doInCondition(Found condition1, NotFound condition2) {
|
||||
if (found) {
|
||||
condition1.doProcess(value);
|
||||
} else {
|
||||
condition2.doProcess();
|
||||
}
|
||||
}
|
||||
|
||||
public Object doInCondition(FoundAndObtain condition1, NotFoundAndObtain condition2) {
|
||||
if (found) {
|
||||
return condition1.doProcess(value);
|
||||
} else {
|
||||
return condition2.doProcess();
|
||||
}
|
||||
}
|
||||
|
||||
public interface Found {
|
||||
void doProcess(int value);
|
||||
}
|
||||
|
||||
public interface NotFound {
|
||||
void doProcess();
|
||||
}
|
||||
|
||||
public interface FoundAndObtain {
|
||||
Object doProcess(int value);
|
||||
}
|
||||
|
||||
public interface NotFoundAndObtain {
|
||||
Object doProcess();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.agent.core.dictionary;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DictionaryUtilTests {
|
||||
|
||||
@Test
|
||||
public void testNullValue() {
|
||||
Assert.assertEquals(0, DictionaryUtil.nullValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsNull() {
|
||||
Assert.assertEquals(false, DictionaryUtil.isNull(1));
|
||||
Assert.assertEquals(true, DictionaryUtil.isNull(0));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue