Skip to content

Commit

Permalink
[release]: release for 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
slievrly committed Feb 8, 2021
2 parents f270a2d + 9569bed commit f8359f0
Show file tree
Hide file tree
Showing 69 changed files with 786 additions and 274 deletions.
10 changes: 9 additions & 1 deletion all/pom.xml
Expand Up @@ -21,7 +21,7 @@

<groupId>io.seata</groupId>
<artifactId>seata-all</artifactId>
<version>1.4.0</version>
<version>1.4.1</version>

<name>Seata All-in-one ${project.version}</name>
<url>http://seata.io</url>
Expand Down Expand Up @@ -289,6 +289,11 @@
<artifactId>seata-compressor-lz4</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-compressor-deflater</artifactId>
<version>${project.version}</version>
</dependency>

<!-- saga -->
<dependency>
Expand Down Expand Up @@ -681,11 +686,13 @@
<include>io.seata:seata-saga-rm</include>
<include>io.seata:seata-saga-tm</include>
<include>io.seata:seata-saga-engine-store</include>
<!--compressor-->
<include>io.seata:seata-compressor-gzip</include>
<include>io.seata:seata-compressor-7z</include>
<include>io.seata:seata-compressor-bzip2</include>
<include>io.seata:seata-compressor-zip</include>
<include>io.seata:seata-compressor-lz4</include>
<include>io.seata:seata-compressor-deflater</include>
</includes>
</artifactSet>
<transformers>
Expand Down Expand Up @@ -771,6 +778,7 @@
<serverId>oss_seata</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
<skipStagingRepositoryClose>true</skipStagingRepositoryClose>
</configuration>
</plugin>
<plugin>
Expand Down
3 changes: 2 additions & 1 deletion bom/pom.xml
Expand Up @@ -20,7 +20,7 @@

<groupId>io.seata</groupId>
<artifactId>seata-bom</artifactId>
<version>1.4.0</version>
<version>1.4.1</version>

<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
Expand Down Expand Up @@ -567,6 +567,7 @@
<serverId>oss_seata</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
<skipStagingRepositoryClose>true</skipStagingRepositoryClose>
</configuration>
</plugin>
<plugin>
Expand Down
Expand Up @@ -206,6 +206,11 @@ public enum FrameworkErrorCode {
*/
StateMachineExecutionTimeout("0421", "State machine execution timeout", "State machine execution timeout"),

/**
* State machine execution no choice matched
*/
StateMachineNoChoiceMatched("0422", "State machine no choice matched", "State machine no choice matched"),

/**
* Undefined error
*/
Expand Down
Expand Up @@ -31,7 +31,7 @@
*/
public class NamedThreadFactory implements ThreadFactory {
private final static Map<String, AtomicInteger> PREFIX_COUNTER = new ConcurrentHashMap<>();

private final ThreadGroup group;
private final AtomicInteger counter = new AtomicInteger(0);
private final String prefix;
private final int totalSize;
Expand All @@ -47,6 +47,8 @@ public class NamedThreadFactory implements ThreadFactory {
public NamedThreadFactory(String prefix, int totalSize, boolean makeDaemons) {
int prefixCounter = CollectionUtils.computeIfAbsent(PREFIX_COUNTER, prefix, key -> new AtomicInteger(0))
.incrementAndGet();
SecurityManager securityManager = System.getSecurityManager();
group = (securityManager != null) ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup();
this.prefix = prefix + "_" + prefixCounter;
this.makeDaemons = makeDaemons;
this.totalSize = totalSize;
Expand Down Expand Up @@ -78,7 +80,7 @@ public Thread newThread(Runnable r) {
if (totalSize > 1) {
name += "_" + totalSize;
}
Thread thread = new FastThreadLocalThread(r, name);
Thread thread = new FastThreadLocalThread(group, r, name);

thread.setDaemon(makeDaemons);
if (thread.getPriority() != Thread.NORM_PRIORITY) {
Expand Down
Expand Up @@ -65,4 +65,12 @@ public void testThreadNameHasCounterWithPrefixCounter() {
.isEqualTo(thread.getName());
}
}

@Test
public void testNamedThreadFactoryWithSecurityManager() {
NamedThreadFactory factory = new NamedThreadFactory("testThreadGroup", true);
Thread thread = factory.newThread(() -> {});
assertThat(thread.getThreadGroup()).isNotNull();
}

}
1 change: 1 addition & 0 deletions compressor/pom.xml
Expand Up @@ -34,6 +34,7 @@
<module>seata-compressor-7z</module>
<module>seata-compressor-bzip2</module>
<module>seata-compressor-lz4</module>
<module>seata-compressor-deflater</module>
</modules>


Expand Down
5 changes: 5 additions & 0 deletions compressor/seata-compressor-all/pom.xml
Expand Up @@ -47,6 +47,11 @@
<artifactId>seata-compressor-zip</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-compressor-deflater</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
39 changes: 39 additions & 0 deletions compressor/seata-compressor-deflater/pom.xml
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 1999-2019 Seata.io Group.
~
~ Licensed 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.seata</groupId>
<artifactId>seata-compressor</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>seata-compressor-deflater</artifactId>
<packaging>jar</packaging>
<name>seata-compressor-deflater ${project.version}</name>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>


</project>
@@ -0,0 +1,37 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed 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 io.seata.compressor.deflater;

import io.seata.common.loader.LoadLevel;
import io.seata.core.compressor.Compressor;

/**
* @author dongzl
*/
@LoadLevel(name = "DEFLATER")
public class DeflaterCompressor implements Compressor {

@Override
public byte[] compress(byte[] bytes) {
return DeflaterUtil.compress(bytes);
}

@Override
public byte[] decompress(byte[] bytes) {
return DeflaterUtil.decompress(bytes);
}

}
@@ -0,0 +1,78 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed 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 io.seata.compressor.deflater;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.Deflater;
import java.util.zip.Inflater;

/**
* @author dongzl
*/
public class DeflaterUtil {

private DeflaterUtil() {

}

private static final int BUFFER_SIZE = 8192;

public static byte[] compress(byte[] bytes) {
if (bytes == null) {
throw new NullPointerException("bytes is null");
}
int lenght = 0;
Deflater deflater = new Deflater();
deflater.setInput(bytes);
deflater.finish();
byte[] outputBytes = new byte[BUFFER_SIZE];
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
while (!deflater.finished()) {
lenght = deflater.deflate(outputBytes);
bos.write(outputBytes, 0, lenght);
}
deflater.end();
return bos.toByteArray();
} catch (IOException e) {
throw new RuntimeException("Deflater compress error", e);
}
}

public static byte[] decompress(byte[] bytes) {
if (bytes == null) {
throw new NullPointerException("bytes is null");
}
int length = 0;
Inflater inflater = new Inflater();
inflater.setInput(bytes);
byte[] outputBytes = new byte[BUFFER_SIZE];
try (ByteArrayOutputStream bos = new ByteArrayOutputStream();) {
while (!inflater.finished()) {
length = inflater.inflate(outputBytes);
if (length == 0) {
break;
}
bos.write(outputBytes, 0, length);
}
inflater.end();
return bos.toByteArray();
} catch (Exception e) {
throw new RuntimeException("Deflater decompress error", e);
}
}

}
@@ -0,0 +1 @@
io.seata.compressor.deflater.DeflaterCompressor
@@ -0,0 +1,34 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed 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 io.seata.compressor.deflater;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* @author dongzl
*/
public class DeflaterCompressorTest {

@Test
public void testCompressAndDecompress() {
DeflaterCompressor compressor = new DeflaterCompressor();
byte[] bytes = "seata".getBytes();
bytes = compressor.compress(bytes);
bytes = compressor.decompress(bytes);
Assertions.assertEquals(new String(bytes), "seata");
}
}
@@ -0,0 +1,47 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed 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 io.seata.compressor.deflater;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* @author dongzl
*/
public class DeflaterUtilTest {

@Test
public void test_compress() {
Assertions.assertThrows(NullPointerException.class, () -> {
DeflaterUtil.compress(null);
});
}

@Test
public void test_decompress() {
Assertions.assertThrows(NullPointerException.class, () -> {
DeflaterUtil.decompress(null);
});
}

@Test
public void test_compressEqualDecompress() {
byte[] compress = DeflaterUtil.compress("seata".getBytes());
byte[] decompress = DeflaterUtil.decompress(compress);
Assertions.assertEquals("seata", new String(decompress));
}

}
Expand Up @@ -48,7 +48,12 @@ public enum CompressorType {
/**
* The lz4.
*/
LZ4((byte) 5);
LZ4((byte) 5),

/**
* The deflater.
*/
DEFLATER((byte) 6);

private final byte code;

Expand Down

0 comments on commit f8359f0

Please sign in to comment.