Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/publish-to-maven.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will publish AMaaS Java SDK to Maven Central with OSSRH
# This workflow will publish AMaaS Java SDK to Maven Central via Central Publisher Portal

name: Java with Maven

Expand All @@ -16,8 +16,8 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
server-id: ossrh
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
Expand All @@ -38,6 +38,6 @@ jobs:
run: |
mvn -B clean ${{env.PACK_CMD}}
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
distribution: 'temurin'

- name: Run unit tests
run: |
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM openjdk:8-jdk-bullseye@sha256:c25fa22ba2961758802ea63bc4622999a305086405d9d03b065925da00cb8bb6 as build_env
FROM eclipse-temurin:8-jdk@sha256:3b1808f3745f1bbbb3611a4f774a0a8940af9de318f1d725e49e2ea8fbc176e6 as build_env

ARG BUILD_VERSION
ARG PACK_CMD=package
Expand All @@ -9,7 +9,7 @@ RUN useradd -m su-amaas
# Dependencies

RUN apt-get update && apt-get install -y --no-install-recommends \
maven=3.6.3-5 \
maven \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.0
1.6.1
30 changes: 17 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.trend</groupId>
<artifactId>file-security-java-sdk</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>

<name>file-security-java-sdk</name>
<url>https://github.com/trendmicro/tm-v1-fs-java-sdk</url>
Expand Down Expand Up @@ -33,8 +34,8 @@

<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>central</id>
<url>https://central.sonatype.com/api/v1/publisher/deployments/</url>
</repository>
</distributionManagement>

Expand Down Expand Up @@ -86,13 +87,16 @@
<artifactId>grpc-netty</artifactId>
<version>1.73.0</version>
<exclusions>
<exclusion><groupId>io.netty</groupId><artifactId>*</artifactId></exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.121.Final</version>
<version>4.2.6.Final</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
Expand All @@ -111,7 +115,7 @@
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<pluginManagement> <!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
Expand Down Expand Up @@ -252,14 +256,14 @@
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<publishingServerId>central</publishingServerId>
<tokenAuth>true</tokenAuth>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
</plugins>
Expand Down
28 changes: 18 additions & 10 deletions src/main/java/com/trend/cloudone/amaas/AMaasClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,24 @@ private ManagedChannel buildChannelWithProxy(final String target, final ProxyCon
builder.usePlaintext();
}

final int keepAliveTimeSecs = 60;
final int keepAliveTimeoutSecs = 5;
final int connectTimeoutMs = 30000;

builder
.keepAliveTime(keepAliveTimeSecs, TimeUnit.SECONDS)
.keepAliveTimeout(keepAliveTimeoutSecs, TimeUnit.SECONDS)
.keepAliveWithoutCalls(true) // Keep connection alive even when idle
.withOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectTimeoutMs);

log(
Level.FINE,
"Configured keep-alive: time={0}s, timeout={1}s, connectTimeout={2}ms",
keepAliveTimeSecs,
keepAliveTimeoutSecs,
connectTimeoutMs
);

// Configure proxy if needed
String proxyUrl = proxyConfig.getProxyUrl(target);
if (proxyUrl != null) {
Expand Down Expand Up @@ -255,16 +273,6 @@ public NioSocketChannel newChannel() {
setProxyAuthenticator(proxyConfig);
}
}

// Set connection timeout for proxy connections
final int keepAliveTimeSecs = 30;
final int keepAliveTimeoutSecs = 10;
final int connectTimeoutMs = 30000; // 30 seconds

builder.keepAliveTime(keepAliveTimeSecs, TimeUnit.SECONDS);
builder.keepAliveTimeout(keepAliveTimeoutSecs, TimeUnit.SECONDS);
builder.keepAliveWithoutCalls(true);
builder.withOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectTimeoutMs);
}

/**
Expand Down