Skip to content

Commit 3c70e3a

Browse files
authored
Merge pull request rabbitmq#2 from sofastack/add_maven_center
add maven center
2 parents 1f8ebe0 + 14b9e56 commit 3c70e3a

File tree

9 files changed

+125
-73
lines changed

9 files changed

+125
-73
lines changed

Diff for: pom.xml

+63-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<packaging>jar</packaging>
99

1010
<name>${project.groupId}:${project.artifactId}</name>
11+
<description>A library that provide some utility functions to other SOFA libraries</description>
1112
<url>https://github.com/sofastack/sofa-common-tools</url>
1213

1314
<licenses>
@@ -103,7 +104,7 @@
103104
</dependency>
104105
<dependency>
105106
<groupId>org.slf4j</groupId>
106-
<artifactId>com.springsource.slf4j.jcl</artifactId>
107+
<artifactId>slf4j-jcl</artifactId>
107108
<version>1.6.1</version>
108109
<scope>provided</scope>
109110
</dependency>
@@ -193,4 +194,65 @@
193194
</plugin>
194195
</plugins>
195196
</build>
197+
198+
<profiles>
199+
<profile>
200+
<id>release</id>
201+
<build>
202+
<plugins>
203+
<plugin>
204+
<groupId>org.apache.maven.plugins</groupId>
205+
<artifactId>maven-javadoc-plugin</artifactId>
206+
<version>2.9.1</version>
207+
<executions>
208+
<execution>
209+
<id>attach-javadocs</id>
210+
<goals>
211+
<goal>jar</goal>
212+
</goals>
213+
</execution>
214+
</executions>
215+
</plugin>
216+
<plugin>
217+
<groupId>org.sonatype.plugins</groupId>
218+
<artifactId>nexus-staging-maven-plugin</artifactId>
219+
<version>1.6.7</version>
220+
<extensions>true</extensions>
221+
<configuration>
222+
<serverId>ossrh</serverId>
223+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
224+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
225+
</configuration>
226+
</plugin>
227+
<plugin>
228+
<groupId>org.apache.maven.plugins</groupId>
229+
<artifactId>maven-gpg-plugin</artifactId>
230+
<version>1.5</version>
231+
<executions>
232+
<execution>
233+
<id>sign-artifacts</id>
234+
<phase>verify</phase>
235+
<goals>
236+
<goal>sign</goal>
237+
</goals>
238+
</execution>
239+
</executions>
240+
</plugin>
241+
</plugins>
242+
</build>
243+
<distributionManagement>
244+
<snapshotRepository>
245+
<id>ossrh</id>
246+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
247+
</snapshotRepository>
248+
<repository>
249+
<id>ossrh</id>
250+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
251+
</repository>
252+
</distributionManagement>
253+
</profile>
254+
</profiles>
255+
256+
257+
196258
</project>

Diff for: src/main/java/com/alipay/sofa/common/log/MultiAppLoggerSpaceManager.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -227,22 +227,20 @@ private static AbstractLoggerSpaceFactory getILoggerFactoryBySpaceName(SpaceId s
227227
}
228228

229229
/**
230-
* 用于并发场景非严格判断space是否init用;
230+
* 用于并发场景非严格判断space是否init用;该场景中不和初始化场景锁同步,也就是不保证并发时严格判断正确;
231231
*
232232
* @param spaceName
233233
* @return
234-
* @NotThreadSafe 该场景中不和初始化场景锁同步,也就是不保证并发时严格判断正确;
235234
*/
236235
public static boolean isSpaceInitialized(String spaceName) {
237236
return isSpaceInitialized(new SpaceId(spaceName));
238237
}
239238

240239
/**
241-
* 用于并发场景非严格判断space是否init用;
240+
* 用于并发场景非严格判断space是否init用;该场景中不和初始化场景锁同步,也就是不保证并发时严格判断正确;
242241
*
243242
* @param spaceId
244243
* @return
245-
* @NotThreadSafe 该场景中不和初始化场景锁同步,也就是不保证并发时严格判断正确;
246244
*/
247245
public static boolean isSpaceInitialized(SpaceId spaceId) {
248246
return spacesMap.get(spaceId) != null;

Diff for: src/main/java/com/alipay/sofa/common/log/ReportUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* ReportUtil
2121
* <p>
2222
* 参照:slf4j 输出信息到控制台及默认(业务app中配置的)日志
23-
* <p/>
23+
* <p>
2424
* Created by yangguanchao on 16/9/24.
2525
*/
2626
public class ReportUtil {

Diff for: src/main/java/com/alipay/sofa/common/log/env/LogEnvUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
/**
2626
* 日志环境工具类:根据不同的环境选择不同的日志实现
27-
* <p/>
27+
* <p>
2828
* Created by yangguanchao on 16/9/20.
2929
*/
3030
public final class LogEnvUtils {

Diff for: src/main/java/com/alipay/sofa/common/log/factory/LoggerSpaceFactory4CommonsLoggingBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
/**
3636
* 日志环境工具类:根据不同的环境选择不同的日志实现:日志实现仍然使用log4j,不过兼容了 commons-logging 日志打印的情况
37-
* <p/>
37+
* <p>
3838
* Created by yangguanchao on 17/01/17.
3939
*/
4040
public class LoggerSpaceFactory4CommonsLoggingBuilder extends AbstractLoggerSpaceFactoryBuilder {

Diff for: src/main/java/com/alipay/sofa/common/log/factory/LoggerSpaceFactory4Log4jBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
/**
3636
* 日志环境工具类:根据不同的环境选择不同的日志实现
37-
* <p/>
37+
* <p>
3838
* Created by yangguanchao on 17/01/17.
3939
*/
4040
public class LoggerSpaceFactory4Log4jBuilder extends AbstractLoggerSpaceFactoryBuilder {

Diff for: src/main/java/com/alipay/sofa/common/log/global/Slite2LogPathInit.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121

2222
/**
2323
* Slite2LogPathInit
24-
* <p/>
24+
* <p>
2525
* Created by yangguanchao on 16/11/3.
2626
*/
2727
public class Slite2LogPathInit {
2828

2929
/***
3030
* 在中间件 starter 的 ApplicationContextInitializer 要调用此函数做判断,来达到设置日志路径的目的:
31-
* <p/>
31+
* <p>
3232
* 1.是否设置了全局路径参数 logging.path
3333
* 2.没有设置将设置路径 middlewareLoggingPath
3434
*

Diff for: src/main/java/com/alipay/sofa/common/profile/diagnostic/Profiler.java

+21-35
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,11 @@ public static void start() {
4141
}
4242

4343
public static void start(String message) {
44-
entryStack.set(new Profiler.Entry(message,
45-
null,
46-
null));
44+
entryStack.set(new Profiler.Entry(message, null, null));
4745
}
4846

4947
public static void start(Profiler.Message message) {
50-
entryStack.set(new Profiler.Entry(message,
51-
null,
52-
null));
48+
entryStack.set(new Profiler.Entry(message, null, null));
5349
}
5450

5551
public static void reset() {
@@ -81,8 +77,7 @@ public static void release() {
8177
}
8278

8379
public static long getDuration() {
84-
Profiler.Entry entry = (Profiler.Entry) entryStack
85-
.get();
80+
Profiler.Entry entry = (Profiler.Entry) entryStack.get();
8681
return entry != null ? entry.getDuration() : -1L;
8782
}
8883

@@ -95,8 +90,7 @@ public static String dump(String prefix) {
9590
}
9691

9792
public static String dump(String prefix1, String prefix2) {
98-
Profiler.Entry entry = (Profiler.Entry) entryStack
99-
.get();
93+
Profiler.Entry entry = (Profiler.Entry) entryStack.get();
10094
return entry != null ? entry.toString(prefix1, prefix2) : "";
10195
}
10296

@@ -105,8 +99,7 @@ public static Profiler.Entry getEntry() {
10599
}
106100

107101
private static Profiler.Entry getCurrentEntry() {
108-
Profiler.Entry subEntry = (Profiler.Entry) entryStack
109-
.get();
102+
Profiler.Entry subEntry = (Profiler.Entry) entryStack.get();
110103
Profiler.Entry entry = null;
111104
if (subEntry != null) {
112105
do {
@@ -127,33 +120,30 @@ public interface Message {
127120
}
128121

129122
public static final class MessageLevel extends IntegerEnum {
130-
private static final long serialVersionUID = 3257849896026388537L;
131-
public static final Profiler.MessageLevel NO_MESSAGE = (Profiler.MessageLevel) create();
132-
public static final Profiler.MessageLevel BRIEF_MESSAGE = (Profiler.MessageLevel) create();
123+
private static final long serialVersionUID = 3257849896026388537L;
124+
public static final Profiler.MessageLevel NO_MESSAGE = (Profiler.MessageLevel) create();
125+
public static final Profiler.MessageLevel BRIEF_MESSAGE = (Profiler.MessageLevel) create();
133126
public static final Profiler.MessageLevel DETAILED_MESSAGE = (Profiler.MessageLevel) create();
134127

135128
public MessageLevel() {
136129
}
137130
}
138131

139132
public static final class Entry {
140-
private final List subEntries;
141-
private final Object message;
133+
private final List subEntries;
134+
private final Object message;
142135
private final Profiler.Entry parentEntry;
143136
private final Profiler.Entry firstEntry;
144-
private final long baseTime;
145-
private final long startTime;
146-
private long endTime;
137+
private final long baseTime;
138+
private final long startTime;
139+
private long endTime;
147140

148-
private Entry(Object message,
149-
Profiler.Entry parentEntry,
150-
Profiler.Entry firstEntry) {
141+
private Entry(Object message, Profiler.Entry parentEntry, Profiler.Entry firstEntry) {
151142
this.subEntries = new ArrayList(4);
152143
this.message = message;
153144
this.startTime = System.currentTimeMillis();
154145
this.parentEntry = parentEntry;
155-
this.firstEntry = (Profiler.Entry) ObjectUtil
156-
.defaultIfNull(firstEntry, this);
146+
this.firstEntry = (Profiler.Entry) ObjectUtil.defaultIfNull(firstEntry, this);
157147
this.baseTime = firstEntry == null ? 0L : firstEntry.startTime;
158148
}
159149

@@ -198,8 +188,7 @@ public long getDurationOfSelf() {
198188
return duration;
199189
} else {
200190
for (int i = 0; i < this.subEntries.size(); ++i) {
201-
Profiler.Entry subEntry = (Profiler.Entry) this.subEntries
202-
.get(i);
191+
Profiler.Entry subEntry = (Profiler.Entry) this.subEntries.get(i);
203192
duration -= subEntry.getDuration();
204193
}
205194

@@ -240,16 +229,14 @@ private boolean isReleased() {
240229
}
241230

242231
private void enterSubEntry(Object message) {
243-
Profiler.Entry subEntry = new Profiler.Entry(
244-
message, this, this.firstEntry);
232+
Profiler.Entry subEntry = new Profiler.Entry(message, this, this.firstEntry);
245233
this.subEntries.add(subEntry);
246234
}
247235

248236
private Profiler.Entry getUnreleasedEntry() {
249237
Profiler.Entry subEntry = null;
250238
if (!this.subEntries.isEmpty()) {
251-
subEntry = (Profiler.Entry) this.subEntries
252-
.get(this.subEntries.size() - 1);
239+
subEntry = (Profiler.Entry) this.subEntries.get(this.subEntries.size() - 1);
253240
if (subEntry.isReleased()) {
254241
subEntry = null;
255242
}
@@ -276,8 +263,8 @@ private void toString(StringBuffer buffer, String prefix1, String prefix2) {
276263
long durationOfSelf = this.getDurationOfSelf();
277264
double percent = this.getPecentage();
278265
double percentOfAll = this.getPecentageOfAll();
279-
Object[] params = new Object[]{message, new Long(startTime), new Long(duration),
280-
new Long(durationOfSelf), new Double(percent), new Double(percentOfAll)};
266+
Object[] params = new Object[] { message, new Long(startTime), new Long(duration),
267+
new Long(durationOfSelf), new Double(percent), new Double(percentOfAll) };
281268
StringBuffer pattern = new StringBuffer("{1,number} ");
282269
if (this.isReleased()) {
283270
pattern.append("[{2,number}ms");
@@ -305,8 +292,7 @@ private void toString(StringBuffer buffer, String prefix1, String prefix2) {
305292
buffer.append(MessageFormat.format(pattern.toString(), params));
306293

307294
for (int i = 0; i < this.subEntries.size(); ++i) {
308-
Profiler.Entry subEntry = (Profiler.Entry) this.subEntries
309-
.get(i);
295+
Profiler.Entry subEntry = (Profiler.Entry) this.subEntries.get(i);
310296
buffer.append('\n');
311297
if (i == this.subEntries.size() - 1) {
312298
subEntry.toString(buffer, prefix2 + "`---", prefix2 + " ");

0 commit comments

Comments
 (0)